OWASPASVS 5.0 requirement

ASVS-V5.2.2 When the application accepts a file, either on its own or within an archive such as a zip file, it checks if the file extension matches an…

L1 Published 2025 Official page ↗
Standard
OWASP ASVS 5.0
Chapter
V5 File Handling
Section
V5.2 File Upload and Content
Level
L1 (requirement applies from this verification level up)

Requirement

Verify that when the application accepts a file, either on its own or within an archive such as a zip file, it checks if the file extension matches an expected file extension and validates that the contents correspond to the type represented by the extension. This includes, but is not limited to, checking the initial 'magic bytes', performing image re-writing, and using specialized libraries for file content validation. For L1, this can focus just on files which are used to make specific business or security decisions. For L2 and up, this must apply to all files being accepted.