I'm trying out random older WordPress exploits on my local server, I'm currently in the process trying to get this one to work:


It doesn't read any headers, just seems to filter file extensions. I am able to upload {Filename}.php.jpg files as mentioned in the specified URL above. But what caught my curiosity was;

Plugin does not properly filter filetypes, which allows for the upload of filetypes in the following format: 
Vulnerable hosts will serve such files as a php file, allowing for malicious files to be uploaded and executed.

Opening the JPG just makes my browser throw an error, not seeing it as a valid image.

Which leads me to my question

Why would a server ever serve a JPG as PHP? (without editing .htaccess or php require())?


1 Answer 1


This behavior is not directly linked to this exploit, but by a weak web server configuration.

For instance:

  • Apache offers through mod_mime the possibility to serve files with multiple extension. This extension is designed to serve the same way files such as welcome.html.fr or welcome.fr.html (ie. french version of the welcome.html file). However it can be tricked to interpret myuploadedfile.php.jpg as a PHP script...
  • Nginx offers a virtual directory system allowing to have virtual sub-directories below a dynamic script. For instance, a URL like /agenda.php/2015/june/6 will execute the file agenda.php (SCRIPT_FILENAME) with /2015/june/6 as parameter (PATH_INFO). However you may trick him to execute your uploaded file (which does not even need to have include the .php extension) by using a URL such as /myuploadedfile.jpg/anything.php: it will be accepted as a PHP script due to the .php extension, then the URL will be divided into SCRIPT_FILENAME and PATH_INFO as described above, and finally the order will be given to the PHP interpretor to execute myuploadedfile.jpg content.
  • This cleared a lot up, you have my gratitude. Am I correct to assume that I would not be able to abuse these particular exploits on my server unless I configure my environment to do so? Eg. mod_mime (Assume my environment has default configurations with nothing but the latest WordPress and the upload plugin.)
    – Stella
    Jun 6, 2015 at 12:12
  • Yes, you are correct. Hopefully servers are usually installed with safe defaults :), most of such issue comes from old, historical configuration... Jun 6, 2015 at 12:42
  • In case anyone is interested, there's a follow up question to this answer there: security.stackexchange.com/questions/218081/…
    – Anders
    Sep 17, 2019 at 10:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .