← Lab /Security & privacy

Pre-auth WordPress RCE chain triggers detectable web-server shell and plugin file events

The wp2shell pre-authentication RCE chain can be reliably detected using Elastic Defend’s behavioral rules that monitor web-server file creation and command execution.

Security & privacy Elastic Security Labs 23 Jul 2026 Defense Real-world evidence

Published as “wp2shell hits WordPress: detecting pre-auth RCE from plugin drop to command execution”

Why it matters

Detecting the wp2shell chain via behavioral signals provides coverage that survives simple PoC obfuscation, helping defenders block exploitation before patches are applied.

Summary

The authors ran the public Icex0 wp2shell proof-of-concept end-to-end in a lab with Elastic Defend and mapped each step to detection rules. They show that PHP file creation in WordPress plugin directories and web-server processes spawning shells are reliably flagged. Across the lab run they observed 12 alerts and correlated 25 alerts into a single incident, demonstrating the rules work in practice. The write-up also provides IOCs, hunting queries, and mitigation guidance.

What they found 2

  1. PHP file creation in WordPress plugin directories is detected by a dedicated rule.

    “PHP File Creation in WordPress Plugin Directory fired several times in our primary run, on paths such as wp-content/plugins/wp2shell_79b06a80 and wp2shell_360866a8 .”

  2. Web-server processes spawning shells are caught by the Payload Execution by Web Server rule.

    “Payload Execution by Web Server is the Elastic Defend behavioral rule behind the two critical alerts in the overview. It matched when /usr/sbin/apache2 spawned /usr/bin/dash to run suspicious commands.”

Caveats 5

  • Treat them as fragile: rename the plugin slug or change the User-Agent and most of them disappear.
  • It is scoped to plugins/ only and will not catch the SANS-documented INTO OUTFILE variant under wp-content/cache/ , which is why the shell-spawn rules below matter as a second layer.
  • The plugin-name IOCs are fragile and can be renamed by attackers.
  • The PHP file creation rule only watches wp-content/plugins/ and misses variants that drop files in wp-content/cache/.
  • Detection relies on a known list of web-server parent processes; custom web-servers may evade the rules.

What’s new here 4

  • End-to-end lab execution of the wp2shell PoC with Elastic Defend, linking each stage to specific alerts.
  • New Elastic detection rules for PHP file creation in WordPress plugin paths and for web-server command execution.
  • Compiled network and host IOCs, plus hunting queries for the short-lived PoC artifacts.
  • Guidance on blocking the vulnerable REST batch endpoint when patches cannot be applied immediately.