一个简单的 Python3 脚本,用于利用 CVE-2017-9841。
简单脚本,利用 PHPUnit 4.8.28 之前版本和 5.6.3 之前 5.x 版本中存在的远程代码执行漏洞。向目标发送带有用户输入系统命令的 POST 请求。
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9841。
pip3 install requests bs4
在确认目标运行着 phpunit 后:
chmod +x phpunit-shell
./phpunit-shell -h
或
python3 phpunit-shell -h
-h 或 --help 选项会显示如何运行脚本,并附有几个示例。
有两个位置参数和几个可选参数。
usage: phpunit-shell.py [-h] [-a] [-n] address
phpunit-shell.py exploits an RCE vulnerability in
applications running PHPUnit before 4.8.28 and 5.x before 5.6.3.
positional arguments:
address ip/hostname, port, sub-directories to the vulnerable eval-stdin.php file.
optional arguments:
-h, --help show this help message and exit
-a, --accessible turns off features which may negatively affect screen readers
-n, --no-colour removes colour output
example:
phpunit-shell.py 10.10.10.10/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
默认情况下,phpunit-shell 以彩色打印并带一些额外格式到终端输出,但这对于使用屏幕阅读器的用户来说并不总是有帮助。使用 --accessible 参数将禁止在终端输出花哨的格式和颜色。它也会禁用 ASCII 艺术。
该脚本无法假设目标系统或运行漏洞应用程序的用户/服务的限制。也就是说,这不是一个完整的 shell,因此无法切换目录,较长的命令也可能无法执行。
它更像一个简单快速的半成品 shell 🐢,旨在作为进一步利用的入口——最终获得完整 shell、提权等等…… 👍
该脚本还对请求设置了 30 秒的超时,可以通过编辑脚本来更改或完全关闭。
默认使用 PHP 代码 'shell_exec',但如果用户希望,也可以更改,例如改用 'system'。
该脚本主要是为了练习创建一个简单的 Python 脚本来利用 CVE-2017-9841 并加速后续利用。
https://skerritt.blog/a11y/ - 无障碍实现。