PHPMailer RCE
legalhackers.com
legalhackers.com
Sigh
It seems a bit... odd... to try and embargo/withhold information about a vulnerability when the fix is publicly available on their github for anybody to see.
1. https://github.com/PHPMailer/PHPMailer/commit/4835657cd639fb...
1) PHPMailer can be configured to send mail through raw SMTP, by directly invoking sendmail, or by calling PHP's mail() function. The changes in this commit only affect the last mode.
2) The "From" address is typically chosen by the site operator/server administrator, not customizable by a site visitor. I have built sites with "share this page with a friend" functionality that sent email from one given email address to another, but this practice seems to have fallen out of favour when SPF became popular.
More details here: https://www.saotn.org/exploit-phps-mail-get-remote-code-exec...
PHP mail doc: http://php.net/manual/en/function.mail.php
A function that allows to pass arbitrary flags to a command line, what could go wrong... :)
mail('nobody@example.com', 'the subject', 'the message', null, '-fwebmaster@example.com');A script for finding vulnerable versions of PHPMailer on a server:
https://gist.github.com/cebe/d0f5631b432c520a2e6f6be8beddf11...
Finds also really old versions like 2.0.4.
find /var/www -name 'class.phpmailer.php' -print -exec grep -ni '%s["'\''], $this->Sender' {} \;[1]: https://github.com/PHPMailer/PHPMailer/blame/4835657cd639fbd...
From my reading of the code, "only implementations using mail() (ie. not sendmail or SMTP) are affected".