Absolute Path Injection
What you'll learn: You'll discover how attackers use absolute file paths to bypass upload restrictions and write files to dangerous system locations.
The Core Concept
While Path Traversal (the previous concept) uses relative paths like ../../etc/passwd to navigate around the filesystem, Absolute Path Injection takes a more direct approach. Instead of climbing directories, attackers specify the complete path from the system root, such as /var/www/html/shell.php or C:\inetpub\wwwroot\backdoor.aspx.
When a web application accepts a filename during upload without proper validation, an attacker can inject an absolute path to write the file anywhere on the system they have permissions to access—completely bypassing any intended upload directory restrictions.
Why This Matters
Imagine an application that saves uploaded files like this:
save_path = user_provided_filename
If you provide profile.jpg, it saves to the upload folder. But if you provide /var/www/html/shell.php, the application might write directly to the web root—making your malicious file immediately accessible via the web browser.
This bypasses restrictions that only check for traversal sequences (../) but don't validate whether the path is absolute. The attack works when:
- The application uses the user-supplied filename directly in save operations
- The web server process has write permissions to critical directories
- No validation checks for absolute path indicators (
/on Unix,C:\on Windows)
Real-World Impact
Successful absolute path injection can allow attackers to:
- Plant web shells in publicly accessible directories
- Overwrite configuration files
- Replace legitimate application files with malicious versions
- Bypass all intended upload directory restrictions
Key Takeaway: Absolute path injection exploits applications that don't validate whether filenames contain complete filesystem paths, allowing attackers to write files anywhere on the system rather than just the intended upload location.