Page MenuHomePhabricator

XSS in Special:ImportFile URL (CVE-2021-45474)
Closed, ResolvedPublic1 Estimated Story PointsSecurity

Description

Go to https://commons.wikimedia.org/wiki/Special:ImportFile?clientUrl=https://en.wikipedia.org/<img/src/onerror=alert()> and view the alert popup. Any valid import source followed by a payload without spaces (as spaces are replaced with underscores) is unescaped and interpreted as actual HTML.

Event Timeline

sbassett added a project: SecTeam-Processed.
sbassett added subscribers: thiemowmde, Addshore, WMDE-Fisch and 2 others.

Confirmed as a legitimate XSS for auth'd users. Hopefully we can get a patch up soon for this (please do not send it through gerrit) and get it deployed sooner than later.

thiemowmde set the point value for this task to 1.
thiemowmde moved this task from Backlog to Tickets in sprint on the Move-Files-To-Commons board.
thiemowmde added a subscriber: awight.

Oh no, I missed the "not Gerrit" comment. The patch is super trivial: https://gerrit.wikimedia.org/r/742501. I gave it a vague but still correct commit message to not catch extra attention. Unfortunately I'm probably not able to assist a backport.

@thiemowmde - Ok. It'd be nice to get maybe one more +1 on the patch from someone closer to the code, but I'm fine +2'ing later and picking to wmf.9 for a deploy during today's security window (UTC 22:00).

Change 742263 had a related patch set uploaded (by SBassett; author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/FileImporter@wmf/1.38.0-wmf.9] Fix special page displaying unescaped user input

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

Change 742263 merged by jenkins-bot:

[mediawiki/extensions/FileImporter@wmf/1.38.0-wmf.9] Fix special page displaying unescaped user input

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

Deployed as a backport to wmf.9. The XSS for the commons url in the task description no longer works and instead throws a proper error. Logstash seems happy for now, but I'll continue to keep an eye on it. And the master patch should merge soon as well, making the cut for wmf.11 tomorrow. So no need to keep a security patch up on deployment. Also tracked at T292236 and T276237.

sbassett moved this task from Watching to Our Part Is Done on the Security-Team board.
sbassett removed a project: Patch-For-Review.
sbassett changed Author Affiliation from N/A to Wikimedia Communities.
sbassett changed Risk Rating from N/A to Low.

Change 742501 merged by jenkins-bot:

[mediawiki/extensions/FileImporter@master] Fix special page displaying unescaped user input

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

I guess this can be closed now. Please feel free re-open if there's anything remaining that needs to be taken care of.

I guess this can be closed now. Please feel free re-open if there's anything remaining that needs to be taken care of.

Yes, this is technically resolved. The remaining work would be:

  1. Making this task public
  2. Pushing any relevant backports up to gerrit
  3. Requesting a CVE and announcing within the next supplemental security release

It should be fine to do the first two whenever WMDE folks would like.

Change 745373 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/FileImporter@wmf/1.38.0-wmf.10] Fix special page displaying unescaped user input

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

Change 745374 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/FileImporter@REL1_35] Fix special page displaying unescaped user input

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

Change 745375 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/FileImporter@REL1_36] Fix special page displaying unescaped user input

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

Change 745376 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/FileImporter@REL1_37] Fix special page displaying unescaped user input

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

Personally I'm fine with making this public, but would like to get a go from the security team.

I checked all relevant MediaWiki versions, starting with the deployed ones.

✅ master: done
✅ 1.38.0-wmf.9: done
❌ 1.38.0-wmf.10: not fixed
✅ 1.38.0-wmf.11: done
✅ 1.38.0-wmf.12: done
✅ REL1_35 (current LTS): done
✅ REL1_36 (not obsolete yet): done
✅ REL1_37 (current stable): done

I don't think wmf.10 is relevant in any way. But backporting this is so easy, it can't hurt. I'm not so sure about REL1_36. It's still marked in green in the version lifecycle chart. Anyway, here are all Patch-For-Review:

Personally I'm fine with making this public, but would like to get a go from the security team.

Yes, I'll make this task public now, as all of the change sets in gerrit are public. It's normally fine to do this once an issue has been patched in Wikimedia production. The only time we really delay disclosure is for anything bundled with the tarball releases. Also, wmf.10 and wmf.11 were both skipped.

sbassett changed the visibility from "Custom Policy" to "Public (No Login Required)".Dec 9 2021, 3:37 PM
sbassett changed the edit policy from "Custom Policy" to "All Users".

Change 745376 merged by jenkins-bot:

[mediawiki/extensions/FileImporter@REL1_37] Fix special page displaying unescaped user input

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

Change 745375 merged by jenkins-bot:

[mediawiki/extensions/FileImporter@REL1_36] Fix special page displaying unescaped user input

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

Change 745374 merged by jenkins-bot:

[mediawiki/extensions/FileImporter@REL1_35] Fix special page displaying unescaped user input

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

Change 745373 abandoned by WMDE-Fisch:

[mediawiki/extensions/FileImporter@wmf/1.38.0-wmf.10] Fix special page displaying unescaped user input

Reason:

.10 will never be deployed anywhere it seems.

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

MoritzMuehlenhoff renamed this task from XSS in Special:ImportFile URL to XSS in Special:ImportFile URL (CVE-2021-45474).Dec 24 2021, 10:55 AM