Junglewise Threat Intelligence

CVE-2017-5223: PHPMailer local file disclosure in msgHTML method

CVE-2017-5223 · Severity: medium · CVSS 5.5 · Published 2017-01-16

Technologies: PHPMailer project PHPMailer. Vendors: Packagist.

Executive brief

PHPMailer, a widely used library for sending emails from web applications, contains a security flaw that could allow an attacker to steal sensitive files from the server. By submitting a specially crafted email message containing specific image tags, an attacker can trick the system into attaching private server files (such as configuration files or password lists) to the email. This could lead to the exposure of confidential business data or system credentials.

Technical details

A local file disclosure vulnerability exists in PHPMailer's msgHTML method. The method automatically converts relative image URLs into email attachments. If a developer passes unfiltered user input to msgHTML without specifying a base directory, the library defaults to the root directory (/). An attacker can exploit this by submitting an HTML message containing an <img> tag with a 'src' attribute pointing to a sensitive local file (e.g., <img src='/etc/passwd'>). PHPMailer will then resolve this as an absolute path and attach the requested file to the outgoing email. This vulnerability is mitigated in version 5.2.22.

Affected products

  • PHPMailer project PHPMailer < 5.2.22

Timeline

  • 2017-01-09: patched: Version 5.2.22 released
  • 2017-01-16: disclosed: NVD publication date
  • 2017-10-25: other: Public exploit code released on Exploit-DB

References

Related threats