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 Vulnerability

By cybersamir
March 1, 2025 4 Min Read
Comments Off on Path Traversal Vulnerability

A path traversal vulnerability, also known as a directory traversal vulnerability, is a security flaw that allows attackers to access files and directories they should not be able to reach. These vulnerabilities typically occur in web applications but can affect any software that handles file paths. Since 2014, path traversal vulnerabilities have accounted for roughly 5% of all new CVEs every year and comprise approximately 5% of CISA’s known exploited vulnerabilities catalog. CISA and the FBI published a Secure by Design Alert about them in May 2024, due to how widely abused they are by criminals.

How Path Traversal Works

Path traversal vulnerabilities exploit the fact that a file on a website has two addresses: a private location on a computer file system and a public URL used to access the file via HTTP. When a user requests a file using the public URL, the web server software maps the public address to the private file system location and retrieves the file.

For example, a website might offer a file called report.pdf with a public URL like https://www.example.com/?file=report.pdf, which maps to the file report.pdf in the directory /var/www/html on a server file system. On a secure website, the web server enforces rules restricting the files and directories a website user can access. However, a path traversal vulnerability allows an attacker to manipulate a public HTTP address to access parts of the private file system they should not be able to reach, typically by using “relative paths” with symbols like ../ which means “go up one level from here”.

An attacker might replace report.pdf in the example URL with a relative path, such as ../../../../etc/passwd:
https://www.example.com/?file=../../../../etc/passwd.
The URL might be URL encoded:
https://www.example.com/?file=%2E%2E%2F%2E%2E%2F%2E%2E%2F%2E%2E%2Fetc/passwd.
Both of these URLs map to /var/www/html/../../../etc/passwd on the file system, which is interpreted as /etc/passwd, the Unix password file.

Path Traversal Attack Examples

Path traversal attacks are usually HTTP attacks and can come through any HTTP method like GET, POST, or PUT.

Here’s an example of a path traversal attack using a relative file path to download a file via a URL parameter on a vulnerable server:

  • A vulnerable site’s dynamic URL is: https://vulnerablewebsite.com/show.asp?view=homepage.html
  • When a user accesses the URL through a web browser, the server receives a request for the show.asp page, along with the parameter: view=homepage.html.
  • If the user provides the file name ‘document.pdf’ in their supplied URL, the website downloads the PDF to the user’s computer. The URL in question would be: https://www.vulnerablewebsite.com/download_file.php?file=document.pdf.
  • If the web server is hosted on a Linux system, the web server’s files would typically be located in /var/www – two directories above the root directory. The attacker can attempt to break out of the webroot directory and access the /etc/passwd file by submitting the following URL to the server: https://www.vulnerablewebsite.com/download_file.php?file=../../etc/passwd.

Because the application does not sanitize inputs, it uses the attacker’s string directly in a system call, changes the current directory to the root folder, and allows the attacker to access the /etc/ directory to access the sensitive passwd file. Note that the same attack can be perpetrated on a Windows server using .. instead of ../.

Here’s an example of an absolute file path attack:

  • Suppose the following URL is vulnerable to path traversal attacks: http://vulnerablewebsite.com/get.asp?f=test
  • It would be vulnerable because it allows file access using the HTTP parameter: f (?f=).
  • An attacker could use the following URL to access the passwd file: http://www.vulnerablewebsite.com/?template=../../../../etc/passwd
  • The web server would then perform the following system call, loading the passwd file instead of the design template: include(“../templates/../../etc/passwd”);
  • The ../ operator points to the current folder’s parent folder on Unix systems. By combining multiple ../ operators in the file path, an attacker could navigate out of the server’s webroot directory (/var/www/) and gain access to the /etc directory, which is not meant to be accessible over the internet.

Potential Consequences

Path traversal vulnerabilities can be used to access confidential data, such as credentials, and in some cases, they can even be used to run arbitrary code, potentially leading to a complete takeover of the target.
An attacker might be able to upload or create files to/ on the server, modify application or behavior data, and ultimately take control of the server.

How to Prevent Path Traversal Vulnerabilities

To prevent path traversal attacks, it is crucial to sanitize user inputs and validate file paths. Here are some techniques to prevent path traversal attacks:

  • Input Validation: Ensure that user-supplied file paths are validated to prevent malicious manipulation.
  • Relative Path Checking: Implement checks to prevent the use of relative paths in user input.
  • File Extension Validation: Validate file extensions to ensure that only authorized files can be accessed.
  • Principle of Least Privilege: Apply the principle of least privilege to limit access to only necessary files and directories.
  • Web Server Configuration: Properly configure the web server to restrict access to sensitive files and directories.
Author

cybersamir

Follow Me
Other Articles
Previous

The Dark Side of Telegram: Hidden Risks You Need to Know

Next

Top Cyberattacks in India

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
  • PHP Vulnerability And Global Cybersecurity - The Rising Nepal
  • Nepal's digital vulnerability goes beyond PHP - myRepublica
  • SEBON introduces IT policy to strengthen cybersecurity in Nepal’s capital market - OnlineKhabar English News
  • SEBON steps up effort to prevent cyber attacks in stock exchange platform - myRepublica
  • From heartbleed to PHP2Shell: Is Nepal ready for the next cyber crisis? - The Annapurna Express

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