Page MenuHomePhabricator

OAuth /identify endpoint does not check whether consumer is approved
Closed, ResolvedPublic

Description

Steps to reproduce (on vagrant with oauth role on):

  • visit oauth hello world app
  • authorize
  • disable hello world app
  • verify identity

Event Timeline

Also, the API disallows actions when the user is blocked and $wgBlockDisablesLogin is on, but /identify does not.

Patch:

Patch:

-					if ( !$localUser || !$localUser->isLoggedIn() ) {
+					if ( !$localUser || !$localUser->isLoggedIn() || $localUser->isLocked() ) {
 						throw new MWOAuthException( 'mwoauth-invalid-authorization-invalid-user' );

Instead of throwing 'mwoauth-invalid-authorization-invalid-user' for the added condition, it would make more sense to throw 'mwoauth-invalid-authorization-blocked-user'. Also, you're not checking the $wgBlockDisablesLogin && ->isBlocked() case.

Fixed:


(Blocked users should be handled in the auth layer, as in T129738, but no harm in double-checking.)

Fixed:

Looks good, +1.

@Tgr, I will can deploy this on Monday if you've not already done so.

dpatrick claimed this task.

23:07 dapatrick: Deployed patch for T148600 to wmf22

You guys can go ahead and announce and release this now.

Tgr removed dpatrick as the assignee of this task.
Tgr added a subscriber: demon.

Thanks! (And sorry for forgetting to respond. I wanted to deploy it and then got distracted.)
Let's keep it open until it's merged in master (and the task can be made public), though.

@demon do you want to make a proper security release for this? IMO it is significant enough to warrant a backport (/identify was added in 1.23 so that means 1.23, 1.26 and 1.27) but not severe enough for the whole security release process with the pre-announcement and whatnot. If the old branches will also get new releases when 1.28 is released, IMO we can just merge to master and backport and be done with it.

Thanks! (And sorry for forgetting to respond. I wanted to deploy it and then got distracted.)
Let's keep it open until it's merged in master (and the task can be made public), though.

@demon do you want to make a proper security release for this? IMO it is significant enough to warrant a backport (/identify was added in 1.23 so that means 1.23, 1.26 and 1.27) but not severe enough for the whole security release process with the pre-announcement and whatnot. If the old branches will also get new releases when 1.28 is released, IMO we can just merge to master and backport and be done with it.

Since it's not bundled I say let's do that. Push to master + all supported branches and send an announcement to the usual places.

Tgr claimed this task.
Tgr changed the visibility from "Custom Policy" to "Public (No Login Required)".
Tgr changed Security from Software security bug to None.

Merged as https://gerrit.wikimedia.org/r/#/c/317733/ (I probably should have made the task public first) and backported.

Change 318228 had a related patch set uploaded (by Gergő Tisza):
SECURITY: check stage and user blocked/locked status in /identify

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

Change 318228 merged by jenkins-bot:
SECURITY: check stage and user blocked/locked status in /identify

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