CVE-2026-133639
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Apache Struts is a popular open-source web application framework for developing Java EE web applications. The Javatemplates plugin is an optional theme that renders the Struts UI tags with Java code instead of the default FreeMarker templates.
A cross-site scripting (XSS) vulnerability (CVE-2026-133639) has been identified in the Apache Struts Javatemplates plugin, which allows attackers to inject markup or script into a rendered page through a dynamic attribute of a UI tag that carries a request-derived value. Applications that render the UI tags with the default FreeMarker templates are not affected.
Per OWASP: Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted websites.
This issue affects multiple versions of Apache Struts.
Details
Module Info
- Product: Apache Struts
- Affected packages:
org.apache.struts:struts2-javatemplates-plugin - Affected versions: >=2.2.1 <=2.3.37, >=2.5.0 <=2.5.33, >=6.0.0 <=6.12.0, >=7.0.0 <=7.4.0
- GitHub repository: https://github.com/apache/struts
- Published packages: https://central.sonatype.com/artifact/org.apache.struts/struts2-javatemplates-plugin
- Package manager: Maven
- Fixed in:
- OSS Apache Struts 6.13.0, 7.5.0
- NES for Apache Struts
Vulnerability Info
This Medium-severity vulnerability is found in the org.apache.struts:struts2-javatemplates-plugin package in multiple versions of Apache Struts.
A Struts UI tag accepts dynamic attributes: attributes that are not part of the tag's own attribute set (for example data-* attributes) and are written through to the rendered HTML element. When the Javatemplates theme renders a tag, DynamicAttributesHandler.processDynamicAttributes copies each dynamic attribute into the tag's Attributes map:
protected void processDynamicAttributes(Attributes a) {
Map<String, String> dynamicAttributes = (Map<String, String>) context.getParameters().get("dynamicAttributes");
for (Map.Entry<String, String> entry : dynamicAttributes.entrySet()) {
if (altSyntax && ComponentUtils.isExpression(entry.getValue())) {
String value = ObjectUtils.defaultIfNull(findString(entry.getValue()), entry.getValue());
a.put(entry.getKey(), value);
} else {
a.put(entry.getKey(), entry.getValue());
}
}
}
Attributes is a LinkedHashMap, and its add and addIfExists methods HTML-encode a value with StringEscapeUtils.escapeHtml4 before storing it. The handler calls the inherited put method instead, so both the literal value and the value produced by evaluating an expression such as %{...} are stored, and later written into the element, without any HTML escaping. When a page passes a request-derived value through a dynamic attribute, for example data-hint="%{param}", a crafted request can close the attribute quote and inject arbitrary markup or script into the page, which runs in the victim's browser when they open the crafted link.
Mitigation
Only recent versions of Apache Struts are community-supported. Older lines are End-of-Life and will not receive any updates to address this issue.
Until an upgrade is possible, applications can avoid the vulnerable code path by rendering the UI tags with the default FreeMarker templates, either by removing the Javatemplates plugin or by leaving struts.ui.templateSuffix at its default value:
struts.ui.templateSuffix=ftl
Users of the affected components should apply one of the following mitigations:
- Upgrade affected applications to a supported version of Apache Struts.
- Leverage a commercial support partner like HeroDevs for post-EOL security support.
Credits
- Claude and Ada Logics (finder)