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
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.
Usually precedes
Affected components
- Server
- Sensitive Information
- Database