Chapter 0
The file journey model
Six stations where different components make trust assumptions.
Do not treat file upload flaws as a single vulnerability. An uploaded file moves through a long path inside the application architecture. At every station, a different software component makes an assumption about the file.
The six stations explained
Section titled “The six stations explained”Every attack in this guide targets one or more of these six stations.
Station 1: Validation gate
Section titled “Station 1: Validation gate”Before saving anything, the server inspects your file name, extension, Content-Type header, or leading magic bytes. Many teams rely on brittle regular expressions or short blocklists that miss double extensions, uppercase variants, or spoofed MIME types. When this gate leaks, dangerous files walk straight inside.
Station 2: Storage and naming
Section titled “Station 2: Storage and naming”Next, the app chooses where to write those bytes and what to call them. Safe systems generate a random UUID and push the file to an isolated object bucket like Amazon S3. Risky systems keep your original filename or drop the file into a webroot directory where the web server executes scripts directly.
Station 3: Serving layer
Section titled “Station 3: Serving layer”When another user opens that file, response headers and domain isolation decide what happens next. If the app serves an uploaded HTML or SVG file inline on the main origin without X-Content-Type-Options: nosniff, your file runs JavaScript inside the victim’s session.
Station 4: Parser execution
Section titled “Station 4: Parser execution”The parser station includes libraries that read and convert files. Examples include thumbnail generators, image metadata readers, and preview renderers. These libraries frequently run C or C++ code with legacy memory flaws. A valid image file can exploit a parser vulnerability during processing.
Station 5: Application interpretation
Section titled “Station 5: Application interpretation”The interpretation station processes file contents for business logic. Applications extract archives, parse XML spreadsheets, and import database records. This station introduces archive traversal, XML external entity injection, and deserialization.
Station 6: Dormancy and client execution
Section titled “Station 6: Dormancy and client execution”Some files cause harm long after upload completion. A malicious spreadsheet can wait in storage until an administrator exports a financial report. When the user opens the file in desktop software, embedded formulas or macros execute.
Where experienced researchers focus
Section titled “Where experienced researchers focus”Novice testers often spend all their time trying to bypass file extension checks at Station 1. Experienced researchers look closely at Stations 4, 5, and 6. Complex processing pipelines often operate without input validation because developers assume images are harmless.
Next, start at Station 1 and work through Chapter 1 on defeating the validation gate.
Hands-on lab drill
Section titled “Hands-on lab drill”Station 1 blocks .php and .html, so you upload badge.svg. The server accepts it and returns the response below when another user visits the file URL. Which station failed, and what is the impact?
HTTP/1.1 200 OK Host: app.target.com Content-Type: image/svg+xml Content-Disposition: inline; filename="badge.svg"<svg xmlns=“http://www.w3.org/2000/svg” onload=“alert(document.domain)”/>
image/svg+xml inline on the main application origin app.target.com. Browsers execute embedded scripts inside inline SVGs, giving you Stored XSS on the primary domain. See SVG attacks for payloads and bypasses.Content-Disposition: attachment, send X-Content-Type-Options: nosniff, or rasterize uploaded images server side.Related across the field guides
Section titled “Related across the field guides”- Find hidden upload endpoints with content discovery and JavaScript analysis.
- Check bug classes to see where file upload ranks against IDOR and access control.
- Use the upload checklist on every import or avatar feature you find.
Open local graph around this page
Linked from here
File UploadFor authorized testing only.