This is a composite scenario based on common upload security reviews. It does not describe a specific company, and it contains no measured results. Only test systems you own or are authorized to test.
The Scenario
A security tester is reviewing the file upload endpoint of a cloud storage product before a release. Users can upload images and documents, which are stored, previewed in the browser and shared by link. The review has to answer five questions:
- Does the server check the content of a file, or only its name and declared type?
- Are size limits enforced on the server, not only in the browser?
- Are file names sanitized before they are stored or displayed?
- Is metadata handled safely, and stripped where it should be?
- Do error messages avoid revealing internal details?
FileMock provides the clean, valid starting files: images, documents and archives of a known format and size. The tester then derives the risky variants from them. FileMock does not generate malicious files, and none are needed for these checks.
Step 1: Generate Clean Baseline Files
From the Image and Document tabs:
baseline.jpg,baseline.png(1 MB each)baseline.pdf,baseline.docx,baseline.xlsx(1 MB each)baseline.html(100 KB), to check how active formats are handled
First confirm that each accepted baseline file uploads, previews and downloads correctly. Every later test is a variation of one of these files, so a failure points to the single change you made.
Step 2: Extension and Content Mismatch
The most common upload weakness is trusting the file name or the Content-Type header. Derive mismatched files:
# Real PNG content with a .pdf name
cp baseline.png mismatch.pdf
# HTML content with an image extension
cp baseline.html page.jpg
# Double extension
cp baseline.pdf report.pdf.html
Upload each one, and also send them with a manually changed Content-Type header (for example with an intercepting proxy, or curl -F "file=@mismatch.pdf;type=application/pdf").
What a pass looks like:
- The server identifies the real type from the file's content and rejects or re-labels the mismatch.
- Files are served back with the detected content type, plus
Content-Disposition: attachmentandX-Content-Type-Options: nosniff, sopage.jpgcan never render as HTML in the browser. - HTML uploads, if allowed at all, are served from a separate domain or only as downloads.
Step 3: Size Limits on the Server
Browser-side size checks are a convenience, not a control. Generate files on both sides of the limit (for a 50 MB limit: 49.9 MB and 50.1 MB), then send them directly to the endpoint, bypassing the UI:
curl -s -o /dev/null -w "%{http_code}\n" \
-F "file=@baseline-50.1mb.pdf" https://staging.example.com/api/upload
What a pass looks like:
- A clear 413 or 400 response for the oversized file.
- The request is cut off early, not read completely into memory first.
- Uploads well beyond the limit (for example 500 MB or 2 GB, both within FileMock's range) don't slow down other users. Coordinate this with the team that runs the environment.
Step 4: File Name Handling
File names are user input. Upload a clean baseline file under names such as:
../../baseline.pdf<b>baseline</b>.pdf- a 255-character name
- names with Unicode, spaces and right-to-left characters
Most of these can be set with curl -F "file=@baseline.pdf;filename=../../baseline.pdf".
What a pass looks like: the server stores files under generated identifiers, never under the raw name, and escapes the original name wherever it is shown.
Step 5: Metadata
Photos carry EXIF metadata such as camera model, date, author and copyright. Using the EXIF options in the Image tab, generate JPG files with camera make, model, artist and copyright filled in, and with different orientation values.
What a pass looks like:
- If the product promises privacy, metadata is removed from shared and public copies (check with
exiftool shared-copy.jpg). - Metadata text displayed anywhere in the UI is escaped.
- Orientation is applied correctly in previews.
Step 6: Archives and Malware Scanning
If ZIP uploads are allowed, check how they are processed: is the archive extracted on the server, and are there limits on extracted size and file count? Create a small archive with your operating system's compress tool to confirm the normal path, and review the extraction code and its limits directly.
If the product scans uploads for malware, verify the scanner is actually in the request path using the industry-standard EICAR test file, a harmless file that antivirus engines detect on purpose. Get it from the EICAR organization's website.
Step 7: Error Messages
Collect every error response from the steps above and check that none of them contain stack traces, file system paths, bucket names or library versions.
Reporting Template
| Check | File used | Expected | Result |
|---|---|---|---|
| Content vs extension | mismatch.pdf | Rejected or re-labelled | |
| HTML served safely | page.jpg | Never rendered as HTML | |
| Server-side size limit | baseline-50.1mb.pdf | 413/400, request cut off early | |
| Path traversal in name | ../../baseline.pdf | Stored under generated ID | |
| Name escaping | <b>baseline</b>.pdf | Displayed as text | |
| EXIF stripped when shared | exif-full.jpg | No personal metadata | |
| Malware scanning active | EICAR test file | Blocked | |
| Error message hygiene | all of the above | No internal details |
For validation code examples, see Security Testing: Validating File Types and Content.
Takeaways
- Start from clean, valid files so each test changes exactly one thing.
- Test the endpoint directly; the upload UI is not a security boundary.
- Content checks, safe response headers and generated storage names prevent most upload issues.
- Use the EICAR test file to check malware scanning. Never use real malware.
Generate the clean baseline files for this review with the FileMock generator. Files are created locally in your browser.
