Back to Skills

path-traversal-lfi

Path traversal and LFI playbook. Use when file paths, download endpoints, include operations, archive extraction, or wrapper behavior may expose filesystem control.

1,281stars175forksUpdated 7/5/2026

Security Assessment

High Risk(40/100)

Detected risks:

Persistence([SKILL.md] authorized_keys)
Secret Exposure([SKILL.md] secret=)
Sensitive File Access([SKILL.md] /etc/passwd, [SKILL.md] /etc/shadow, [SKILL.md] .ssh/)
Security Score40/100

About path-traversal-lfi

An expert attack playbook for path traversal and Local File Inclusion (LFI), used when file paths, download endpoints, include operations, archive extraction, or wrapper behavior may expose filesystem control. It draws a sharp line between path traversal, reading arbitrary files by escaping the intended directory with ../ sequences, and LFI, where in PHP user input reaches include() or require() and the target file is executed as code rather than merely read. That distinction drives which escalation paths are available.

It catalogs traversal sequence variants tuned to the server's filtering strategy: basic ../ chains, Linux and Windows paths, single and double URL encoding (%2e/%252e), overlong UTF-8 and fullwidth Unicode, mixed encodings, redundant sequences like ....// that survive a single strip, and legacy null-byte injection. A reference section lists high-value target files, including /etc/passwd, /etc/shadow, /proc/self/environ, SSH keys, .bash_history, cloud credentials, and web-app config files such as .env and wp-config.php on Linux, plus hosts, SAM, and web.config on Windows.

For PHP it details LFI-to-RCE techniques: log poisoning via a PHP payload in the User-Agent then including the access log, SSH auth-log poisoning, PHP session-file poisoning, and the expect://, php://input, and data:// wrappers. It also covers using php://filter with base64 or other converters (including chained filters) to exfiltrate source code, Remote File Inclusion when allow_url_include is on, historical path-truncation tricks, a list of parameter names to test (file, page, include, path, and many more), and a filter-bypass checklist. For WAF-blocked Java backends it routes to a Ghost Bits skill, and for upload-centric surfaces to an upload skill. Use it during web application penetration testing whenever a parameter appears to influence which file the server opens, includes, or serves.

FAQ

What is the difference between path traversal and LFI?

Path traversal reads arbitrary files by escaping the intended directory with ../ sequences. LFI is when user input controls a PHP include() or require(), so the file is executed as PHP code rather than only read.

What encodings can bypass a filter that blocks ../?

URL encoding (%2e%2e%2f), double URL encoding (%252e...), overlong UTF-8 (..%c0%af) and fullwidth Unicode (..%ef%bc%8f), mixed encodings, and redundant sequences like ....// or ..././ that become ../ after a single strip.

How can LFI be escalated to remote code execution?

Through log poisoning (inject PHP via User-Agent, then include the Apache/Nginx access log), SSH auth-log poisoning, PHP session-file poisoning, and the expect://, php://input, and data:// wrappers.

How do I read PHP source instead of getting a blank executed page?

Use the php://filter wrapper with convert.base64-encode, for example ?page=php://filter/convert.base64-encode/resource=config.php, and decode the returned base64; filters can also be chained.

What should I do when a Java backend blocks the standard traversal chains?

The skill routes to a Ghost Bits cast-attack skill, which substitutes the dot and slash characters with U+962E and U+962F to re-enable traversal against WAF-blocked Java stacks like Spring and Jetty.

Install path-traversal-lfi

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill