Vulnerability Fixation
Vulnerable File Upload Attack

What is File Upload vulnerability?

Many websites allow users to upload their profile photo, or sometimes also their resume and educational documents in case of Educational institutes or Universities, or address proofs, identity proofs, financial documents, etc. in case of banking websites. Such file upload fields should only accept .png, .jpg, .docx, .pdf files depending on what type of file is expected.

However, due to lack of security measures, sometimes the attacker is able to upload malicious files such as .js, .php, .exe, etc. and also double extensions such as filename.exe.pdf or filename.php.docx where the attacker fools the system by adding the expected extension to a malicious script and succeeds in uploading the file. If a user is able to upload any file type other than the required extensions, it is listed as a Vulnerable File Upload Vulnerability.

Why Test for This Vulnerability?

Because attackers can upload malicious files (e.g., .php, .exe, double extensions), gain backend/server access, steal or manipulate data, or crash the system if restrictions are weak.

What is the impact of this attack?

  • Unauthorized access to the server and local files
  • Remote code execution or reverse-shell access
  • Overwriting critical files and taking control of the server
  • DoS attacks by uploading large malicious files

How to secure your system?

  • Strict whitelist of allowed file extensions
  • Validate file type on both client-side & server-side
  • Restrict file size and file name length
  • Store uploads outside webroot
  • Scan uploaded files for malware
  • Proper error handling to avoid information leakage

Also Read :