Last modified: 2014-07-24 18:39:19 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 T24929, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22929 - Special:Userlogin loads mw gadget scripts - potential security vulnerability
Special:Userlogin loads mw gadget scripts - potential security vulnerability
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Gadgets (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Daniel Kinzler
http://i39.tinypic.com/29c2i2v.png
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-23 14:03 UTC by Thana
Modified: 2014-07-24 18:39 UTC (History)
6 users (show)

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


Attachments

Description Thana 2010-03-23 14:03:04 UTC
The userlogin page does disable the MediaWiki:Common.js and
so on down to the the user's javascript.

However if a user has selected gadgets using specialprefs
and re-visits the userlogin page after logging in (perhaps
to switch to their other-other account :p) a malicious
gadget could go south with the password, just as easily as
it could on the specialprefs page where on-wiki javascript
is disabled for (I thought) the same concern.
Comment 1 Alexandre Emsenhuber [IAlex] 2010-04-04 16:53:02 UTC
Changing product/component to MediaWiki extensions/Gadgets since that's the Gadgets that should check $out->isUserJsAllowed() in wfGadgetsBeforePageDisplay().
Comment 2 Daniel Kinzler 2010-04-06 20:43:54 UTC
$out->isUserJsAllowed() always returns false for the cirtical pages, which is good. But it also returns false if $wgAllowUserJs is false, which is bad. it would mean that Gadgets don't work on wikis with user JS disabled.

Gadgets are more like site JS, not so much like user JS. So, $out->isUserJsAllowed() does not seem to be the right function to call.

The only alternative I see is to add more hard-coded checks in the gadgets extension. Which also sucks. Ideas?
Comment 3 Daniel Kinzler 2010-04-06 21:01:42 UTC
fixed in r64670 by adding hard-coded checks for Special:Userlogin and Special:Resetpass. Leaving a nicer solution for later.
Comment 4 Thana 2010-04-21 07:37:46 UTC
> Gadgets are more like site JS, not so much like user JS. So,
> $out->isUserJsAllowed() does not seem to be the right function to call.

I guess you could add something like $out->isWikiJsAllowed()
which is basically:
>	/* do we load js from a wiki page under any circumstance */
>	return $wgAllowWikiJs && !($title->isCriticalPage());

And $out->isUserJsAllowed() would then become:
>	return $wgAllowUserJs && $out->isWikiJsAllowed();

In any case I was had hoped r64670 would be a candidate
for expedited scapping.
Comment 5 Thana 2010-05-03 01:34:27 UTC
i don't know how new it is, but it just occurred to me that [[Special:Changepassword]] is now a separate page (!) so
we'll want to disable gadgets there too.
Comment 6 p858snake 2010-05-03 01:42:40 UTC
Should we perhaps not have custom js/css on any special pages then white-list
the ones it should be available?
Comment 7 Thana 2010-05-07 05:48:32 UTC
> Should we perhaps not have custom js/css on any special
> pages then white-list the ones it should be available?

that seems a little rash as most of the js i've written and
used has been to enhance the functionality of special pages.

pages which leave the server while already containing any
element like <input name="wpPassword"> should refrain from
loading on-wiki javascript. seems like a no-brainer.

yeah, no solution is perfect, and a password prompt could be
added in post-production to potentially any page byOnloadHook
orCrook but i'd more likely suspect something is amiss than
remit my password for no apparent reason.
Comment 8 OverlordQ 2010-05-07 05:54:49 UTC
I would agree with p858snake, that white listing instead of blacklisting would be a better solution.
Comment 9 Happy-melon 2011-02-05 11:51:01 UTC
Nicer implementation dones in r81524.

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


Navigation
Links