CVE-2026-126342 in WPForms Plugin
Summary
by MITRE • 11/26/2026
The WPForms (Contact Form by WPForms / wpforms-lite) plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the Multiple Choice field's 'Other' option value on payment forms in all versions up to, and including, 2.0.4 due to insufficient input sanitization and output escaping. This makes it possible for unauthenticated attackers to inject arbitrary web scripts in pages that will execute whenever a privileged user such as an administrator accesses the injected payment entry on the WPForms > Payments details page. The submitted value is stored via sanitize_text_field(), which preserves a space-separated pseudo-tag (e.g. '< i class="wpforms-single-payment-tooltip" data-tooltip-content="<img src=x onerror=...>">x< /i>') because strip_tags() ignores a '<' followed by whitespace; on the admin Payments entry page the value is output through wp_kses() with the 'post' allowlist, which normalizes it into a live <i> element retaining its class and data-* attributes, and the bundled Tooltipster initialization (contentAsHTML + contentCloning) then renders the attribute's HTML, executing the script on page load without any hover.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/26/2026
The vulnerability identified in WPForms versions up to 2.0.4 represents a critical Stored Cross-Site Scripting flaw that exploits deficiencies in input sanitization and output escaping mechanisms within the plugin’s payment form handling logic. This security issue specifically targets the Multiple Choice field's 'Other' option value when used on payment forms, allowing unauthenticated attackers to inject arbitrary web scripts into stored data entries. The core of the vulnerability lies in how the application processes user-supplied input during the submission phase and subsequently renders it within administrative interfaces. Because the attack vector relies on storing malicious payloads that execute upon viewing by privileged users, this constitutes a high-impact threat to site integrity and administrator credentials.
The technical mechanism behind this exploitation involves a specific bypass of WordPress’s standard sanitization functions. When an attacker submits a form entry containing a crafted payload such as a space-separated pseudo-tag like < i class="wpforms-single-payment-tooltip" data-tooltip-content="<img src=x onerror=...>">x< /i>, the sanitize_text_field() function processes this input. This function relies internally on strip_tags(), which is designed to remove HTML and PHP tags from strings. However, strip_tags() exhibits a known behavior where it ignores opening angle brackets that are immediately followed by whitespace or other non-alphanumeric characters in certain contexts, effectively allowing the malicious tag structure to pass through sanitization intact rather than being stripped out as expected. This preservation of the pseudo-tag allows the payload to be stored directly in the database without triggering immediate validation errors or removal.
The execution phase occurs when an administrator accesses the WPForms > Payments details page to review a specific payment entry containing the injected payload. Upon rendering this data, the application utilizes wp_kses() with the 'post' allowlist for output escaping. The wp_kses function is designed to filter content and only allow specified HTML tags and attributes. In this instance, the normalization process interprets the preserved pseudo-tag as a valid <i> element due to its class attribute matching allowed patterns or being treated as safe structural markup by the specific configuration of the allowlist. Consequently, the malicious data-tooltip-content attribute is retained within the DOM structure rather than being escaped or removed. This sets the stage for the final execution step involving the frontend JavaScript components bundled with WPForms.
The payload executes due to the interaction between the rendered HTML and the Tooltipster library initialization logic used by the plugin. The tooltip functionality is configured with contentAsHTML set to true and contentCloning enabled, which instructs the script to interpret the attribute value as raw HTML rather than plain text. When the page loads or when the element becomes visible, the JavaScript engine parses the data-tooltip-content attribute, injecting the contained <img> tag into the document context. The onerror event handler attached to this image triggers immediately upon load failure (which is guaranteed since src=x points to a non-existent resource), resulting in the execution of arbitrary JavaScript code within the security context of the administrator’s session. This bypasses any need for user interaction such as hovering, making the attack fully automatic and stealthy.
From an operational impact perspective, this vulnerability allows unauthenticated attackers to achieve Remote Code Execution equivalent effects by hijacking administrative sessions. Since WordPress administrators typically have full control over the site including plugin management, theme editing, and database access, a successful exploitation can lead to complete website compromise. Attackers may use this vector to deface websites, steal sensitive customer data stored in payment records, install backdoors for persistent access, or pivot further into internal network infrastructure if administrative credentials are reused elsewhere. The fact that the attack requires no authentication makes it particularly dangerous as it is easily scalable and can be automated against any WordPress site running vulnerable versions of WPForms without prior reconnaissance or credential theft.
To mitigate this vulnerability, immediate action must be taken to update the WPForms plugin to version 2.0.5 or later where these sanitization and escaping logic flaws have been addressed. Administrators should also review recent payment entries for signs of injection attempts by inspecting form submissions for anomalous HTML structures in text fields. Implementing a Web Application Firewall with rules targeting XSS payloads involving onerror handlers and malformed tags can provide an additional layer of defense against exploitation attempts while updates are applied. Furthermore, developers integrating WPForms or similar plugins should ensure that all user inputs undergo rigorous sanitization using functions like wp_kses_post() consistently for both storage and display contexts to prevent discrepancies between input handling and output rendering logic.
This vulnerability aligns with CWE-79 Improper Neutralization of Input During Web Page Generation commonly known as Cross-site Scripting, specifically the stored variant where malicious scripts are permanently stored in target databases. It also maps to MITRE ATT&CK technique T1059 Command and Scripting Interpreter via browser-based execution, demonstrating how web application flaws can be leveraged to execute arbitrary code within a victim’s environment. The specific bypass of strip_tags() highlights the importance of understanding edge cases in standard library functions rather than relying on them blindly for security boundaries. Organizations must prioritize patch management for WordPress plugins given their widespread deployment and frequent targeting by automated scanning tools seeking such injection points.