Dangerous file uploads in WordPress: double extensions

Written by

in

People assume files enter WordPress through the media library. In reality dangerous uploads in WordPress often arrive some other way. Think of a plugin form, an admin-ajax endpoint, an upload inside the theme. These are routes that ordinary checks don’t look at.

Dangerous uploads in WordPress: two overlapping sheets, the front one with a blue circle containing a cross

What the plugin records about dangerous uploads in WordPress

Every file that enters the site is recorded, even if it doesn’t go through the media library, because dangerous uploads in WordPress rarely do. Executable extensions are flagged, including double extensions such as immagine.php.jpg. It also recognises .user.ini, which on PHP-FPM is worth the same as a .htaccess. It also recognises SVG files and names built with null bytes or trailing spaces to disguise the extension.

Record or reject

There is also an option to reject dangerous uploads in WordPress, off by default. Some plugins legitimately upload archives or unusual files. The advice is to start with monitoring only, watch the log for a few weeks and then decide.

Checking that the block really works

In the Test tab there is a check that the PHP execution block in uploads works on your site, instead of trusting only the saved setting. On some hosts the .htaccess rules are ignored: better to find out yourself than during an incident caused by dangerous uploads in WordPress. OWASP describes this class of risk as unrestricted file upload. It is a good read on why checking only the extension is not enough.

An example of dangerous uploads in WordPress

A job application form that accepts CVs and checks extensions badly is a classic route for dangerous uploads in WordPress. A bot uploads cv.php.pdf. The log shows it with the executable extension warning. With the PHP block in uploads switched on, the file cannot be executed even though it got in.

Frequently asked questions

What is a double extension in uploaded files?

A name like image.php.jpg, meant to look like an image but which in some configurations can be executed as PHP. The plugin flags it.

Does the plugin block dangerous uploads in WordPress?

It can reject them, but the option is off by default because some plugins upload unusual files legitimately. By default it records and flags them.

How do I check that the PHP block in uploads works?

With the test in the plugin’s Test tab, which tries the block on the live site.

Read more

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Cookie Notice by Real Cookie Banner