Overview
| Artifact ID: | 934236ce4b284ff968784e0257267632428280a929a01266fcd60b69c7e21fb9 |
|---|---|
| Ticket: | 21b0629c81fbe38ad153cd8fd899626200a66e15
0-day vulnerability - insufficient escape by exec of batch-files for windows |
| User & Date: | sebres on 2023-11-16 14:15:48 |
Changes
- icomment:
Well, conditionally true... Even main of many script langs are implemented not very compliant to "default" parameters parsing - see [the table in spoiler](https://github.com/reactos/reactos/pull/5186#issuecomment-1481559820). But there is `CommandLineToArgvW` as well as `main` of msvcrt, ucrt, libstdc (mingw/gcc) and co, that behave in the same way. Even reactos, wine and other "windows-like" systems and libraries implementing the command line parsing in that "standard" way. Although the more or less correct handling of comspec (cmd/bat/etc) is hard job, and one can't really do that fully correctly - therefore there is a new branch [fix-fb2fa9b3f6--percent-subst-regr](/tcl/vdiff?from=7ed548b6b59bb496&to=fix-fb2fa9b3f6--percent-subst-regr), reverting parts of this fix, handling the percent char and so restore the backwards compatibility calling comspec with `%var%`. As already said many times the percent escape was implemented only because otherwise it'd remain a bit vulnerable (double and triple quotes may change during exec), but since comspec remains unsafe by design, one could indeed restore that handling back (using aforementioned branch). More or less with a future `-raw` option, one'd be able to implement own escape routines for any kind of executable, no matter how it does the command line parsing. This fix implements correct escape for `CommandLineToArgvW` as well as `main` of msvcrt, ucrt, libstdc (mingw/gcc) and co, so quasi "standard" command line parser. And without merge of `fix-fb2fa9b3f6--percent-subst-regr` branch also for comspec as good as possible (but as already said, I'm for merge and fix it later using `-shell` option or in some special handler if `-raw` option gets implemented).
- login: "sebres"
- mimetype: "text/x-markdown"