CVE-2026-41846 Overview
CVE-2026-41846 is a cross-site scripting (XSS) vulnerability affecting Spring MVC applications that use JSP form tags. The flaw exists in how Spring Framework handles user-supplied values passed into the cssClass, cssErrorClass, and cssStyle attributes of JSP form tags. When applications bind untrusted input to these attributes without sanitization, attackers can inject arbitrary HTML or JavaScript code into rendered pages. The vulnerability is categorized as [CWE-79] Improper Neutralization of Input During Web Page Generation. Affected versions include Spring Framework 7.0.0 through 7.0.7, 6.2.0 through 6.2.18, 6.1.0 through 6.1.27, and 5.3.0 through 5.3.48.
Critical Impact
Successful exploitation allows attackers to execute arbitrary JavaScript in victim browsers, enabling session hijacking, credential theft, and unauthorized actions performed in the user's authenticated context.
Affected Products
- Spring Framework 7.0.0 through 7.0.7
- Spring Framework 6.2.0 through 6.2.18, 6.1.0 through 6.1.27
- Spring Framework 5.3.0 through 5.3.48
Discovery Timeline
- 2026-06-09 - CVE-2026-41846 published to NVD
- 2026-06-09 - Last updated in NVD database
Technical Details for CVE-2026-41846
Vulnerability Analysis
The vulnerability resides in Spring MVC's JSP form tag library. JSP form tags such as <form:input>, <form:select>, and related elements accept presentation attributes including cssClass, cssErrorClass, and cssStyle. These attributes are rendered directly into the HTML output of the resulting page.
When developers bind these attributes to model values populated from user input, Spring does not apply HTML encoding to the attribute values. An attacker can supply a payload that closes the existing attribute context and injects new HTML or JavaScript. The injected script then executes in the victim's browser when the page renders.
Exploitation requires user interaction, such as clicking a crafted link. The attack complexity is high because exploitation depends on application-level patterns where untrusted input flows into these specific tag attributes.
Root Cause
The root cause is missing output encoding in the Spring JSP form tag implementation. The tag handlers emit attribute values into HTML without escaping characters such as quotes, angle brackets, and ampersands. Applications relying on the framework to sanitize attribute output remain vulnerable when they bind user-controlled values to the affected attributes.
Attack Vector
An attacker crafts a URL or form submission carrying a malicious payload in a parameter that the target application binds to cssClass, cssErrorClass, or cssStyle. The attacker delivers the link to a victim through phishing or another social engineering channel. When the victim follows the link, the rendered page reflects the attacker payload, executing JavaScript in the victim's session context.
The vulnerability is reflected XSS in nature. Attackers can use it to steal session cookies, capture credentials submitted on the page, perform actions on behalf of the user, or pivot to additional attacks against the application backend. Refer to the Spring Security Advisory CVE-2026-41846 for vendor technical details.
Detection Methods for CVE-2026-41846
Indicators of Compromise
- HTTP request parameters containing HTML control characters such as ", <, >, or javascript: that map to form attribute bindings in Spring MVC controllers.
- Server access logs showing requests with payloads targeting query parameters bound to cssClass, cssErrorClass, or cssStyle.
- Web Application Firewall (WAF) alerts flagging reflected XSS patterns against Spring-based endpoints.
Detection Strategies
- Conduct source code review for any use of JSP form tags where the cssClass, cssErrorClass, or cssStyle attributes receive values originating from request parameters or model attributes populated from user input.
- Perform dynamic application security testing (DAST) against Spring MVC endpoints with XSS payloads targeting the affected attributes.
- Inspect rendered HTML for unescaped attribute values containing characters that should have been encoded.
Monitoring Recommendations
- Configure WAF rules to detect XSS payload patterns in request parameters destined for Spring MVC controllers.
- Monitor browser-side Content Security Policy (CSP) violation reports for unexpected inline script execution.
- Alert on outbound requests from user sessions to unknown domains, which can indicate active XSS data exfiltration.
How to Mitigate CVE-2026-41846
Immediate Actions Required
- Upgrade Spring Framework to a patched release as documented in the Spring Security Advisory CVE-2026-41846.
- Audit application code for any data flow from user input to the cssClass, cssErrorClass, or cssStyle attributes of JSP form tags.
- Apply input validation to reject HTML control characters in parameters bound to presentation attributes.
Patch Information
VMware/Spring has released patched versions addressing CVE-2026-41846. Organizations running affected versions of Spring Framework 5.3.x, 6.1.x, 6.2.x, and 7.0.x should upgrade to the fixed releases identified in the vendor advisory. Refer to the Spring Security Advisory CVE-2026-41846 for exact fixed version numbers.
Workarounds
- Remove user-controlled bindings from the cssClass, cssErrorClass, and cssStyle attributes of JSP form tags until patches are deployed.
- Apply server-side HTML encoding to any value flowing into form tag style or class attributes before passing it to the view layer.
- Deploy a strict Content Security Policy that disallows inline scripts to limit the impact of successful XSS injection.
- Configure WAF signatures to block requests carrying XSS payloads targeting Spring MVC endpoints.
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

