GHSA-9rcc-pmj8-ffhr: Semantic MediaWiki's Special Cross-Site Scripting Vulnerability

MODERATE
CVSS 6.1
CWE-79
Published
Advisory Summary

GHSA-9rcc-pmj8-ffhr is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Semantic MediaWiki's Special libraries in the Packagist ecosystem. The issue involves facetedsearch cstate hidden inputs enable reflected xss (residual of cve-2025-10354). Remediation is available by upgrading affected packages to version 7.2.1.

GHSA-9rcc-pmj8-ffhr at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-9rcc-pmj8-ffhr
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Semantic MediaWiki's Special
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 6.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix GHSA-9rcc-pmj8-ffhr

To remediate this vulnerability, upgrade all affected Semantic MediaWiki's Special dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mediawiki/semantic-media-wiki fixed: 7.2.1
Upgrade mediawiki/semantic-media-wiki to 7.2.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for mediawiki/semantic-media-wiki

How to Check if You Are Affected

To determine whether your application is affected by GHSA-9rcc-pmj8-ffhr, inspect your project dependencies for Semantic MediaWiki's Special:

inspect dependencies for mediawiki/semantic-media-wiki

Analyze the terminal output to locate any version of Semantic MediaWiki's Special in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.2.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Semantic MediaWiki's Special, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary 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/SemanticMediaWiki@7.2.0`. - Confirmed present on default branch `master` at HEAD `18f418b4cdf2875e67a741349179a22c1573f61c`. Vulnerable sink (default-branch representation): - `src/MediaWiki/Specials/FacetedSearch/HtmlBuilder.php:131-133` - Builds `$hidden` by concatenating unescaped request-controlled `cstate[$key]` values into an HTML attribute context (`value="..."`). - `templates/FacetedSearch/search.mustache:25` - Inserts the constructed fragment via `{{{hidden}}}` (no HTML escaping at this boundary). #### Reachability trace (verified from source) 1. HTTP entrypoint: - `GET` to `Special:FacetedSearch` dispatches into `SMW\MediaWiki\Specials\SpecialFacetedSearch::execute()`. 2. Request decoding boundary: - `SpecialFacetedSearch::execute()` constructs `UrlArgs` from `$request->getValues()` and calls `ParametersProcessor::checkRequest($request)`. 3. Checksum gate: - `ParametersProcessor::checkRequest()` clears `cstate` only when `filtered != 1` and `getInt('csum', 0) != crc32(getVal('q', ''))`. 4. Decoder -> HTML assembly: - `HtmlBuilder::buildHTML()` iterates `foreach ( $urlArgs->getArray( 'cstate' ) as $key => $value )` and concatenates each into `$hidden` without escaping. - `HtmlBuilder::buildHTML()` passes `$hidden` into the template variable `hidden`. 5. HTML injection sink: - `templates/FacetedSearch/search.mustache` renders `{{{hidden}}}` into the `<form>`, so the concatenated markup is inserted as raw HTML. ### PoC #### Reproduction steps (source-derived) 1. Choose a `q` value. 2. Compute `csum` as `crc32(q)`. 3. Send a request that includes: - `q=<chosen>` - `csum=<crc32(q)>` - at least one `cstate[<key>]=<payload>` entry Example request shape: ```text /index.php/Special:FacetedSearch?q=Text&csum=<crc32(Text)>&cstate[0]=x%22%20autofocus%20onfocus%3Dalert(1)%20x%22 ``` ### Impact #### Attacker model - Any remote attacker who can send HTTP requests to `Special:FacetedSearch` (or the localized alias mapped to the same `SpecialFacetedSearch` class) can supply attacker-controlled query parameters. - Preconditions: - The attacker must make `cstate` survive `ParametersProcessor::checkRequest()`, either by setting `csum` to `crc32(q)` (when `filtered != 1`), or by setting `filtered=1`. - The attacker must supply `cstate[<key>]` values containing characters that break out of the HTML `value="..."` attribute context (for example an injected `"` to terminate the attribute value). #### 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 one `cstate` entry. - 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 `q` parameter before emitting it into the `value="{{q}}"` attribute. - Commit `3d675ce` updates only the `q` rendering to use `htmlspecialchars( $urlArgs->get( 'q', '' ) )` and does not touch the adjacent `cstate` -> `$hidden` construction loop. - As a result, `cstate` remains 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: ```html <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. ### Suggested fix - Escape both the `cstate` key and value when constructing `$hidden`. - Minimal code change in `src/MediaWiki/Specials/FacetedSearch/HtmlBuilder.php`: ```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. ### 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.

GHSA-9rcc-pmj8-ffhr Affected Semantic MediaWiki's Special Versions

1 component(s)
Fixed Versions:
7.2.1
Product / Package Ecosystem Affected Versions Fixed Version
mediawiki/semantic-media-wiki
Packagist
≥ 4.2.0
< 7.2.1
7.2.1

References

Frequently Asked Questions

What is GHSA-9rcc-pmj8-ffhr?
GHSA-9rcc-pmj8-ffhr is a security vulnerability in Semantic MediaWiki's Special involving FacetedSearch cstate hidden inputs enable reflected XSS (residual of CVE-2025-10354) under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Semantic MediaWiki's Special versions are affected?
Affected versions include releases prior to 7.2.1 across affected packages: mediawiki/semantic-media-wiki.
What version fixes GHSA-9rcc-pmj8-ffhr?
Upgrading to 7.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mediawiki/semantic-media-wiki affected?
Yes, mediawiki/semantic-media-wiki is affected in releases prior to 7.2.1. Upgrade your dependency to 7.2.1 or later.
What is the CVSS score of GHSA-9rcc-pmj8-ffhr?
GHSA-9rcc-pmj8-ffhr has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N.
What CWE is associated with GHSA-9rcc-pmj8-ffhr?
GHSA-9rcc-pmj8-ffhr is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Packagist dependencies for GHSA-9rcc-pmj8-ffhr?
Run the dependency tree command: 'inspect dependencies for mediawiki/semantic-media-wiki'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9rcc-pmj8-ffhr",
  "modified" : "2026-09-18T16:59:17Z",
  "published" : "2026-09-18T16:59:16Z",
  "aliases" : [ ],
  "summary" : "Semantic MediaWiki's Special:FacetedSearch cstate hidden inputs enable reflected XSS (residual of CVE-2025-10354)",
  "details" : "### Summary\n\nSpecial:FacetedSearch `cstate` hidden inputs enable reflected XSS (residual of CVE-2025-10354)\n\n### Details\n\n#### Affected versions and vulnerable location\n\n- Confirmed present on latest shipped release tag available in the local clone: `SemanticMediaWiki/SemanticMediaWiki@7.2.0`.\n- Confirmed present on default branch `master` at HEAD `18f418b4cdf2875e67a741349179a22c1573f61c`.\n\nVulnerable sink (default-branch representation):\n\n- `src/MediaWiki/Specials/FacetedSearch/HtmlBuilder.php:131-133`\n  - Builds `$hidden` by concatenating unescaped request-controlled `cstate[$key]` values into an HTML attribute context (`value=\"...\"`).\n- `templates/FacetedSearch/search.mustache:25`\n  - Inserts the constructed fragment via `{{{hidden}}}` (no HTML escaping at this boundary).\n\n#### Reachability trace (verified from source)\n\n1. HTTP entrypoint:\n   - `GET` to `Special:FacetedSearch` dispatches into `SMW\\MediaWiki\\Specials\\SpecialFacetedSearch::execute()`.\n2. Request decoding boundary:\n   - `SpecialFacetedSearch::execute()` constructs `UrlArgs` from `$request->getValues()` and calls `ParametersProcessor::checkRequest($request)`.\n3. Checksum gate:\n   - `ParametersProcessor::checkRequest()` clears `cstate` only when `filtered != 1` and `getInt('csum', 0) != crc32(getVal('q', ''))`.\n4. Decoder -> HTML assembly:\n   - `HtmlBuilder::buildHTML()` iterates `foreach ( $urlArgs->getArray( 'cstate' ) as $key => $value )` and concatenates each into `$hidden` without escaping.\n   - `HtmlBuilder::buildHTML()` passes `$hidden` into the template variable `hidden`.\n5. HTML injection sink:\n   - `templates/FacetedSearch/search.mustache` renders `{{{hidden}}}` into the `<form>`, so the concatenated markup is inserted as raw HTML.\n\n### PoC\n\n#### Reproduction steps (source-derived)\n\n1. Choose a `q` value.\n2. Compute `csum` as `crc32(q)`.\n3. Send a request that includes:\n   - `q=<chosen>`\n   - `csum=<crc32(q)>`\n   - at least one `cstate[<key>]=<payload>` entry\n\nExample request shape:\n\n```text\n/index.php/Special:FacetedSearch?q=Text&csum=<crc32(Text)>&cstate[0]=x%22%20autofocus%20onfocus%3Dalert(1)%20x%22\n```\n\n### Impact\n\n#### Attacker model\n\n- Any remote attacker who can send HTTP requests to `Special:FacetedSearch` (or the localized alias mapped to the same `SpecialFacetedSearch` class) can supply attacker-controlled query parameters.\n- Preconditions:\n  - The attacker must make `cstate` survive `ParametersProcessor::checkRequest()`, either by setting `csum` to `crc32(q)` (when `filtered != 1`), or by setting `filtered=1`.\n  - The attacker must supply `cstate[<key>]` values containing characters that break out of the HTML `value=\"...\"` attribute context (for example an injected `\"` to terminate the attribute value).\n\n#### Severity and CVSS reasoning\n\nProposed severity: MEDIUM.\n\nProposed CVSS v3.1 vector: `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`.\n\nRationale:\n\n- AV:N: delivered over the network via query parameters.\n- AC:L: requires only setting `q`, `csum`, and at least one `cstate` entry.\n- PR:N: no authentication required for the request path in this code.\n- UI:R: the victim must load the crafted URL.\n- S:C: reflected XSS executes in the wiki origin and can affect other users depending on deployment and browser behavior.\n\n### Why this is a residual of CVE-2025-10354\n\n- The CVE-2025-10354 hardening shipped by escaping the `q` parameter before emitting it into the `value=\"{{q}}\"` attribute.\n- Commit `3d675ce` updates only the `q` rendering to use `htmlspecialchars( $urlArgs->get( 'q', '' ) )` and does not touch the adjacent `cstate` -> `$hidden` construction loop.\n- As a result, `cstate` remains an unescaped input source that flows into the same raw template injection point (`{{{hidden}}}`), creating a distinct reflected-XSS lane.\n\n### Output (from code inspection)\n\nGiven the payload idea where `cstate[0]` starts with `x\" ... x\"`, `HtmlBuilder.php` constructs the hidden fragment by concatenation:\n\n```html\n<input name=\"cstate[0]\" type=\"hidden\" value=\"x\" autofocus onfocus=alert(1) x\">\n```\n\nBecause `search.mustache` injects the fragment via `{{{hidden}}}`, the attacker-controlled markup participates in normal HTML parsing in the response body.\n\n### Suggested fix\n\n- Escape both the `cstate` key and value when constructing `$hidden`.\n- Minimal code change in `src/MediaWiki/Specials/FacetedSearch/HtmlBuilder.php`:\n\n```php\nforeach ( $urlArgs->getArray( 'cstate' ) as $key => $value ) {\n\t$safeKey = htmlspecialchars( (string)$key, ENT_QUOTES, 'UTF-8' );\n\t$safeValue = htmlspecialchars( (string)$value, ENT_QUOTES, 'UTF-8' );\n\t$hidden .= '<input name=\"cstate[' . $safeKey . ']\" type=\"hidden\" value=\"' . $safeValue . '\">';\n}\n```\n\nThis keeps the raw `{{{hidden}}}` template insertion safe by ensuring the concatenated HTML fragment itself is attribute-escaped.\n\n### How I found it and a note on tooling\n\nI 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`.\n\nThen 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}}}`.\n\n(End of file)\n\n### AI tooling\n\nI 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "mediawiki/semantic-media-wiki"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.2.0"
      }, {
        "fixed" : "7.2.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 7.2.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/SemanticMediaWiki/SemanticMediaWiki/security/advisories/GHSA-9rcc-pmj8-ffhr"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/SemanticMediaWiki/SemanticMediaWiki"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/SemanticMediaWiki/SemanticMediaWiki/releases/tag/7.2.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-18T16:59:16Z",
    "nvd_published_at" : null
  }
}