OSWA · Module 9
Directory Traversal and File Inclusion
Read arbitrary files via path traversal, escalate file inclusion (LFI/RFI) to RCE, and turn insecure file uploads into web shells.
~2.5 h 9 resources Last updated September 27, 2026
Directory traversal lets an attacker escape the intended directory and read arbitrary files on the server using sequences like ../. Closely related is file inclusion, where a parameter that loads a file can be pointed at attacker-controlled content (local or remote), often escalating from file read to remote code execution. File upload flaws round out the group: a poorly validated upload plus a way to reach the uploaded file is a direct path to a web shell. Together these are among the most reliable footholds on the OSWA exam.
Directory Traversal
Detection starts with parameters that look like they load files or paths, then testing relative and absolute traversal against OS-specific targets (/etc/passwd win.ini). When naive payloads are filtered, URL encoding, nested sequences, path prefix tricks, and null byte truncation bypass the filter. Reading configuration files and source often yields the credentials or logic needed for the next step.
File Inclusion (LFI/RFI)
Local file inclusion reads files through an include parameter and, via PHP filter and stream wrappers, discloses source or achieves RCE through log poisoning, session injection, or <code>/proc/self/environ</code>. Remote file inclusion loads an attacker-hosted payload directly. Detection covers PHP and non-PHP stacks (Java/Spring, Node/Express, Python/Flask, .NET), and fuzzing accelerates finding the right path.
File Upload
Upload testing establishes the baseline behavior, then bypasses validation: extension and double-extension tricks, content-type spoofing, magic-byte prefixes, null bytes, and polyglot files. Once a web shell lands, locating its path and confirming execution turns the upload into a reverse shell, including ASPX shells and .htaccess/web.config abuse on IIS.
Read
The core material for this module. Where a guide goes deeper than needed, the relevant sections are highlighted.
-
Guide 3 min readRemote File Inclusion Exploitation
Practice
Apply the module hands-on.
- File Path Traversal (Web Security Academy) PortSwigger Apprentice-Practitioner
- File Upload Vulnerabilities (Web Security Academy) PortSwigger Apprentice-Practitioner
- File Inclusion TryHackMe Easy
- FriendZone HackTheBox Easy
- Inclusion TryHackMe Easy
- Inclusiveness Proving Grounds Easy
- Networked HackTheBox Easy
- Pilgrimage HackTheBox Easy
- RootMe TryHackMe Easy
- Titanic HackTheBox Easy
- Upload Vulnerabilities TryHackMe Easy
- Magic HackTheBox Medium
- Poison HackTheBox Medium
- Popcorn HackTheBox Medium