Page MenuHomePhabricator

CVE-2025-7057: Stored XSS through a system message in Extension:Quiz
Closed, ResolvedPublicSecurity

Description

In the Quiz extension, the quiz-ignore-coef system message is inserted into raw HTML unescaped, allowing JavaScript to be executed.

Reproduction steps:

  1. Edit MediaWiki:quiz-ignore-coef and replace it with (or add) <script>alert("hi!")</script>
  2. Visit a page with a quiz

image.png (204×476 px, 6 KB)

I'm not sure which quizzes exactly display this message, so here is the example quiz I used:

<quiz>
{Question
|type="()"}
+ The correct answer.
- Distractor.
- Distractor.
- Distractor.
</quiz>

Alternatively:

  • Make sure wgUseXssLanguage is set to true
  • Go to a page with a quiz and append ?uselang=x-xss to the URL

image.png (215×427 px, 11 KB)

Explanation

The message is provided to the template using the text() output mode and then inserted unescaped.

Additional Information

  • MediaWiki: 1.45.0-alpha (82464ab)
  • PHP: 8.3.14 (fpm-fcgi)
  • Quiz: 1.2.1 (975271a)
  • Browser: Firefox 138.0.3 (64-bit) on Fedora Linux 42

Event Timeline

I could not find the maintainer of this extension, "lrbabe", on Phabricator, so I'm not sure who I could add here.

SomeRandomDeveloper renamed this task from Stored XSS through system messages in Extension:Quiz to Stored XSS through a system message in Extension:Quiz.May 18 2025, 8:35 PM

I could not find the maintainer of this extension, "lrbabe", on Phabricator, so I'm not sure who I could add here.

That's the author, not necessarily maintainer?

I could not find the maintainer of this extension, "lrbabe", on Phabricator, so I'm not sure who I could add here.

That's the author, not necessarily maintainer?

True. In a lot of other extensions, the author mentioned on mediawiki.org or in extension.json is the maintainer, so I assumed that would be the case this time as well.

Another case where mustache prevents phan-taint-check from detecting the issue

I could not find the maintainer of this extension, "lrbabe", on Phabricator, so I'm not sure who I could add here.

Many extensions like this aren't really maintained at this point, and potentially aren't even used by any external MediaWiki operators. Though we don't really have a great way to verify any information like this.

Patch:

This looks reasonable to me. This should likely just get pushed through gerrit for public review since it's not bundled or Wikimedia-deployed. This can be done now or closer to the end of our quarter (2025-05-30) when we'll issue the next supplemental security release (T389312).

Patch:

This looks reasonable to me. This should likely just get pushed through gerrit for public review since it's not bundled or Wikimedia-deployed. This can be done now or closer to the end of our quarter (2025-05-30) when we'll issue the next supplemental security release (T389312).

https://github.com/wikimedia/operations-mediawiki-config/blob/af3cd130d2b848052f93fc106ae4ebe8aa659f20/wmf-config/InitialiseSettings.php#L4097
Quiz is deployed on wikinews, wikiversity, wikibooks and three wikipedias.

Interesting. I had no idea that was still configured on any Wikimedia wikis. Many of these message issues have been considered low-risk in the past and have just been pushed through gerrit. See T2212 et al. But we can plan to deploy this as a security patch today if anyone else would like to CR your proposed patch here.

This is getting deployed to 1.45.0-wmf.3 today but here's a proper patch file for deployment and the security release:

Mstyles subscribed.

Patch:

This looks reasonable to me. This should likely just get pushed through gerrit for public review since it's not bundled or Wikimedia-deployed. This can be done now or closer to the end of our quarter (2025-05-30) when we'll issue the next supplemental security release (T389312).

https://github.com/wikimedia/operations-mediawiki-config/blob/af3cd130d2b848052f93fc106ae4ebe8aa659f20/wmf-config/InitialiseSettings.php#L4097
Quiz is deployed on wikinews, wikiversity, wikibooks and three wikipedias.

Deployed

sbassett changed the task status from Open to In Progress.Jun 10 2025, 7:01 PM
sbassett triaged this task as Low priority.

Change #1166274 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/Quiz@master] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166274

Change #1166275 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/Quiz@REL1_44] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166275

Change #1166276 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/Quiz@REL1_43] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166276

Change #1166277 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/Quiz@REL1_42] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166277

Change #1166278 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/Quiz@REL1_39] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166278

Change #1166274 merged by jenkins-bot:

[mediawiki/extensions/Quiz@master] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166274

Change #1166278 merged by jenkins-bot:

[mediawiki/extensions/Quiz@REL1_39] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166278

Change #1166276 merged by jenkins-bot:

[mediawiki/extensions/Quiz@REL1_43] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166276

Change #1166275 merged by jenkins-bot:

[mediawiki/extensions/Quiz@REL1_44] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166275

Change #1166277 merged by Jly:

[mediawiki/extensions/Quiz@REL1_42] SECURITY: Properly escape the quiz-ignore-coef system message

https://gerrit.wikimedia.org/r/1166277

Jly renamed this task from Stored XSS through a system message in Extension:Quiz to CVE-2025-7057: Stored XSS through a system message in Extension:Quiz.Jul 7 2025, 3:08 PM
Jly closed this task as Resolved.
Jly removed a project: Patch-For-Review.
Jly changed the visibility from "Custom Policy" to "Public (No Login Required)".Jul 7 2025, 6:42 PM
Jly changed the edit policy from "Custom Policy" to "All Users".
Jly changed Risk Rating from N/A to Low.