File Upload Attacks
Identify Web Framework
# Check for index page extensions
http://TARGET/index.php
http://TARGET/index.asp
http://TARGET/index.aspx
http://TARGET/index.jsp
# Use Wappalyzer browser extension
# Or fingerprint with curl
curl -I http://TARGET/Web Shells
PHP
<?php system($_REQUEST['cmd']); ?># Usage
http://TARGET/uploads/shell.php?cmd=idASP
JSP
Location of Pre-made Shells
Reverse Shells
PHP (pentestmonkey)
Rails Active Storage
Rails Active Storage upload links often appear under /rails/active_storage/blobs/.../filename.ext. If the app renders an uploaded profile image or attachment, view the page source and follow the blob URL.
If code files are accepted but downloaded instead of executed, treat the upload as a read/storage primitive rather than immediate RCE. Still test whether the uploaded file is rendered in an unsafe context, whether metadata is processed, and whether the blob URL leaks in debug pages or user profile HTML.
Generate with msfvenom
Bypass Client-Side Validation
Burp Intercept Method
Upload valid image, capture request in Burp
Change
filename="image.jpg"tofilename="shell.php"Replace file content with web shell
Forward request
Disable JavaScript
Open DevTools (F12)
Find validation function in source
Delete
onchange="checkFile(this)"from input elementUpload shell directly
Bypass Extension Blacklist
Fuzz for Allowed Extensions
Burp Intruder Fuzzing
Capture upload request
Send to Intruder
Mark extension as payload position
Load PHP extension wordlist
Check response length for successful uploads
Bypass Extension Whitelist
Double Extension
Reverse Double Extension
If Apache config has: <FilesMatch ".+\.ph(ar|p|tml)">
Character Injection
Generate Character Injection Wordlist (Bash)
Generate Bypass Wordlist (Python)
file_upload_wordlist_generator.py
Bypass Content-Type Filter
Change Content-Type Header
In Burp, change Content-Type: application/x-php to Content-Type: image/jpeg
Bypass MIME-Type (Magic Bytes)
Add Magic Bytes to Shell
Common Magic Bytes
GIF
47 49 46 38
GIF8
PNG
89 50 4E 47
.PNG
JPEG
FF D8 FF E0
N/A
25 50 44 46
%PDF
ZIP
50 4B 03 04
PK..
SVG Attacks
XSS via SVG
XXE via SVG (Read /etc/passwd)
XXE via SVG (Read Source Code)
XSS via Image Metadata
Filename Injection
Command Injection
XSS
SQLi
Windows-Specific Attacks
Reserved Characters
Reserved Names
8.3 Filename Convention
Discover Upload Directory
Fuzzing
ODT Resume Uploads
If a site accepts only .odt resumes and says the upload will be reviewed, check whether the target opens the document with LibreOffice.
Force an upload handler error to identify the backend, web root, and allowed file type:
Generate a malicious ODT macro document with MMG-LO:
Upload the generated .odt. A successful reviewed-document shell may land inside LibreOffice:
Force Errors
Upload file with duplicate name
Upload file with very long name (5000+ chars)
Send two identical requests simultaneously
Upload Directory Traversal
Overwrite Files
Useful Wordlists
Last updated