Search code examples
securitypolicy

Whitelist or blacklist file extensions for uploads?


I'm making a newsletter editor which will allow file uploads (the sender of the newsletter can upload files to the server which will be linked to in the email).

The site is set up so that only .do URIs are actually executed/handled by servlets so it's not much of a security risk, but I've been told to blacklist .jsp, .php, .asp, .aspx, .exe, .com, and .bat. This does not strike me as a comprehensive blacklist, and I've the impression that blacklists are not a good policy.

On the other hand, a whitelist would be dozens long. What's the correct way to identify allowable/disallowable extensions? Or is it more proper to just allow anything and run it by a virus scanner, or some combination of these?


Solution

  • Or is it more proper to just allow anything and run it by a virus scanner.

    Yes.

    Both blacklists and whitelists are trivially circumvented and cause just administration pain and provide no security whatsoever.