arbitrary code execution via sidebar

VERIFIED FIXED

Status

()

Firefox
Security
--
critical
VERIFIED FIXED
12 years ago
6 years ago

People

(Reporter: bugzilla, Assigned: mconnor)

Tracking

({fixed-aviary1.0.2, testcase})

Trunk
fixed-aviary1.0.2, testcase
Points:
---
Bug Flags:
blocking-aviary1.0.2 +
blocking-aviary1.5 +
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [sg:fix] CAN-2005-0402)

Attachments

(6 attachments, 1 obsolete attachment)

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.6) Gecko/20050223 Firefox/1.0.1
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b2) Gecko/20050302 Firefox/1.0+

Sidebar allows an attacker to link to the privileged content (such as
about:config) and run arbitrary code on the content.

Reproducible: Always

Steps to Reproduce:
1. Bookmark testcase as sidebar panel
2. Click links in order

Actual Results:  
about:config is loaded. "browser.startup.homepage" will be overwritten.
Further attacks can be done successfully.

Expected Results:  
Link to the privileged content should be blocked.
(Reporter)

Comment 1

12 years ago
Created attachment 176152 [details]
testcase
(Reporter)

Comment 2

12 years ago
Created attachment 176153 [details]
add sidebar panel page

Use this page to add the testcase to bookmark panel.
(Reporter)

Comment 3

12 years ago
Sorry for spam...

Steps to Reproduce (corrected):
1. Bookmark testcase as sidebar panel
2. Select "Sidebar Attack Test" from your bookmark and load it in the sidebar
3. Click links in order
(Reporter)

Comment 4

12 years ago
Created attachment 176250 [details]
testcase 2

This test case will erase localstore.rdf file in your profile directory.
(Reporter)

Comment 5

12 years ago
Created attachment 176251 [details]
add sidebar panel page 2

Use this page to add the testcase 2 to bookmark panel.
> 1. Bookmark testcase as sidebar panel

Is this a Firefox-specific feature?  I don't see a way to do this in Mozilla...
(Reporter)

Comment 7

12 years ago
(In reply to comment #6)
>> 1. Bookmark testcase as sidebar panel
> 
> Is this a Firefox-specific feature?  I don't see a way to do this in Mozilla...

This "add sidebar tab" feature works in Mozilla Suite too. But to do so, you
have to open sidebar at least once with new profile. Maybe known bug.

In Mozilla Suite, the testcase failed to load about:config. Expected security
error appears in JavaScript Console. This is a Firefox-specific bug.
Assignee: dveditz → firefox
Status: UNCONFIRMED → NEW
Component: Security: General → General
Ever confirmed: true
Flags: blocking-aviary1.1?
Product: Core → Firefox
QA Contact: general
There also seems to be no "security" component for Firefox, so putting in
General, I guess....

This sounds like a pretty critical issue to me, though.
(Assignee)

Updated

12 years ago
Assignee: firefox → mconnor
(Assignee)

Comment 9

12 years ago
Created attachment 176416 [details] [diff] [review]
add security check to web panel links

Because we special-cased web panel links here, we skipped any existing security
checks, and just loaded stuff directly.  Yay us.  This patch handles both
testcases properly, with proper errors in the JS console.

Bonus: By forcing javascript: links to execute in the sidebar, sidebars like 
http://sidebar.cnn.com/browsers/ns6/cnn.com.expanded.html will now work.
Attachment #176416 - Flags: review?(bugs)
Comment on attachment 176416 [details] [diff] [review]
add security check to web panel links

r=ben@mozilla.org
Attachment #176416 - Flags: review?(bugs) → review+
Flags: blocking-aviary1.0.2?
Whiteboard: [sg:fix]
(Assignee)

Updated

12 years ago
Attachment #176416 - Flags: approval-aviary1.0.2?
Comment on attachment 176416 [details] [diff] [review]
add security check to web panel links

Any way to fix this via an update to the two .js files, not a full app update?

/be
Attachment #176416 - Flags: approval-aviary1.0.2? → approval-aviary1.0.2+
mconnor, thanks for patching.

/be
Flags: blocking-aviary1.1?
Flags: blocking-aviary1.1+
Flags: blocking-aviary1.0.2?
Flags: blocking-aviary1.0.2+
(Assignee)

Comment 13

12 years ago
Not specifically the two js files, but both are contained in browser.jar and we
can just install a new copy over top with an XPI.  Zipped, the current
browser.jar is 261k on Windows.

Comment 14

12 years ago
yeah, that sounds like a reasonable solution provided the firefox user has write
permission to the installation directory.
(Reporter)

Comment 15

12 years ago
Created attachment 176441 [details]
testcase 3 - "Plug-ins Finder"

"data:" URL example.
(Assignee)

Comment 16

12 years ago
Hmm, the downside of the XPI route is the old "running 'sudo firefox' nukes
bookmarks and friends" problem that hit people the last time we issued an XPI
security release.  If we go down that route, we need to have a significant
warning in the instructions for *nix boxes.
Comment on attachment 176416 [details] [diff] [review]
add security check to web panel links

Er... Can't sites change what document.location returns by setting up Js object
setters, etc?  As in, don't you need a sprinkling of XPCNativeWrapper in this
code?  Specifically:

1)  You want to get the ownerDocument from a wrapper (say change |wrapper| to
    also expose ownerDocument).
2)  You then want to wrap the document before getting .location.
3)  You probably also want to wrap the location object itself...

Marking review-, since this patch doesn't actually prevent a sufficiently
malicious site from exploiting this code...
Attachment #176416 - Flags: review+ → review-
(Assignee)

Comment 18

12 years ago
Created attachment 176487 [details] [diff] [review]
patch with more wrapper-fu
Attachment #176416 - Attachment is obsolete: true
(Assignee)

Updated

12 years ago
Attachment #176487 - Flags: approval-aviary1.0.2?

Updated

12 years ago
Component: General → Security
QA Contact: general → firefox
I assume these flags were group-moved to 1.0.3, we really want this in 1.0.2 I
think.
Flags: blocking-aviary1.0.2+

Comment 20

12 years ago
Yes, we want this in 1.0.2
Flags: blocking-aviary1.0.3+

Comment 21

12 years ago
Comment on attachment 176487 [details] [diff] [review]
patch with more wrapper-fu

a=asa for 1.0.2 landing.
Attachment #176487 - Flags: approval-aviary1.0.3? → approval-aviary1.0.2+
Comment on attachment 176487 [details] [diff] [review]
patch with more wrapper-fu

setting review flags
Attachment #176487 - Flags: superreview?(dveditz)
Attachment #176487 - Flags: review?(bzbarsky)
Attachment #176487 - Flags: review?(bzbarsky) → review+
Comment on attachment 176487 [details] [diff] [review]
patch with more wrapper-fu

sr=dveditz
bz says he gave a verbal r= to this patch when it was first posted, just never
made it into the bug.
Attachment #176487 - Flags: superreview?(dveditz) → superreview+
Fix checked in to trunk and aviary-1.0.1 branch
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Keywords: fixed-aviary1.0.2
Resolution: --- → FIXED
(Reporter)

Comment 25

12 years ago
Verified on Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b2)
Gecko/20050317 Firefox/1.0+

JavaScript Console says "Security Error: Content at
https://bugzilla.mozilla.org/attachment.cgi?id=176250 may not load or link to
about:config."
this also looks good using 2005031707-1.0.2 firefox bits on linux fc3 with the 2
test cases.
Keywords: testcase
looks good on Windows 2005-03-17-06-aviary1.0.1
Status: RESOLVED → VERIFIED
Reference id: CAN-2005-0402
Whiteboard: [sg:fix] → [sg:fix] CAN-2005-0402
Advisory published: http://www.mozilla.org/security/announce/mfsa2005-31.html
Group: security

Comment 30

12 years ago
(In reply to comment #2)
> Created an attachment (id=176153) [edit]
> add sidebar panel page

The following errors go out to JavaScrip Console when this test case is executed. 

Error: makeURI is not defined
Source File: chrome://browser/content/contentAreaUtils.js
Line: 108

Windows XP SP1
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317
Firefox/1.0.2

Updated

11 years ago
Flags: testcase+

Updated

10 years ago
Flags: in-testsuite+ → in-testsuite?
You need to log in before you can comment on or make changes to this bug.