Register for the AI for Security Summit: Join Figma, Perplexity & Wiz

CVE-2026-1540
WordPress vulnerability analysis and mitigation

Overview

CVE-2026-1540 is a Remote Code Execution (RCE) vulnerability in the Spam Protect for Contact Form 7 WordPress plugin affecting all versions before 1.2.10. The flaw allows an attacker with WordPress editor-level access to write arbitrary PHP code to a log file by sending a crafted HTTP header, which can then be executed on the server. It was publicly disclosed on March 12, 2026, and assigned a CVE on April 2, 2026. The vulnerability carries a CVSS v3.1 base score of 7.2 (High) (WPScan, GitHub Advisory).

Technical details

The root cause is classified as CWE-94 (Improper Control of Generation of Code / Code Injection). The plugin's spam-logging feature allows administrators or editors to configure a custom log filename, including one with a .php extension. When a contact form submission triggers spam detection, the plugin logs request details — including unsanitized HTTP headers such as X-Forwarded-For — directly into the configured PHP file. An attacker with editor access can set the log filename to shell.php, then submit a crafted form request with a PHP payload in the X-Forwarded-For header, causing the payload to be written into the PHP file. The resulting file is web-accessible and can be directly requested to execute arbitrary PHP code. A detailed proof-of-concept is publicly available (WPScan).

Impact

Successful exploitation grants an attacker arbitrary server-side code execution in the context of the web server process, resulting in full compromise of confidentiality, integrity, and availability of the affected WordPress installation and potentially the underlying server. An attacker could steal sensitive data (credentials, user PII, database contents), deface or modify website content, establish persistent backdoors, or pivot to other systems on the same network. The scope is limited to the affected server (unchanged scope), but the practical impact includes complete site takeover (WPScan, GitHub Advisory).

Exploitability

A detailed public proof-of-concept (PoC) is available via a GitHub Gist authored by the original researcher, Chiao-Lin Yu (Steven Meow), demonstrating the full exploit chain using a curl command (WPScan). Exploitation requires editor-level (or higher) WordPress credentials, which limits opportunistic mass exploitation but makes it a significant insider threat or post-compromise escalation vector. There is no evidence of active in-the-wild exploitation at this time, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The EPSS score is approximately 0.027%–0.119%, indicating a low but non-negligible probability of exploitation in the near term (GitHub Advisory).

Exploitation steps

  1. Gain Editor Access: Obtain WordPress editor-level (or higher) credentials through phishing, credential stuffing, or other means.
  2. Configure Malicious Log File: Navigate to the plugin's "Antispam Settings" panel, add a spam trigger word (e.g., testspam) to the block list, and set the log filename to shell.php.
  3. Identify Target Form: Note the Post ID of an existing Contact Form 7 form on the site.
  4. Send Crafted Request: Submit a form feedback request via the CF7 REST API endpoint with a PHP payload embedded in the X-Forwarded-For header:
curl -s -X POST "http://example.com/wp-json/contact-form-7/v1/contact-forms/[FORM_ID]/feedback" \
  -H $'X-Forwarded-For: <?php phpinfo(); ?>' \
  -F "your-name=test" \
  -F "your-email=test@test.com" \
  -F "your-subject=test" \
  -F "your-message=testspam" \
  -F "_wpcf7=[FORM_ID]" \
  -F "_wpcf7_version=6.1.4" \
  -F "_wpcf7_locale=en_US" \
  -F "_wpcf7_unit_tag=wpcf7-f[FORM_ID]-p1-o1" \
  -F "_wpcf7_container_post=1"
  1. Trigger Logging: The spam keyword in the message body triggers the plugin to log the request, writing the PHP payload from the header into wp-content/shell.php.
  2. Execute Arbitrary Code: Visit http://example.com/wp-content/shell.php to execute the injected PHP code on the server (WPScan).

Indicators of compromise

  • Network: Unusual POST requests to /wp-json/contact-form-7/v1/contact-forms/[ID]/feedback containing PHP code patterns (e.g., <?php) in the X-Forwarded-For header; subsequent GET requests to unexpected .php files in the wp-content/ directory.
  • File System: Presence of unexpected .php files in the wp-content/ directory or plugin subdirectories (e.g., shell.php, cmd.php); recently modified or created PHP files in plugin log directories with PHP code content.
  • Logs: Web server access logs showing requests to newly created PHP files under wp-content/ returning HTTP 200 responses; POST requests to the CF7 feedback endpoint with anomalous header values containing PHP syntax.
  • Process: Unusual child processes spawned by the web server process (e.g., bash, sh, curl, wget, python) following requests to unexpected PHP files in the plugin directory.

Mitigation and workarounds

The primary remediation is to upgrade the Spam Protect for Contact Form 7 plugin to version 1.2.10 or later, which resolves the unsafe logging behavior (WPScan, GitHub Advisory). As interim mitigations: restrict editor-level WordPress access to only fully trusted users; audit the plugin's Antispam Settings to ensure no .php log filename is configured; scan the wp-content/ directory for unexpected PHP files and remove any found. Deploying a Web Application Firewall (WAF) rule to block PHP code patterns in HTTP headers can reduce exploitation risk until patching is complete.

Community reactions

The vulnerability was discovered and responsibly disclosed by researcher Chiao-Lin Yu (Steven Meow), who also published the proof-of-concept on GitHub Gist (WPScan). No significant broader media coverage or notable community debate has been observed beyond standard vulnerability database indexing across NVD, GitHub Advisory Database, and ENISA EUVD.

Additional resources


SourceThis report was generated using AI

Related WordPress vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-88788MEDIUM6.8
  • text-styler
NoNoSep 19, 2026
CVE-2026-9858MEDIUM4.3
  • wc-partial-shipment
NoYesSep 19, 2026
CVE-2026-9766MEDIUM4.3
  • empik-for-woocommerce
NoYesSep 19, 2026
CVE-2026-9613MEDIUM4.3
  • datalogics
NoYesSep 19, 2026
CVE-2026-87848LOW3.7
  • mpcx-lightbox
NoNoSep 19, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management