Page MenuHomePhabricator

CVE-2021-35197: Blocked users should not be able to issue purges (action=purge)
Closed, ResolvedPublicSecurity

Description

I blocked a misbehaving bot on-wiki and it was still able to send purges via the API until its IP range was blocked through varnish. I expect that an account that is sitewide blocked is unable to issue purges via the API or index.php.

Event Timeline

Fix to PurgeAction is very trivial... Just remove the requiresUnblock override.

Api is similarly easy, just re-use the code from ApiTag

		// Fail early if the user is sitewide blocked.
		$block = $user->getBlock();
		if ( $block && $block->isSitewide() ) {
			$this->dieBlocked( $block );
		}

Patch incoming.

Plan is to get this out this week (well, tomorrow). So this patch will apply fine to 1.35 and 1.36 straight off.

For 1.31, the isSitewide wasn't added till 1.33... The change to PurgeAction is fine and can be applied as is.

Anyone got any preferred solution to this?

We could just use any block... Which seems probably the simplest way forward, as 1.31 has no concept of these other "types" of blocks, and is due to become EOL this month... But is being extended for one more quarter to meet our LTS overlap requirements.

		// Fail early if the user is blocked.
		$block = $user->getBlock();
		if ( $block ) {
			$this->dieBlocked( $block );
		}
Reedy renamed this task from Blocked users should not be able to issue purges (action=purge) to CVE-2021-35197: Blocked users should not be able to issue purges (action=purge).Jun 22 2021, 1:00 PM

+1 on that approach from me as well.

Change 701143 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_31] SECURITY: Prevent blocked users from purging pages

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

Change 701146 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_35] SECURITY: Prevent blocked users from purging pages

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

Change 701150 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_36] SECURITY: Prevent blocked users from purging pages

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

Change 701153 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@master] SECURITY: Prevent blocked users from purging pages

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

Change 701143 merged by jenkins-bot:

[mediawiki/core@REL1_31] SECURITY: Prevent blocked users from purging pages

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

Change 701146 merged by jenkins-bot:

[mediawiki/core@REL1_35] SECURITY: Prevent blocked users from purging pages

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

Change 701150 merged by jenkins-bot:

[mediawiki/core@REL1_36] SECURITY: Prevent blocked users from purging pages

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

Reedy changed the visibility from "Custom Policy" to "Public (No Login Required)".Jun 23 2021, 4:56 PM
Reedy changed the edit policy from "Custom Policy" to "All Users".

Change 701153 merged by jenkins-bot:

[mediawiki/core@master] SECURITY: Prevent blocked users from purging pages

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

DannyS712 added subscribers: IN, taavi, Zabe and 2 others.