first commit
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled

This commit is contained in:
2025-09-06 16:08:15 +08:00
commit 63285f61aa
2624 changed files with 88491 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
# PHPUnit Remote Code Execution (CVE-2017-9841)
[中文版本(Chinese version)](README.zh-cn.md)
PHPUnit is a programmer-oriented testing framework for PHP.
`Util/PHP/eval-stdin.php` in PHPUnit before 4.8.28 and 5.x before 5.6.3 allows remote attackers to execute arbitrary PHP code via HTTP POST data beginning with a `<?php` substring, as demonstrated by an attack on a site with an exposed /vendor folder, i.e., external access to the `/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php` URI.
The `Util/PHP/eval-stdin.php`'s vulnerable code:
```php
eval('?>'.file_get_contents('php://input'));
```
Reference links:
- http://web.archive.org/web/20170701212357/http://phpunit.vulnbusters.com/
- https://www.ovh.com/blog/cve-2017-9841-what-is-it-and-how-do-we-protect-our-customers/
## Vulnerable environment
Execute following command to start a Apache web server, which contains the PHPUnit 5.6.2 in the Web directory.
```
docker compose up -d
```
Open the `http://your-ip:8080` to see the index page util Web server is running.
## Exploit
Send the request to `http://your-ip:8080/vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php`, which contains any PHP code within the body:
![](1.png)