Skip to content

Stored XSS by editing MediaWiki:Tagline

Moderate
alistair3149 published GHSA-jhm6-qjhq-5mf9 Jun 1, 2024

Package

Citizen (MediaWiki)

Affected versions

>= 25d25e381b12172d6b3dadf83d139a9583f18fea

Patched versions

4a43280242f33e54643087da4a7f40970d2640c9

Description

Summary

The page MediaWiki:Tagline has its contents used unescaped, so custom HTML (including Javascript) can be injected by someone with the ability to edit the MediaWiki namespace (typically those with the editinterface permission, or sysops).

Details

The lines below correctly use Message::parse() for citizen-tagline (which returns an HTML-representation of the wikitext), but it incorrectly uses Message::text() for tagline (which returns the wikitext itself, with unescaped HTML tags).

} elseif ( !$localizer->msg( 'citizen-tagline' )->isDisabled() ) {
$tagline = $localizer->msg( 'citizen-tagline' )->parse();
} else {
// Fallback to site tagline
$tagline = $localizer->msg( 'tagline' )->text();
}

This is also duplicated a few lines below:

} elseif ( !$localizer->msg( 'citizen-tagline' )->isDisabled() ) {
$tagline = $localizer->msg( 'citizen-tagline' )->parse();
} else {
$tagline = $localizer->msg( 'tagline' )->text();
}

PoC

  • Login with an account that has the editinterface permission (usually one that is a sysop)
  • Ensure that MediaWiki:Citizen-tagline is either blank or deleted
  • Edit MediaWiki:Tagline to something like:
    <script>alert(`Citizen XSS in MediaWiki:Tagline on ${window.origin}`)</script>
  • Load a mainspace article

Example on Citizen:

Example on Vector:

Impact

Arbitrary HTML (and thus Javascript) can be injected by someone with editinterface permission (typically sysops). This can lead to actions being covertly taken that a user who uses the Citizen skin, and it could lead to an account takeover.

However, editing MediaWIki:Tagline is very noisy (appears in page history, visible to non-Citizen users, appears in Recent Changes unless if the editor has the bot flag). Additionally, a proper CSP will thwart this attack.

Severity

Moderate
6.5
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:N

CVE ID

CVE-2024-36123

Weaknesses

Credits