wp-content/uploads. On many default setups, it does.
The recent Contact Form 7 advisory makes a useful case study. According to the published advisory, CVE-2026-114432 affects versions 6.2 through 6.2.3 and carries a CVSS score of 9.8. It comes from improper file type validation combined with a cleanup failure, which lets unauthenticated visitors upload files such as PHP scripts that the server can then execute. The fix is version 6.2.4 or later. What follows is the usual post-mortem pattern for this class of incident, not a write-up of one specific site. The fix at the end applies to whichever plugin has the next flaw.
What the first signs usually look like
How the investigation usually runs
find wp-content/uploads -type f -name '*.php' from the site root lists every PHP file in there. A few may be harmless, such as an empty index.php some plugins add to stop directory listing. Read anything else before trusting it. Webshells (small scripts that accept commands over HTTP) are often short, obfuscated, or named to look like core files.
Next, match the file's modification timestamp against the web server access logs. If a suspicious PHP file was created at 14:22:10, search the access logs for POST requests around that window. You will usually find an unauthenticated hit to an AJAX or REST endpoint (such as wp-json or admin-ajax.php), followed seconds later by a GET request directly targeting the newly planted PHP file inside wp-content/uploads/.
That single direct GET request is all it takes to trigger execution. Once run, the shell reads database credentials from wp-config.php, drops secondary backdoors in root or wp-includes/, or injects spam redirects into .htaccess.
Updating the vulnerable plugin eliminates the entry vector, but web server-level hardening ensures that even if an arbitrary file lands on disk, the server refuses to run it.
How to block PHP execution in uploads
1. Apache and LiteSpeed (.htaccess)
.htaccess file directly inside the wp-content/uploads/ directory:
APACHE
# wp-content/uploads/.htaccess
<FilesMatch "(?i)\.(php|phtml|php3|php4|php5|php7|php8|phar|inc)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</FilesMatch>Note: For Apache, ensureAllowOverride LimitorAllowOverride Allis enabled in your virtual host configuration. If overrides are disabled globally, rules inside.htaccesswill be ignored silently.
2. Nginx
.htaccess files. You must enforce the block inside the virtual host server { ... } block, placed before your general PHP-FPM processing block (location ~ \.php$):
NGINX
# Block script execution inside uploads
location ~* ^/wp-content/uploads/.*\.php$ {
deny all;
return 403;
}NGINX
# Deny direct PHP execution across uploads and includes
location ~* ^/(?:wp-content/uploads|wp-includes)/.*\.php$ {
deny all;
return 403;
}BASH
nginx -t && systemctl reload nginxTesting the rule
- Create a dummy test file inside your uploads directory:
BASH
echo "<?php echo 'sec-check'; ?>" > wp-content/uploads/sec-test.php - Request the file locally using
curl:BASHcurl -I https://localhost/wp-content/uploads/sec-test.php - Verify the HTTP response code:
- Expected:
403 Forbidden(or404 Not Found). - Vulnerable:
200 OK(especially if executing or serving the raw script contents).
- Expected:
- Remove the test file immediately:
BASH
rm wp-content/uploads/sec-test.php
