by lexfiend · 6y ago · 0 comments
Wildcard expansions are done by shells, so no, exec() wouldn't trigger this "vulnerability".
Unless you're talking about a specific language's exec() that either does its own wildcard expansion, or actually runs its arguments in a shell.
exec(["tar", "cz", ...user_wanted_files])
The user sends you a GET /api/storage/download_tar?files=--checkpoint%3D1&files=--checkpoint-action%3Dexec%3Dsh+shell.sh which causes you to execute the contents of shell.sh. No shell, no glob necessary.To do it correctly, you would have to do:
exec(["tar", "cz", "--", ...user_wanted_files])
Or add ./ to the start of each filename.https://offensi.com/2020/08/18/how-to-contact-google-sre-dro...
>An attempt to modify the database name in the API call from ‘mysql’ into ‘--help’ results into something that surprised us...