APPLICATION-SECURITY Contents

File Upload Hardening (Content Sniffing, AV, Storage)

File uploads are high risk. Covers content-type validation, storage isolation, and scanning.

On this page

Upload Risks

  • Executable files.
  • Polyglot files.
  • Large file DoS.

Hardening Checklist

  • Validate extension AND MIME.
  • Store outside web root.
  • Rename files on upload.
  • Virus scan before processing.
  • Limit file size.

Failure Modes

  • Trusting client Content-Type.