File Upload Vulnerabilities Testing Guide
Comprehensive guide to testing file upload functionality for web shell uploads, extension bypasses, content-type manipulation, and path traversal.
Identify upload functionality
Find all file upload endpoints: profile picture uploads, document submission forms, import features, and API endpoints accepting file uploads. Note the allowed file types and size limits shown in the UI.
test.jpg (legitimate upload)
test.txt (test accepted types)
Test extension restrictions
Try uploading executable file extensions. If blocked, test bypass techniques: double extensions, null bytes, case variations, and alternative executable extensions.
shell.php
shell.php.jpg
shell.pHp
shell.php%00.jpg
shell.phtml
shell.php5
shell.shtml
Manipulate Content-Type
Intercept the upload request and change the Content-Type header. Some applications validate only the MIME type, not the actual file content or extension.
Content-Type: image/jpeg (with PHP content)
Content-Type: image/png (with JSP content)
Content-Type: application/octet-stream
Verify server-side file validation
For a PNG upload, use a small valid image and a copy cut short before the first pixel data. Both have the same PNG signature. The valid image should decode and the server should reject the incomplete copy before publication. Record both outcomes. This checks whether the image is readable. File size limits, storage permissions and download authorization need separate checks.
Test path traversal in filename
Attempt to control where the file is stored by including directory traversal sequences in the filename. This can overwrite critical files or place the shell in a web-accessible directory.
../../../var/www/html/shell.php
..\..\..\inetpub\wwwroot\shell.aspx
file.php%2f..%2f..%2fshell.php
Locate and access the uploaded file
Find the URL where uploaded files are served. Check the response for file paths, try common upload directories, and test if the file executes as code when accessed directly.
/uploads/shell.php?cmd=id
/media/shell.php
/static/uploads/shell.phtml
Related Resources
Level up your security testing
Install the CLI
npx payload-playgroundExplore All Tools
Encoding, hashing, JWT & more
Browse Cheat Sheets
Quick-reference payload guides