Last modified: 2011-11-28 23:40:24 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 T34616, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32616 - action=ajax bypasses read permissions
action=ajax bypasses read permissions
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: High normal (vote)
: 1.18.0 release
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-23 23:25 UTC by Tim Starling
Modified: 2011-11-28 23:40 UTC (History)
5 users (show)

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


Attachments
Proposed patch (795 bytes, patch)
2011-11-24 03:25 UTC, Tim Starling
Details

Description Tim Starling 2011-11-23 23:25:00 UTC
action=ajax requests are dispatched to the relevant function without any read permission checks being done. This can lead to data leakage on private wikis.

A quick survey of the many extensions which use action=ajax suggests that few, if any, have anticipated this security issue. This includes the popular CategoryTree extension, which can be used to obtain lists of page titles. The ExtTab and InlineEditor extensions appear to allow disclosure of the full text of the page. 

In the core, most former action=ajax uses have been migrated to api.php, however SpecialUpload::ajaxGetExistsWarning still remains, which allows confirmation of the existence of a given file upload, given the name. A dictionary attack could lead to significant data leakage. Previous versions of MediaWiki may have more severe vulnerabilities.

I suggest denying all access to action=ajax for users without read permissions. If there are any extensions that really need to provide data from a private wiki to logged-out users, api.php can be used instead. It provides an opt-in model for bypassing read permissions.
Comment 1 Tim Starling 2011-11-24 03:25:04 UTC
Created attachment 9541 [details]
Proposed patch
Comment 2 Brion Vibber 2011-11-24 16:30:39 UTC
Is the "!in_array( 'read', User::getGroupPermissions( array( '*' ) )" a necessary logical component or an optimization to skip over the User::isAllowed() call in the common case of non-restricted sites?

Might want to indicate if it's a shortcut in a comment so it doesn't get removed by some clever refactorer later. :)
Comment 3 Tim Starling 2011-11-24 22:53:57 UTC
The code was copied from ApiMain. It was introduced there in r62544 based on code from ApiOpenSearch r62540. It was described as an optimisation in the commit message on r62540.
Comment 4 Antoine "hashar" Musso (WMF) 2011-11-26 17:53:00 UTC
The patch has been reviewed and sent to Sam Reed to prepare the new release.
I think we agreed to release the new version on monday or tuesday because of thanksgiving in the US.
Comment 5 Sam Reed (reedy) 2011-11-28 23:40:24 UTC
Fixed in trunk with r104505, 1.17 in r104506, 1.18 in r104508 and 1.18wmf1 in r104509

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


Navigation
Links