Subscribe / Unsubscribe Enewsletters | Login | Register

Pencil Banner

Critical flaw in PHPMailer library puts millions of websites at risk

Lucian Constantin | Jan. 3, 2017
The vulnerability could allow attackers execute arbitrary shell commands on web servers

A critical remote code execution vulnerability in PHPMailer, one of the most widely used PHP email sending libraries, could put millions of websites at risk of hacking.

The flaw was found by a security researcher named Dawid Golunski and an initial fix was included in PHPMailer 5.2.18, which was released Saturday. However, it turns out that the patch was incomplete and can be bypassed.

The PHPMailer library is used directly or indirectly by many content management systems (CMSs) including WordPress, Joomla and Drupal. Where the library is not included in their core code, it is likely available as a separate module or can be bundled with third-party add-ons.

Because of this, the flaw's impact can vary from website to website. For example, the Joomla security team determined that the Joomla JMail class, which relies on PHPMailer, has additional validations in place that make exploiting the vulnerability impractical.

The flaw is caused by insufficient validation of the sender email address input and can allow an attacker to inject shell commands that would be executed on the web server in the context of the sendmail program.

However, successful exploitation requires the presence of a web form on the website that uses PHPMailer to send emails and allows inputting a custom sender email address -- the address that appears in the From email header. It's not clear how common such configurations are, because usually web forms have the sender email predefined and only allow users to input their own email address as a recipient.

"All places in the core Joomla API which send mail use the sender address set in the global configuration and does not allow for user input to be set elsewhere," the Joomla security team said in an advisory. "However, extensions which bundle a separate version of PHPMailer or do not use the Joomla API to send email may be vulnerable to this issue."

The WordPress developers reached a similar conclusion, noting on their own bug tracker that the internal wp_mail() function used by the WordPress core code is not affected because it does not use the vulnerable PHPMailer feature. Third-party plug-ins that use wp_mail() correctly should theoretically not be affected either, but the impact to specific plug-ins is still under investigation.

"The upcoming 4.7.1 release will contain mitigation for these issues," WordPress lead developer Dion Hulse said. "We're committed to only shipping secure libraries with WordPress -- regardless of whether we use the feature or not."

The Drupal security team also put out a security advisory for this issue and marked it as critical, even though the Drupal core code is not affected by the flaw.

 

1  2  Next Page 

Sign up for Computerworld eNewsletters.