Summary
Semantic MediaWiki's Special:FacetedSearch cstate hidden inputs enable reflected XSS (residual of CVE-2025-10354)
Special:FacetedSearch cstate hidden inputs enable reflected XSS (residual of CVE-2025-10354)
Details
Affected versions and vulnerable location
- Confirmed present on latest shipped release tag available in the local clone:
SemanticMediaWiki/[email protected]. - Confirmed present on default branch
masterat HEAD18f418b4cdf2875e67a741349179a22c1573f61c.
Vulnerable sink (default-branch representation):
src/MediaWiki/Specials/FacetedSearch/HtmlBuilder.php:131-133- Builds
$hiddenby concatenating unescaped request-controlledcstate[$key]values into an HTML attribute context (value="...").
- Builds
templates/FacetedSearch/search.mustache:25- Inserts the constructed fragment via
{{{hidden}}}(no HTML escaping at this boundary).
- Inserts the constructed fragment via
Reachability trace (verified from source)
- HTTP entrypoint:
GETtoSpecial:FacetedSearchdispatches intoSMW\MediaWiki\Specials\SpecialFacetedSearch::execute().
- Request decoding boundary:
SpecialFacetedSearch::execute()constructsUrlArgsfrom$request->getValues()and callsParametersProcessor::checkRequest($request).
- Checksum gate:
ParametersProcessor::checkRequest()clearscstateonly whenfiltered != 1andgetInt('csum', 0) != crc32(getVal('q', '')).
- Decoder -> HTML assembly:
HtmlBuilder::buildHTML()iteratesforeach ( $urlArgs->getArray( 'cstate' ) as $key => $value )and concatenates each into$hiddenwithout escaping.HtmlBuilder::buildHTML()passes$hiddeninto the template variablehidden.
- HTML injection sink:
templates/FacetedSearch/search.mustacherenders{{{hidden}}}into the<form>, so the concatenated markup is inserted as raw HTML.
PoC
Reproduction steps (source-derived)
- Choose a
qvalue. - Compute
csumascrc32(q). - Send a request that includes:
q=<chosen>csum=<crc32(q)>- at least one
cstate[<key>]=<payload>entry
Example request shape:
/index.php/Special:FacetedSearch?q=Text&csum=<crc32(Text)>&cstate[0]=x%22%20autofocus%20onfocus%3Dalert(1)%20x%22
Attacker model
- Any remote attacker who can send HTTP requests to
Special:FacetedSearch(or the localized alias mapped to the sameSpecialFacetedSearchclass) can supply attacker-controlled query parameters. - Preconditions:
- The attacker must make
cstatesurviveParametersProcessor::checkRequest(), either by settingcsumtocrc32(q)(whenfiltered != 1), or by settingfiltered=1. - The attacker must supply
cstate[<key>]values containing characters that break out of the HTMLvalue="..."attribute context (for example an injected"to terminate the attribute value).
- The attacker must make
Severity and CVSS reasoning
Proposed severity: MEDIUM.
Proposed CVSS v3.1 vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
Rationale:
- AV:N: delivered over the network via query parameters.
- AC:L: requires only setting
q,csum, and at least onecstateentry. - PR:N: no authentication required for the request path in this code.
- UI:R: the victim must load the crafted URL.
- S:C: reflected XSS executes in the wiki origin and can affect other users depending on deployment and browser behavior.
Why this is a residual of CVE-2025-10354
- The CVE-2025-10354 hardening shipped by escaping the
qparameter before emitting it into thevalue="{{q}}"attribute. - Commit
3d675ceupdates only theqrendering to usehtmlspecialchars( $urlArgs->get( 'q', '' ) )and does not touch the adjacentcstate->$hiddenconstruction loop. - As a result,
cstateremains an unescaped input source that flows into the same raw template injection point ({{{hidden}}}), creating a distinct reflected-XSS lane.
Output (from code inspection)
Given the payload idea where cstate[0] starts with x" ... x", HtmlBuilder.php constructs the hidden fragment by concatenation:
<input name="cstate[0]" type="hidden" value="x" autofocus onfocus=alert(1) x">
Because search.mustache injects the fragment via {{{hidden}}}, the attacker-controlled markup participates in normal HTML parsing in the response body.
How I found it and a note on tooling
I anchored on the published CVE-2025-10354 patch by verifying in the checked-out repository that commit 3d675ce changes only the q rendering in HtmlBuilder.php to use htmlspecialchars.
Then I traced the reachable request path from SpecialFacetedSearch::execute() through ParametersProcessor::checkRequest() (checksum gate for whether cstate survives) into HtmlBuilder::buildHTML() where $hidden is constructed from cstate without escaping and injected into templates/FacetedSearch/search.mustache via {{{hidden}}}.
(End of file)
AI tooling
I used AI assistance for the code audit and for drafting this report. I manually verified the finding against the project's source at the location cited above before reporting it, and the severity and impact assessment are my own.
Impact
Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.
GHSA-9RCC-PMJ8-FFHR has a CVSS score of 6.1 (Medium). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (7.2.1); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
- Escape both the
cstatekey and value when constructing$hidden. - Minimal code change in
src/MediaWiki/Specials/FacetedSearch/HtmlBuilder.php:
foreach ( $urlArgs->getArray( 'cstate' ) as $key => $value ) {
$safeKey = htmlspecialchars( (string)$key, ENT_QUOTES, 'UTF-8' );
$safeValue = htmlspecialchars( (string)$value, ENT_QUOTES, 'UTF-8' );
$hidden .= '<input name="cstate[' . $safeKey . ']" type="hidden" value="' . $safeValue . '">';
}
This keeps the raw {{{hidden}}} template insertion safe by ensuring the concatenated HTML fragment itself is attribute-escaped.
Frequently Asked Questions
- What is GHSA-9RCC-PMJ8-FFHR? GHSA-9RCC-PMJ8-FFHR is a medium-severity cross-site scripting (XSS) vulnerability in mediawiki/semantic-media-wiki (composer), affecting versions >= 4.2.0, <= 7.2.0. It is fixed in 7.2.1. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
- How severe is GHSA-9RCC-PMJ8-FFHR? GHSA-9RCC-PMJ8-FFHR has a CVSS score of 6.1 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of mediawiki/semantic-media-wiki are affected by GHSA-9RCC-PMJ8-FFHR? mediawiki/semantic-media-wiki (composer) versions >= 4.2.0, <= 7.2.0 is affected.
- Is there a fix for GHSA-9RCC-PMJ8-FFHR? Yes. GHSA-9RCC-PMJ8-FFHR is fixed in 7.2.1. Upgrade to this version or later.
- Is GHSA-9RCC-PMJ8-FFHR exploitable, and should I be worried? Whether GHSA-9RCC-PMJ8-FFHR is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-9RCC-PMJ8-FFHR is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-9RCC-PMJ8-FFHR? Upgrade
mediawiki/semantic-media-wikito 7.2.1 or later.