Learn how file upload validation fails, how attackers bypass protections, and what real exploits look like.
File upload is one of the highest-risk features in web applications. If not properly validated, attackers can upload:
Block only common dangerous extensions but miss others:
Validate extension incorrectly via regex or string matching:
Trusting Content-Type header (controlled by attacker):
Servers handle multiple extensions differently:
Create files valid in multiple formats:
Scenario 1: Avatar Upload RCE โ User uploads profile avatar expecting image validation. Attacker uploads PHP web shell. Visits avatar URL โ PHP executes โ shell commands run.
Scenario 2: Resume Upload Malware โ Job site accepts resume uploads. Attacker uploads .exe disguised as PDF. Job seekers download it โ malware installed.
Scenario 3: CSV Import Injection โ Admin imports user CSV. Attacker crafts CSV with formula like =cmd|'/c calc'!A1. Excel opens CSV โ formula executes โ RCE.
Equifax (2017): File upload RCE (Apache Struts) led to breach of 147M records
WordPress (2019): Multiple plugin file upload vulnerabilities allowed RCE
GitLab (2021): File upload vulnerability in GitLab CI could lead to RCE
Lab 00 - Blacklist Bypass: Exploit incomplete extension blacklist to upload executable code
Lab 10 - MIME Type Spoofing: Upload dangerous file while spoofing MIME type
Lab 20 - SVG Active Content: Upload SVG with embedded scripts; bypass image validation