Page MenuHomePhabricator

EmailAuth verification on Wikimedia wikis can sometimes be bypassed by logging in via a wiki in the `closed` dblist
Closed, ResolvedPublicSecurity

Description

Steps taken to reproduce:

  • On one device/IP address, create two new accounts on metawiki, both with an email address linked to the account:
    • Test-20250911-01
    • Test-20250911-02
  • While logged into Test-20250911-02 (as the legitimate account owner), navigate to https://aa.wikipedia.org/, and click the "Log in" button.
  • On another device & IP address (now putting myself in the shoes of a malicious actor), login to the accounts as follows:
    • Login to Test-20250911-01 on dewiki (not a member of the 'closed' dblist)
      • This login is prompted for an EmailAuth code.
    • Login to Test-20250911-02 on aawiki (which is a member of the 'closed' dblist)
      • This login is not prompted for an EmailAuth code, but I can now use other (non-closed) SUL wikis while logged into this account (despite the fact that, had I used a non-closed wiki to login, I would have been prompted for such a code).

tl;dr: if an SUL account is attached to a closed wiki (which is public information via Special:CentralAuth), I believe that any applicable EmailAuth checks for that account can be bypassed by a malicious actor logging in via that closed wiki.

Someone else should probably check my working here, to ensure I haven't accidentally got this wrong, though.


My immediate thought is that this might be because MediaWiki-extensions-WikimediaEvents - which contains the EmailAuthHooks.php logic that decides whether or not to issue an email verification challenge - isn't loaded on wikis in the 'closed' dblist (xref T158721: Disable WikimediaEvents extension on closed wikis). [Noticing this is what prompted me to check for this vulnerability.]
If that is the cause, it's potentially another reason in favour of T401939: Create a Wikimedia* extension for site customizations (which I assume could/would be loaded on all Wikimedia wikis by default).


(FWIW, I believe the fact that I could reproduce this with brand-new accounts is somewhat related to T401640: ClosedWikiProvider stopped working; although fixing that bug wouldn't mitigate this issue for anyone that already has their SUL account attached to a closed wiki, AFAICS).

Event Timeline

I guess I'm surprised that we allow SUL logins from closed projects.

If I’ve done this query correctly, there are currently 186,261 SUL accounts that are attached to at least one wiki in the closed dblist. (Not all of these accounts will currently be affected by this vulnerability, however -- for a couple of things, a number of them will have 2FA enabled [and therefore won't trigger Wikimedia's EmailAuth checks], and not all of them will have an email address linked to the account. I don't think I can filter out those accounts using Quarry, though; as I don't believe that information is available on the public wiki replica DBs.)

sbassett moved this task from Incoming to Watching on the Security-Team board.

Per @JTweed-WMF's tagging of MediaWiki-Core-Platform-Team, the Security-Team is fine with you triaging this issue, but we would likely rate this as a medium+ risk that should likely be worked upon sooner than later. The Security-Team is happy to provide further guidance on this issue, please just let us know. Thanks.

IMO merging wouldn't be great here - it seems like its current status as a subtask is more representative of the situation (this vuln exists, and T401939 is the task representing the work that will enable it to be fixed IIUC)

Hey, I'll take this opportunity to check in on this task, given it was tentatively rated as a medium+ risk & has now been open for almost 1.5 months (and also hasn't seen any task activity for ~a month).

If moving forward with this is currently blocked on T401939 (which in itself feels like it might be slightly stalled on deciding the name/overall purpose of the new extension), I wonder if it's worth mitigating this in the immediate-term by moving the EmailAuth hooks from WikimediaEvents to mediawiki-config? (If a config patch being present in Gerrit for ~half an hour before it's deployed to production would present a risk of others discovering/exploiting this vuln within that time, maybe https://wikitech.wikimedia.org/wiki/How_to_deploy_code#Emergency_runbook_for_production_config_changes could be used?)

The hook has a lot of dependencies and couldn't be tested in mediawiki-config, which brings its own risks. Let's just get T401939 moving.

Hey, I'll take this opportunity to check in on this task, given it was tentatively rated as a medium+ risk & has now been open for almost 1.5 months (and also hasn't seen any task activity for ~a month).

If moving forward with this is currently blocked on T401939 (which in itself feels like it might be slightly stalled on deciding the name/overall purpose of the new extension), I wonder if it's worth mitigating this in the immediate-term by moving the EmailAuth hooks from WikimediaEvents to mediawiki-config? (If a config patch being present in Gerrit for ~half an hour before it's deployed to production would present a risk of others discovering/exploiting this vuln within that time, maybe https://wikitech.wikimedia.org/wiki/How_to_deploy_code#Emergency_runbook_for_production_config_changes could be used?)

Thanks for the nudge on this, @A_smart_kitten. I spoke with @Tgr and we will plan to move the EmailAuth enforcement into the new WikimediaCustomizations extension. This will probably take a few calendar weeks.

(doing @gerritbot's job for it for @Tgr's patches)

Change #1235867 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[integration/config@master] Zuul: […/WikimediaCustomizations] Add cldr phan dependency

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

Change #1235867 merged by jenkins-bot:

[integration/config@master] Zuul: […/WikimediaCustomizations] Add cldr phan dependency

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

Change #1235551 merged by jenkins-bot:

[operations/mediawiki-config@master] Migrate EmailAuth config, step 1

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

Change #1237276 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[integration/config@master] Zuul: […/WikimediaCustomizations] Add six new dependencies

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

Change #1237276 merged by jenkins-bot:

[integration/config@master] Zuul: […/WikimediaCustomizations] Add six new dependencies

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

Change #1237284 had a related patch set uploaded (by Jforrester; author: Jforrester):

[integration/config@master] Zuul: […/WikimediaCustomizations] Also depend on Echo & EventLogging

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

Change #1237284 merged by jenkins-bot:

[integration/config@master] Zuul: […/WikimediaCustomizations] Also depend on Echo & EventLogging

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

Change #1237285 had a related patch set uploaded (by Jforrester; author: Jforrester):

[integration/config@master] Zuul: […/WikimediaCustomizations] Also depend on EventBus

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

Change #1237285 merged by jenkins-bot:

[integration/config@master] Zuul: […/WikimediaCustomizations] Also depend on EventBus

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

Change #1235557 merged by jenkins-bot:

[mediawiki/extensions/WikimediaCustomizations@master] Add EmailAuth

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

Change #1235573 merged by jenkins-bot:

[mediawiki/extensions/WikimediaEvents@master] Remove EmailAuthHooks, moved to WikimediaCustomizations

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

Change #1235574 merged by jenkins-bot:

[integration/config@master] Zuul: […/WikimediaEvents] Drop LoginNotify dependency, now unused

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

Change #1235552 merged by jenkins-bot:

[operations/mediawiki-config@master] Migrate EmailAuth, step 2

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

Tgr claimed this task.

Works now on closed wikis. @sbassett I think the task can be made public.

(For confirmation, I tried to login to Test-20250911-02 on https://aa.wikipedia.org/ earlier today, and I got an EmailAuth prompt. From my perspective, I also agree that this can be made public now FWICS)

sbassett changed Author Affiliation from N/A to Wikimedia Communities.Mar 13 2026, 4:39 PM
sbassett changed the visibility from "Custom Policy" to "Public (No Login Required)".
sbassett changed the edit policy from "Custom Policy" to "All Users".
sbassett changed Risk Rating from N/A to High.
sbassett moved this task from Watching to Our Part Is Done on the Security-Team board.