Closed Bug 284627 Opened 15 years ago Closed 15 years ago

arbitrary code execution via sidebar

Categories

(Firefox :: Security, defect, critical)

defect
Not set
critical

Tracking

()

VERIFIED FIXED

People

(Reporter: u115577, Assigned: mconnor)

Details

(Keywords: fixed-aviary1.0.2, testcase, Whiteboard: [sg:fix] CAN-2005-0402)

Attachments

(6 files, 1 obsolete file)

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.
Attached file testcase
Attached file add sidebar panel page
Use this page to add the testcase to bookmark panel.
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
Attached file testcase 2
This test case will erase localstore.rdf file in your profile directory.
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...
(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: firefox → mconnor
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]
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+
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.
yeah, that sounds like a reasonable solution provided the firefox user has write
permission to the installation directory.
"data:" URL example.
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-
Attachment #176416 - Attachment is obsolete: true
Attachment #176487 - Flags: approval-aviary1.0.2?
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+
Yes, we want this in 1.0.2
Flags: blocking-aviary1.0.3+
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
Closed: 15 years ago
Resolution: --- → FIXED
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
(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
Flags: testcase+
Flags: in-testsuite+ → in-testsuite?
You need to log in before you can comment on or make changes to this bug.