Securing File uploads with OWASP
in In-My-Mind with 0 comment

Securing File uploads with OWASP

in In-My-Mind with 0 comment

https://cheatsheetseries.owasp.org/cheatsheets/File_Upload_Cheat_Sheet.html

Extension Validation

  • List allowed extensions. Only allow safe and critical extensions for business functionality
  • Ensure that input validation is applied before validating the extensions.
  • Validate the file type, don't trust the Content-Type header as it can be spoofed

Filename Sanitization

  • Change the filename to something generated by the application
  • Set a filename length limit. Restrict the allowed characters if possible

Upload and Download Limits

  • Set a file size limit

File Storage Location

  • Store the files on a different server. If that's not possible, store them outside of the webroot
  • In the case of public access to the files, use a handler that gets mapped to filenames inside the application (someid -> file.ext)

Content-Type Validation

File Content Validation

  • Run the file through an antivirus or a sandbox if available to validate that it doesn't contain malicious data

Malware Scanning Architecture

3rd Party Power

Comments are closed.