Unrestricted File Upload

Unrestricted File Upload

Knowledge Base>Unrestricted File Upload

Summary

Unrestricted File Upload refers to an issue in the system's file upload mechanism, which is not performing enough restrictions of the type of files that users can upload.

Testing methodology

Check RestrictionUpload Different File TypesCheck File Reflectionvia Social Interactionvia HTML DeliveryCheck if Path is ReturnedContent-TypeExtension ManipulationMagic ByteCheck if Path is ReturnedUpload Web ShellFile that Parses URLXML With External EntityMalicious FormulaXSS via Social InteractionCheck File Reflection
Upload Functionality
Restricted
Unrestricted
File Reflected as Blob
File Stored
Bypassed Restriction
RCE
SSRF
XXE
Formula Injection
Malware Distribution
XSS

Description

Unrestricted File Upload describes a situation in which the application's file system mechanisms are not validating what the users are trying to upload, e.g. enforcing an Allow-List of allowed file extensions and MIME types, File size restrictions and malicious content validation.

An attacker might use this situation to upload malicious files to the server, waiting for them to be executed by the system maintainers / the system itself / other users of the system or upload multiple files to the server causing a Denial of Service.

Remediations

  • Implement file type and content validation to ensure only safe files can be uploaded.
  • Sanitize the uploaded file names to prevent malicious file names from being used.
  • Store uploaded files in a secure location outside of the web root to prevent direct access.
  • Limit the file size and number of files that can be uploaded per user or session.
  • Implement a security solution to scan uploaded files for known threats, before allowing them to be uploaded to the system.

By using this site you agree to our Terms of Service and Privacy Policy.