Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2017-7529 PoC — F5 Nginx 输入验证错误漏洞

Source
Associated Vulnerability
Title:F5 Nginx 输入验证错误漏洞 (CVE-2017-7529)
Description:Nginx versions since 0.5.6 up to and including 1.13.2 are vulnerable to integer overflow vulnerability in nginx range filter module resulting into leak of potentially sensitive information triggered by specially crafted request.
Readme
# Nginx越界读取缓存漏洞(CVE-2017-7529)

## 漏洞原理

参考阅读:

 - https://cert.360.cn/detailnews.html?id=b879782fbad4a7f773b6c18490d67ac7
 - http://galaxylab.org/cve-2017-7529-nginx%E6%95%B4%E6%95%B0%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E%E5%88%86%E6%9E%90/

Nginx在反向代理站点的时候,通常会将一些文件进行缓存,特别是静态文件。缓存的部分存储在文件中,每个缓存文件包括“文件头”+“HTTP返回包头”+“HTTP返回包体”。如果二次请求命中了该缓存文件,则Nginx会直接将该文件中的“HTTP返回包体”返回给用户。

如果我的请求中包含Range头,Nginx将会根据我指定的start和end位置,返回指定长度的内容。而如果我构造了两个负的位置,如(-600, -9223372036854774591),将可能读取到负位置的数据。如果这次请求又命中了缓存文件,则可能就可以读取到缓存文件中位于“HTTP返回包体”前的“文件头”、“HTTP返回包头”等内容。

## 复现漏洞

运行测试环境:

```
docker-compose up -d
```

访问`http://your-ip:8080/`,即可查看到Nginx默认页面,这个页面实际上是反向代理的8081端口的内容。

调用`python3 poc.py http://your-ip:8080/`,读取返回结果:

![](01.png)

可见,越界读取到了位于“HTTP返回包体”前的“文件头”、“HTTP返回包头”等内容。

如果读取有误,请调整poc.py中的偏移地址(605)。
File Snapshot

[4.0K] /data/pocs/d17b68a55ddd3bb08debaa2754c049c1b54f5625 ├── [ 47K] 01.png ├── [ 579] default.conf ├── [ 152] docker-compose.yml ├── [ 73] Dockerfile ├── [ 575] poc.py └── [1.5K] README.md 0 directories, 6 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →