Apache Struts: doubleselect writes a submitted value into its script
Struts doubleselect with doubleMultiple wrote a submitted value into its own script unquoted. Fixed in 7.5.0 and 6.13.0.
On this page
Apache Struts doubleselect tag - with doubleMultiple set, the preselected value of the second list was written into the tag's own nonce'd script without quotes (S2-087, CVE-2026-133643)
- Severity
- Low
- Status
- Patched
- Published
- Report to public
- 46 days
- Product
- Apache Struts (Java web framework) in apache/struts
- Affected versions
- Struts 2.1.8 to 2.3.37 and 2.5.0 to 2.5.33 (both end of life), 6.0.0 to 6.12.0 and 7.0.0 to 7.4.0, in apps that use the doubleselect tag with the doubleMultiple attribute. Fixed in 7.5.0 and 6.13.0.
- Vendor bulletin
- S2-087Apache Struts security bulletin; Struts takes reports by email, so there is no GitHub advisory
- Weaknesses (1)
- CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
- Credit
- Finder: Aaron Elijah Mars of Aeon. Tool: Aeon (https://www.aeon.fun). Also reported by Yu Deshui (@qiushui_sky).
What users should do now#
- Upgrade to Struts 7.5.0 or later, or to 6.13.0 or later on the 6.x line.
- If you cannot upgrade yet, remove the
doubleMultipleattribute from every<s:doubleselect>tag. Setting it tofalseis not enough: the template only checks that the attribute is present. - Apps on Struts 2.3 or 2.5 are end of life and get no fix. Remove the attribute, then plan the move to 7.x.
Summary#
The doubleselect tag renders two linked lists: picking a value in the first one fills the second. The simple theme template writes a script for this, inside an <@s.script> block that carries the page's CSP nonce, and the script runs on page load.
When doubleMultiple is set, the template compares each option of the second list against the preselected value. It wrote that value straight into the script as ${attributes.doubleNameValue}.length, without quotes. If doubleValue is not set, DoubleListUIBean takes the value from the property named by doubleName, which is often the value the user just submitted. Struts escapes it for HTML, but HTML escaping does not stop JavaScript that avoids <, >, & and quotes. A value such as alert(document.domain) therefore becomes code: for (var j = 0; j < alert(document.domain).length; j++).
The single-value branch a few lines below quotes the value and escapes it for JavaScript, so only the multi-value branch was affected. The same bug also broke the feature: a plain value such as AN became a bare name and threw a ReferenceError, so preselecting several values in the second list never worked.
Affected versions#
- Struts 2.1.8 through 2.3.37 (end of life).
- Struts 2.5.0 through 2.5.33 (end of life).
- Struts 6.0.0 through 6.12.0.
- Struts 7.0.0 through 7.4.0.
Only apps that use <s:doubleselect> with the doubleMultiple attribute are affected. The html5 theme does not render this tag. Struts 2.1.6 and earlier are not affected.
Impact#
- Cross-site scripting. A value that reaches the second list's selection runs as script when the form renders, in the app's origin.
- Nonce CSP does not help. The code lands inside the script block Struts emits with the page nonce, so a Content Security Policy built on nonces lets it run.
- How it is reached. Typically a form that is shown again with the submitted values, such as the
inputresult after a validation error. Rated Low by the Struts PMC.
Affected code#
Permalinks at a91460a, the commit on main we reported against.
- The multi-value branch prints the value unquoted: template/simple/doubleselect.ftl#L216-L223
- The single-value branch quotes it and escapes it for JavaScript: template/simple/doubleselect.ftl#L224-L228
Fix#
- #2126 (WW-5847, "preselect multiple values in the doubleselect second list", merged 2026-11-07) builds a JavaScript array of the preselected values, each one quoted and escaped with
js_string, and compares the options against that array instead of printing the raw value into the script. - The template now also checks that
doubleMultipleis true, not just present, sodoubleMultiple="false"takes the single-value branch. - Preselecting several values in the second list, which never worked on affected versions, works after the upgrade.
- Merge commit: apache/struts@2f7666e. Shipped in Struts 7.5.0 and 6.13.0.
Timeline#
- We report the issue privately to security@struts.apache.org.
- We follow up.
- The Struts PMC confirms it on
mainand 6.x, treats it as a framework vulnerability, and merges the fix (#2126). - Struts 7.5.0 and 6.13.0 with the fix are announced; CVE-2026-133643 is assigned.
- The Struts PMC publishes S2-087 and the CVE record. Public write-up.
Credit#
Finder: Aaron Elijah Mars of Aeon. Tool: Aeon. Also reported by Yu Deshui (@qiushui_sky). Thanks to Lukasz Lenart and the Apache Struts PMC for the fix and the bulletin.
