See "Hacking with Environment Variables", which specifically exploits the antigravity module for arbitrary code execution - https://www.elttam.com/blog/env/#content
Previous HN comments: https://news.ycombinator.com/item?id=23828045
See "Hacking with Environment Variables", which specifically exploits the antigravity module for arbitrary code execution - https://www.elttam.com/blog/env/#content
Previous HN comments: https://news.ycombinator.com/item?id=23828045
You could set PATH to change which files are executed in certain scenarios. You could set SSLKEYLOGFILE which logs session keys to an arbitrary file, essentially nullifying TLS/SSL protections. On Linux you can just set PROMPT_COMMAND to whatever you want and it'll be executed any time a bash prompt is printed.
It's an interesting attack vector, but a vulnerability requires impact, and I'm not sure this has very much.
https://git.savannah.nongnu.org/cgit/man-db.git/commit/src/m...
Turns out it was breaking a users automated tests - https://unix.stackexchange.com/questions/405783/why-does-man...
Remember: you have control over only the environment variables, and you do not have the ability to alter the arguments. In order for this to represent arbitrary code execution, you need for the system to have an executable on it that, when executed with the argument "https://xkcd.com/353/", grants you arbitrary code execution.
So, you have full control over the environment variables, and that's it. How do you turn effectively
[binary] "https://xkcd.com/353/"
into arbitrary code execution, where [binary] is an executable already on the machine? $ docker run -e 'PYTHONWARNINGS=all:0:antigravity.x:0:0' -e 'BROWSER=perlthanks' -e 'PERL5OPT=-Mbase;print(`id`);exit;' python:2.7.18 python /dev/null
uid=0(root) gid=0(root) groups=0(root)
Invalid -W option ignored: unknown warning category: 'antigravity.x'
$ docker run -e 'PYTHONWARNINGS=all:0:antigravity.x:0:0' -e 'BROWSER=perlthanks' -e 'PERL5OPT=-Mbase;print(`id`);exit;' python:3.8.2 python /dev/null
uid=0(root) gid=0(root) groups=0(root)
Invalid -W option ignored: unknown warning category: 'antigravity.x'What cause would there be to import antigravity in a CGI service – or anything other than a terminal in which you could already execute arbitrary code?
I am struggling to understand, even with the proof of concept, how the situation could arise where an attacker could realistically exploit this, based largely on the uselessness of the antigravity module.
Add the not-too-far-fetched-seeming assumption that it’s fine to let the Internet define your environment variables, and it’s a plausible exploit.
This is why, as another commenter points out, defense in depth is so important.
There are multiple failings that don’t seem like a big deal taken in isolation:
- The PYTHONWARNINGS and whole Warning Filters system.
- The webbrowser module executing a given executable from an environment variable.
- The antigravity module running webbrowser.open() on import.
All of these sort of seem a bit like sacrificing good taste for convenience. But in combination, in a situation where you don’t control the environment variables, they do lead to arbitrary code execution.
In other words, it’s not all antigravity’s fault, but those side effects on import make this possible.
In this particular case, they happened to be in a situation where they couldn't easily figure out how to create new files but they could set environment variables. From a design perspective, as a reviewer, I would not believe that this makes it safe to have attacker-controlled environment variables, although I admit I wouldn't know exactly how (and this post is a pretty clever approach to making the attack work).