TIL that on windows, cmd.exe /c implements a CVE for you by default, by automagically interpreting any passed *command line* as a *filename with spaces*. You need to pass /s to turn off the free CVE. So cmd /c "ping http://evil.com/../../../../../../windows/calc.exe" pops calc.
-
Show this thread
-
why doesn't it just fail if it doesn't find a directory named "ping http://evil.com" ?
1 reply 0 retweets 0 likes -
Replying to @cathodion @Tamschi_
Because Windows simplifies ..\ components in paths *before* actually hitting the filesystem.
1 reply 0 retweets 0 likes -
Simplifies them to what? It means "go up a directory", but it has to go up starting from somewhere, right?
1 reply 0 retweets 0 likes -
Replying to @cathodion @Tamschi_
<anything>\..\ gets removed, regardless of whether <anything> exists or not.
1 reply 0 retweets 0 likes -
So is the "ping http://evil,com" part there just to give it "something" before the \..\ or is it actually doing something?
1 reply 0 retweets 0 likes -
Replying to @cathodion @Tamschi_
The "ping http://evil.com " is there because if it were "ping 1.2.3.4" it would actually work as a proper ping command, and passing vaguely-sanitized user data after a ping command to cmd /c would be a common use case.
1 reply 0 retweets 0 likes -
so cmd /c "ping google.com" pings google, and cmd /c "ping google.com/../../../../windows/calc.exe" pops calc.
1 reply 3 retweets 11 likes -
So the reason this is a vulnerability, not just a bug, would be if they're running a script that uses cmd /c "some string built from your user input", if your user input can contain \..\ you can pop calc (or some other exploitable exe)?
1 reply 0 retweets 2 likes
Yes, even if the string is otherwise also a valid command that would perform some other function.
-
-
I see. Thanks for indulging my questions :)
0 replies 0 retweets 2 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.