Closed Bug 315004 Opened 19 years ago Closed 19 years ago

Malicious theme can cause arbitrary chrome scripting (theme homepage link in about theme dialog)

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla1.8final

People

(Reporter: pvnick, Assigned: dveditz)

References

()

Details

(Keywords: fixed1.8, regression, Whiteboard: [sg:high] user click req'd)

Attachments

(2 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1

Installing a theme with a malicious homepage url set in the install file can cause arbitrary scripting in the context of chrome with a little bit of user interation.

Reproducible: Always

Steps to Reproduce:
1.Navigate to http://www.greyhatsecurity.org/mozilla/themevuln/9u23ro8haslkdhf.htm and install the theme
2.Right click on the ThemeVuln entry in the themes list
3.Click About ThemeVuln
4.Click Visit Homepage on the dialog

Actual Results:  
An alert will display that says script has been executed from [url of chrome dialog]

Expected Results:  
Homepage urls should be filtered by protocol

This doesn't work when you just click Visit Homepage from the right click menu. The webpage will open, but the opener object won't exist. I don't know why this is, but I do suspect that the newly opened page has some higher rights than a normal javascript: page, perhaps allowing for cross site scripting, although I haven't been able to prove this yet.
Summary: Malicious theme can cause arbitrary chrome scripting → Malicious theme can cause arbitrary chrome scripting (theme homepage link in about theme dialog)
Whiteboard: [sg:fix]
This was regressed by Aaron's fix for bug 302402. Up until then the javascript would open in a new dialog with about:blank permissions (as it does from the Extension manager dialog itself).

The 1.0 behavior should be safe enough, but better not to run any script at all. In fact, better to whitelist this to just http(s). It's fine not to have a homepage, not fine to claim to have one and have it made up on the spot (javascript/data) or embedded in the extension itself (chrome).

A malicious extension can, of course, already do anything. But this code is shared with Themes which users expect to be well behaved.
Assignee: nobody → dveditz
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.8rc2?
Keywords: regression
(In reply to comment #1)
> open in a new dialog

new browser window, I mean.
Dan, didn't we take a fix recently to make theme installation go through the white list for 1.5 to alleviate some of this?
Assignee: dveditz → nobody
whoops, not sure how that happened.
Assignee: nobody → dveditz
(In reply to comment #3)
> Dan, didn't we take a fix recently to make theme installation go through the
> white list for 1.5 to alleviate some of this?

Yes, bug 304931. Whitelisting helps only if AMO reviewers are checking these URLs as part of the approval process and only if users aren't convinced to bypass it because "themes are safe".

We are talking about an uncommon action on an obscure dialog, but some people will click especially if there's a social engineering campaign going on.

There really isn't much risk here, but for the handful of people who would fall for it this is a critical code-execution exploit.
Whiteboard: [sg:fix] → [sg:high] user click req'd
We could simply back out Aaron's one-line patch, but that presumably reintroduces his accessibility thing and also still lets the URL execute script, although only in a safe context.

I prefer limiting the homepage schemes that we link to.
Attachment #201902 - Flags: review?(mconnor)
Attachment #201902 - Flags: approval1.8rc2?
It would be nice to have a more general solution to holes where <label class="text-link"> gets its href from an untrusted source.  I filed bug 315166 for that.
Attachment #201902 - Flags: review?(mconnor) → review+
Attachment #201902 - Flags: approval1.8rc2? → approval1.8rc2+
Status: NEW → RESOLVED
Closed: 19 years ago
Keywords: fixed1.8
Resolution: --- → FIXED
Attached patch use nsURI (obsolete) — Splinter Review
I noticed that the regexp check applied to attributes which can sometimes contain space padding. In this case it's not an issue, since that padding is removed when install.rdf is parsed, but I saw other possible ways of getting around this check, like using "http:|chrome://browser/content/browser.js" as a homepageURL. The only reason this fails is because of the check at:
http://lxr.mozilla.org/seamonkey/source/browser/base/content/browser.js#611

Seems like it's best to be safe and do the URI parsing up front rather than relying on other unrelated code that may change.

Mike Connor said r=him over IRC.
Attachment #202057 - Flags: review+
Attachment #202057 - Flags: approval1.8rc2?
Comment on attachment 202057 [details] [diff] [review]
use nsURI

GIven the earlier approval of this bug - carrying the approval forward to the newly reviewed patch
Attachment #202057 - Flags: approval1.8rc2? → approval1.8rc2+
Attached patch use nsURI v2Splinter Review
Ugh, my previous patch didn't actually solve the issue I mentioned since it still used the original URI. This one works.
Attachment #202057 - Attachment is obsolete: true
Attachment #202060 - Flags: review?(mconnor)
Comment on attachment 202060 [details] [diff] [review]
use nsURI v2

r=me, carrying over a=asa/schrep
Attachment #202060 - Flags: review?(mconnor)
Attachment #202060 - Flags: review+
Attachment #202060 - Flags: approval1.8rc2+
"use nsURI v2" landed on the trunk and the 1.8 branch.
OS: Windows XP → All
Hardware: PC → All
Target Milestone: --- → Firefox1.5
belated blocking flag pixie dust.
Flags: blocking1.8rc2? → blocking1.8rc2+
Blocks: sbb?
testcase-: greyhat is no more.
Flags: testcase-
Group: security
I was never payed for this bug. Was it ever considered for the bounty program?

Paul
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: