How Click2Shell Exploits WordPress Theme Installation for RCE
Detection stack
- AIDR
- Alert
- ETL
- Query
Summary
Click2Shell is a remote code execution (RCE) attack chain that targets WordPress environments. The technique abuses a jQuery selector injection issue in WordPress Core to trick an administrator into installing a malicious theme. After installation, the attacker leverages a vulnerable plugin installer bundled with the theme to execute arbitrary PHP code on the underlying server.
Investigation
The report outlines a multi-stage exploitation chain that begins with a specially crafted theme preview link. It explains how a manipulated theme parameter abuses jQuery selector injection to bypass the intended installation workflow. The investigation also identifies the “Mobile Repair Zone” theme and its vulnerable AJAX endpoint as the final step that enables arbitrary code execution.
Mitigation
Organizations should train WordPress administrators to recognize suspicious links and avoid opening unexpected theme preview URLs. Deploying Web Application Firewalls (WAF) capable of identifying jQuery selector injection patterns and limiting access to administrative interfaces can further reduce exposure. Keeping WordPress Core, installed themes, and plugins fully updated is also essential to prevent follow-on exploitation.
Response
If suspicious requests targeting wp-admin/theme-install.php or admin-ajax.php contain unusual characters or parameters, isolate the affected WordPress instance for investigation. Review administrator session and access logs to determine the source of the initial interaction. Conduct a complete file integrity assessment to identify and remove unauthorized PHP files, malicious themes, or unexpected plugin packages.
Attack Flow
We are still updating this part.
Detections
Possible Click2shell (WordPress Forced Theme Installation) Exploitation Attempt (via webserver)
Detection of Click2Shell WordPress Theme Installation Exploit [Webserver]
Simulation Execution
-
Attack Narrative & Commands: An attacker identifies a WordPress installation and seeks to exploit the Click2Shell vulnerability. To avoid detection by basic WAF signatures, they might attempt to use URL encoding, but for this initial validation, we will execute the raw exploit string to confirm the rule’s base functionality. The attacker sends a POST/GET request to
/wp-admin/theme-install.phpcontaining a malicious jQuery selectordiv[data-slug=within theargsparameter to manipulate the theme installation logic and trigger RCE. -
Regression Test Script:
# This script simulates the Click2Shell exploit request to trigger the detection rule. # It targets the theme-install.php endpoint with the specific selector string. TARGET_URL="http://localhost/wp-admin/theme-install.php" MALICIOUS_ARGS="div[data-slug='malicious-theme']" echo "[+] Simulating Click2Shell exploit attempt..." curl -X GET "${TARGET_URL}?args=${MALICIOUS_ARGS}" echo "[+] Simulation request sent. Check SIEM for alert: Detection of Click2Shell WordPress Theme Installation Exploit" -
Cleanup Commands:
# No persistent changes are made by the curl request itself, # but if any files were created by the webserver during the test, remove them. # Example: # rm -rf /var/www/html/wp-content/themes/malicious-theme echo "[+] Cleanup complete. No artifacts found."