Last modified: 2014-10-04 00:06:41 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 T71623, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 69623 - Graph extension security review
Graph extension security review
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Other (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Chris Steipp
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-15 19:23 UTC by Yuri Astrakhan
Modified: 2014-10-04 00:06 UTC (History)
1 user (show)

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


Attachments

Description Yuri Astrakhan 2014-08-15 19:23:19 UTC
Please sec review https://www.mediawiki.org/wiki/Extension:Graph
Comment 1 Chris Steipp 2014-08-15 21:25:42 UTC
So far, I've found two issues in the Vega library makes this extension undeployable on public wikis:

* Privacy violation with unrestricted xhr loads Anyone can put Something like <graph>{"width": 0, "height": 0, "data": [{"url": "//www.whatever.com/track.php"}] }</graph> and vega happily loads the url without user interaction.

* Stored XSS through the "filter" config. You can put arbitrary javascript in in the filter test, and it gets executed.

On a wiki where only users with interface editing rights can edit the graph config, this is fine as it doesn't do anything beyond what raw html can do. But are these issues fixable, if you're intending to deploy this on public wikis?
Comment 2 Chris Steipp 2014-09-14 21:37:34 UTC
The new vega library is an improvement, but I think there's a flaw in how they did the domain comparison:

return vg.config.domainWhiteList.some(function(d) {
   return d === domain ||
     domain.lastIndexOf("."+d) === (domain.length - d.length - 1);
});

If "."+d doesn't exist in domain, lastIndexOf will return -1. So if d.length and domain.length are exactly the same length (but different), then -1 === -1, so the invalid domain would get through. I think you want to just take the substring of d which is the last domain.length characters, and then do a strict comparison.
Comment 3 Yuri Astrakhan 2014-09-14 21:49:19 UTC
thanks, good catch, fixing :)
Comment 4 Yuri Astrakhan 2014-09-15 00:57:21 UTC
Graph ext patch: https://gerrit.wikimedia.org/r/#/c/160369/

Upstream pull request: https://github.com/trifacta/vega/pull/217
Comment 5 Chris Steipp 2014-09-15 16:18:49 UTC
Ok, the rest of it should be safe.

I would certainly encourage you to make the extension default to safe mode, and using the local wiki as the default whitelisted domain, so an admin has to explicitly enable insecure features. But since you're anxious to get this deployed, we can put it on wmf wikis as is, as long as we always configure the whitelist.
Comment 6 Yuri Astrakhan 2014-09-17 22:52:00 UTC
Chris, thanks, and the defaults have always been exactly as you describe - extension sets wgEnableGraphParserTag=false and wgGraphDataDomains=[] by default.
Comment 7 Chris Steipp 2014-10-03 23:27:43 UTC
(In reply to Yuri Astrakhan from comment #6)
> Chris, thanks, and the defaults have always been exactly as you describe -
> extension sets wgEnableGraphParserTag=false and wgGraphDataDomains=[] by
> default.

Sorry, what I meant was in js/graph.js, you have 

if (vg.config.domainWhiteList) {
	vg.config.safeMode = true;
}

I'm not sure any js engines interpret [] == false, but something like this would feel safer to me (more fail safe):

vg.config.safeMode = true;
if ( vg.config.domainWhiteList === false ) {
	vg.config.safeMode = false;
}
Comment 8 Yuri Astrakhan 2014-10-04 00:06:41 UTC
Thx, please take a look at https://gerrit.wikimedia.org/r/#/c/164708/

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


Navigation
Links