Overview
| Artifact ID: | cc35e8ac4d9f98e68d5de1a60efb75f917bae874a5b163959715a1c39597f3e2 |
|---|---|
| Ticket: | 21b0629c81fbe38ad153cd8fd899626200a66e15
0-day vulnerability - insufficient escape by exec of batch-files for windows |
| User & Date: | sebres on 2018-08-30 18:26:26 |
Changes
- closer changed to: "nobody"
- icomment:
So although now it is anyway better as it previously was, the story continues - the handling round about percent character is a bit complex: <code><pre style="padding-left:10pt"> % set ::env(X) "simple-X"; set ::env("X") "quoted-X" % exec test-dump.cmd {%X%} {%"X"%} {"%X%"} `test-dump.exe´ `quoted-X´ `%"X"%´ `"quoted-X"´ </pre></code> So the escaped sequence <code>"%"X"%"</code> causes that this time not variable <code>X</code> but variable <code>"X"</code> will be interpolated by the command processor. <sub>Thanks to Eryk Sun (@eryksun) noticed this by the fix for python.</sub> So there are three possible scenarios:<ol> <li>either let it as is currently, so don't change something (the environment variable in quotes is very rare, but anyway it is a bit ugly as "good" solution); </li><li>or try to find better escape handling (I assume possible only if it will be escaped differently for invocation of exe and cmd). </li><li>if the "proper" escape of %-char will get state as really impossible or very complex (so can be defined as not a bug but "expected" feature), so let it be, but at least it belongs definitely into the documentation with some bold warning. </li></ol> So I'm by 2 at the moment, WiP. - login: "sebres"
- mimetype: "text/x-fossil-wiki"
- status changed to: "Open"