RCE is rarely a vulnerability family on its own: it is the most serious outcome that several kinds of mistakes can lead to. Once an attacker gets PHP to run their code, they act with the site's privileges: they read wp-config.php and therefore the database credentials, create accounts, plant a backdoor or use the server to send spam. That is why unauthenticated RCE vulnerabilities almost always receive the highest severity scores.
The paths that lead to RCE
- Code injection (CWE-94): the program builds code from external data, for example with
eval(). According to OWASP, the attacker is then limited only by what the language can do. - Command injection: data is passed to a system shell through
exec(),system()or an equivalent. The attacker hijacks existing commands rather than writing PHP. - File upload: a form accepts a
.phpfile and stores it in a folder reachable from the web. - File inclusion and deserialization: two mechanisms covered in the definitions of file inclusion and insecure deserialization.
- Flaws in the language or the server: PHP itself, or a system library it uses.

Real-world examples
- WP File Manager, CVE-2020-25213: before version 6.9, the plugin renamed an example file from the elFinder library with a
.phpextension, which allowed remote attackers to upload and run PHP code. CVSS 3.1 score: 10. - PHP-CGI on Windows, CVE-2024-4577: an argument injection caused by Windows character conversion, in PHP before 8.1.29, 8.2.20 and 8.3.8 running in CGI mode. Our explanation of this PHP-CGI flaw specifies which servers were affected.
- glibc iconv, CVE-2024-2961: a flaw in a system library, made exploitable through PHP, covered in our article on the iconv vulnerability.
For WordPress: reducing the risk and the impact
- Update plugins that handle files quickly (file managers, forms with attachments, import and export, backups).
- Block PHP execution in
wp-content/uploadsat the web server level: that folder should only contain media. - Add
define( 'DISALLOW_FILE_EDIT', true );towp-config.phpto disable the admin file editor. - Run a supported PHP version and ask your host how they handle
disable_functionsandopen_basedir: hardening PHP limits what injected code can do. - A web application firewall blocks some known attempts, without replacing the update.
WP Feint doesn't block RCE exploitation: it is neither a firewall nor an antivirus. After an intrusion, however, its integrity check flags modified, missing or unknown WordPress core files, one of the places where attackers hide their code. Plugin and theme files need to be checked by other means.