File Size Restriction Bypass via MAX_FILE_SIZE Parameter Manipulation
The application enforced a file size limit using a client-supplied MAX_FILE_SIZE parameter instead of checking the actual uploaded file size on the server. An attacker could modify this parameter to upload files larger than intended, potentially consuming storage and causing performance degradation or denial of service.
I’m back with another interesting vulnerability that I discovered during a recent VAPT assessment. Today, I’ll be sharing a simple but impactful file upload vulnerability that many developers often overlook.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application relied on a client-controlled parameter (MAX_FILE_SIZE) to enforce a security restriction instead of validating the actual file size on the server.
Impact
An attacker could bypass file size restrictions to upload excessively large files, potentially consuming server storage and causing performance degradation or denial-of-service conditions.
What the attacker needed
Access to the file upload feature; ability to intercept and modify HTTP requests
The fix
The application should perform file size validation entirely on the server side, verifying the actual file size after receiving the upload and rejecting files that exceed the configured limit regardless of request values.
How it was found
- Navigate to the file upload functionality.
- Attempt to upload a file larger than the permitted size and observe rejection.
- Upload a smaller valid file and intercept the request.
- Locate the MAX_FILE_SIZE parameter and change its value to a larger size.
- Replace the original file with a larger file and forward the request.
- Observe that the upload succeeds.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you upload a file, your browser sends extra information along with it, including a value called MAX_FILE_SIZE that is supposed to tell the server how big the file is allowed to be. In this case, the server believed whatever number the browser sent, so someone could change that number to a huge value and upload a much larger file than allowed. The fix is for the server to check the real size of the file it receives, not trust the number sent by the user.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.