Hi fellow Wordpress users :)

I wanted to ask is it safe to allow non-admin users access to WordPress media uploader.

Can they inject a virus while uploading media? How is WP system fighting against it?

1 Answer 1


WP is reasonably secure for default use cases. In typical workflow it will call wp_check_filetype_and_ext() to verify that file uploaded is of allowed type.

It can get considerably more questionable in regards to security if you customize it to work with non–default kinds of files and you might need to implement your own security checks.

Note that users with special unfiltered_upload capability will be able to upload absolutely anything at all, so be very careful if you are assigning it to any roles.

  • I was thinking more about what if someone embeds some malicious code into a file (each file is esetially made out of bits, and someone could modify those bits, or add new ones). What if that file gets uploaded on the server? What then? Is there a security measure against that?
    – idjuradj
    Oct 8, 2014 at 0:09
  • @Nicholas that is hardly specific to WordPress and might be better asked at security.stackexchange.com . In the very nutshell typically files follow certain spec to be written and read. You do not play JPEG photo like music, neither does it support trojaning your computer by looking at it. While there are vulnerabilities like that now and then, note that anyone and everyone online is dealing with uploads anyway. If you don't want that risk — then just don't, however.
    – Rarst
    Oct 8, 2014 at 8:14
  • Thanks for the answer. I believe it is in the context of WordPress, because I mostly wanted to see does WP have any special mechanisms to fight against this. Nevertheless, I consider your answers detailed enough, so I'm choosing your answer as the best one (regardless of it being the only one).
    – idjuradj
    Oct 8, 2014 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.