4 ms·
I believe it's because the exploit isn't actually exploiting sendmail, it's expoiting /bin/sh sh -c <cmd>. Php's implementation of popen() doesn't invoke comma
by tyingq 10y ago
I believe it's because the exploit isn't actually exploiting sendmail, it's expoiting /bin/sh sh -c <cmd>.
Php's implementation of popen() doesn't invoke commands directly with stdlib's execl() or execle()...it calls stdlib's popen(), which passes it through /bin/sh -c <cmd>.
That's assuming phpmailer doesn't treat a postfix sendmail wrapper differently than sendmail.
Edit: As far as I can tell, php doesn't allow any way to spawn a process without passing it to /bin/sh. That's odd, as other script languages like Perl and Python provide that. It avoids a whole class of exploits.
Edit2: It seems to be exploiting the "-f" option, not "-X". The postfix wrapper supports that.
- thaumaturgy 10y agoIt's exploiting -f to abuse -X to allow it to save a file with PHP tags to an externally-accessible location. Without -X or some similar capability, it's not exploitable. Well, it is, but not for the same amount of fun -- all you get to do is abuse whatever other arguments Postfix makes available to you. I don't see a whole lot that a non-root user calling Postfix's version of sendmail can do with this ... maybe get a mail server RBL'd.
- tyingq 10y agoAh, yes, you're right. Maybe the option to use an alternate alias database could be troublesome, but would require some other hole that allowed local file creation.