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
-
Wine implements it too, here's the pile of automagic nonsense that you need to explicitly turn off: https://github.com/wine-mirror/wine/blob/master/programs/cmd/wcmdmain.c#L2586 … Yes it literally is taking the entire command, spaces and all, and trying it as a single space-containing file path before actually trying it as a command
1 reply 3 retweets 27 likesShow this thread -
Here are the MS docs on this behavior, which are almost incomprehensible:https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd …
4 replies 1 retweet 21 likesShow this thread -
Replying to @marcan42
Well, to be *perfectly* fair, quotes around the command line aren't required, so I think it's assuming you meant this [which also opens calc]. Still, being able to do it with a nonexistent path is a bit shocking. And it goes against how most programs process arguments.pic.twitter.com/19mEFrPpYC
1 reply 0 retweets 0 likes -
Replying to @Random832
But it's inconsistent. You can put quotes around a command line with space separated arguments and it'll interpret it as a command line, if an executable of the same name as the whole doesn't exist. Its different from how the normal interactive parsing works.
1 reply 0 retweets 0 likes -
Replying to @marcan42
sure, but those cases are it allowing unnecessary quotes. as far as I can tell there aren't any cases where quotes that aren't meant as part of the command are helpful.
1 reply 0 retweets 0 likes
But what if the quotes *are* necessary then, and you want to start a program with spaces in the filename? Then if that file does not exist it'll fall back to potentially running something else. Either way you look at it, this automagic behavior is wrong.
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.