Closed
Bug 323634
Opened 19 years ago
Closed 19 years ago
Unprivileged access to window.controllers is possible
Categories
(Core :: XUL, defect)
Core
XUL
Tracking
()
RESOLVED
FIXED
mozilla1.8.1beta2
People
(Reporter: ecfbugzilla, Assigned: neil)
References
Details
(Keywords: fixed1.7.13, fixed1.8.1, verified1.8.0.2, Whiteboard: [sg:low] [rft-dl])
Attachments
(6 files, 1 obsolete file)
(deleted),
text/html
|
Details | |
(deleted),
text/html
|
Details | |
(deleted),
text/html
|
Details | |
(deleted),
patch
|
jst
:
superreview-
dveditz
:
approval-aviary1.0.8+
dveditz
:
approval1.7.13+
dveditz
:
approval1.8.0.2+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bzbarsky
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
dveditz
:
approval-aviary1.0.8-
dveditz
:
approval1.7.13-
bzbarsky
:
approval-branch-1.8.1-
dveditz
:
approval1.8.0.2-
|
Details | Diff | Splinter Review |
Currently content scripts can access window.controllers. They can't retrieve a controller - no permission to create a wrapper fro nsIController, that's fine. But they still can remove controllers and install their own controllers. The controller list isn't reset when the window's location is changed so this way a content script can create effects that will survive a location change. Same-origin policy still applies so the damage is limited but this still can be abused in several ways.
First of all a content script can call controllers.removeControllerAt(0) several times - this will break keyboard scrolling and copying in the current tab. The only way to fix this is to close the tab and to open a new one.
You can also misuse this e.g. to forbid copying of text by installing your own controller as the first in the list. You could also make sure a certain part of the document is selected every time supportsCommand for cmd_copy is called while still returning false - that way the buffer will always contain the text you want.
You can spy on the user though this isn't very useful - you only get the commands and you can't get any information on their context unless they are called inside your domain.
Finally you could trap the user inside your domain, any supportsCommand call executed outside the domain will bring you back (it seems this call is always executed when the page starts loading).
Three test cases are coming.
Solutions:
Best solution IMHO would be to limit access to window.controllers to privileged scripts. I don't know why unprivileged scripts should be able to change the controller list. It might be reasonable to make controllers.commandDispatcher an exception, XUL pages might need it (do they?).
Other solution would be to reset the controller list on every location change. I don't think this is desirable though.
Reporter | ||
Comment 1•19 years ago
|
||
Reporter | ||
Comment 2•19 years ago
|
||
Reporter | ||
Comment 3•19 years ago
|
||
Comment 4•19 years ago
|
||
So... can we block access to controllers altogether? If not, which parts of the interface do we need to block off?
That is, what can we lock down without breaking remote XUL any more than it already is, and what do we actually need to lock down? Once we have that info, we should make some decisions.
Flags: blocking1.9a1?
Flags: blocking1.8.1?
Flags: blocking1.8.0.2?
Assignee | ||
Comment 5•19 years ago
|
||
(In reply to comment #0)
>It might be reasonable to make controllers.commandDispatcher
>an exception, XUL pages might need it (do they?).
XUL elements set it but it's only a copy of document.commandDispatcher anyway.
Assignee | ||
Comment 6•19 years ago
|
||
(In reply to comment #4)
>So... can we block access to controllers altogether?
Sounds good to me.
Reporter | ||
Comment 7•19 years ago
|
||
Yes, given that controllers.commandDispatcher isn't really usable anyway (always null in my tests, unlike document.commandDispatcher) - I think access to the whole thing should be blocked.
Comment 8•19 years ago
|
||
Actually, it looks like window.controllers is replaceable, so we can't just block it. So we get to do it the hard way. ;)
Comment 9•19 years ago
|
||
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #210208 -
Flags: superreview?(jst)
Attachment #210208 -
Flags: review?(sfraser_bugs)
Updated•19 years ago
|
Flags: blocking1.7.13?
Flags: blocking-aviary1.0.8?
Priority: -- → P1
Summary: Unprivileged access to window.controllers is possible → [FIX]Unprivileged access to window.controllers is possible
Target Milestone: --- → mozilla1.9alpha
Comment 10•19 years ago
|
||
Comment on attachment 210208 [details] [diff] [review]
Proposed patch
A better alternative would IMO be to give the XULControllers a classinfo object that doesn't claim the class has the flag nsIClassInfo::DOM_OBJECT, that way XPConnect wouldn't even let content code wrap the object. This way we don't need to make sure the caps prefs are in sync with the interface etc.
sr- based on that, but if others think it's useful to have this contollable through prefs, then I could rethink this...
Attachment #210208 -
Flags: superreview?(jst) → superreview-
Comment 11•19 years ago
|
||
No, the no-prefs approach sounds great. I was worried about the sync thing myself. I assume chrome script won't be affected?
Comment 12•19 years ago
|
||
I don't know how to do the classinfo stuff offhand and won't have time this week to figure it out. On the other hand we should probably get this fixed for 1.0.8 and such... Can someone take a stab at it, please?
Assignee: bzbarsky → nobody
Status: ASSIGNED → NEW
Keywords: helpwanted
Priority: P1 → --
Summary: [FIX]Unprivileged access to window.controllers is possible → Unprivileged access to window.controllers is possible
Target Milestone: mozilla1.9alpha → ---
Reporter | ||
Comment 13•19 years ago
|
||
Not quite sure about this, and I also don't have a possibility to test right now. But this should be it?
Assignee | ||
Comment 14•19 years ago
|
||
This is trev's patch with a change to nsIDOMClasInfo.idl to make it run.
I guess that only the nsXULControllers.cpp change is necessary for branches.
I also used diff -u8 for ease of review ;-)
Attachment #210225 -
Attachment is obsolete: true
Attachment #210242 -
Flags: superreview?
Attachment #210242 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 15•19 years ago
|
||
Comment on attachment 210242 [details] [diff] [review]
Patch (tested)
Stupid bugzilla ate my superreview request :-( See previous comment for details.
Attachment #210242 -
Flags: superreview? → superreview?(jst)
Reporter | ||
Comment 16•19 years ago
|
||
Right, I mixed up the paths, that change to nsIDOMClassInfo.h is necessary as well of course.
Neil, you can merge the #ifdef blocks (remove #endif + #ifdev MOZ_XUL) for both changes in nsDOMClassInfo.cpp as well.
Comment 17•19 years ago
|
||
Comment on attachment 210242 [details] [diff] [review]
Patch (tested)
Yeah, that'd do it. sr=jst (with Wladimir's suggested changes).
Attachment #210242 -
Flags: superreview?(jst) → superreview+
Comment 18•19 years ago
|
||
Comment on attachment 210242 [details] [diff] [review]
Patch (tested)
r=bzbarsky. On branch we should probably just take the nsXULControllers.cpp change, yeah.
Attachment #210242 -
Flags: review?(bzbarsky) → review+
Comment 19•19 years ago
|
||
reassigning to Boris since he's done the patches for this. Are you going to land this on the trunk?
Assignee: nobody → bzbarsky
Comment 20•19 years ago
|
||
Actually, that's Neil and Trev's patch... But I'm happy to land it on the trunk.
Assignee: bzbarsky → neil
Keywords: helpwanted
Comment 21•19 years ago
|
||
Fixed on trunk.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 22•19 years ago
|
||
Attachment #210208 -
Attachment is obsolete: true
Attachment #210546 -
Flags: branch-1.8.1?(jst)
Attachment #210546 -
Flags: approval1.8.0.2?
Attachment #210546 -
Flags: approval1.7.13?
Attachment #210546 -
Flags: approval-aviary1.0.8?
Attachment #210208 -
Flags: review?(sfraser_bugs)
Updated•19 years ago
|
Attachment #210208 -
Attachment is obsolete: false
Comment 23•19 years ago
|
||
Comment on attachment 210546 [details] [diff] [review]
Branch-safe patch
a=timr for drivers.
Attachment #210546 -
Flags: approval1.7.13?
Attachment #210546 -
Flags: approval1.7.13+
Attachment #210546 -
Flags: approval-aviary1.0.8?
Attachment #210546 -
Flags: approval-aviary1.0.8+
Updated•19 years ago
|
Flags: blocking1.9a1?
Flags: blocking1.9a1+
Flags: blocking1.8.1?
Flags: blocking1.8.1+
Flags: blocking1.8.0.2?
Flags: blocking1.8.0.2+
Flags: blocking1.7.13?
Flags: blocking1.7.13+
Flags: blocking-aviary1.0.8?
Flags: blocking-aviary1.0.8+
Comment 24•19 years ago
|
||
Comment on attachment 210546 [details] [diff] [review]
Branch-safe patch
a=timr for drivers
Attachment #210546 -
Flags: approval1.8.0.2? → approval1.8.0.2+
Comment 25•19 years ago
|
||
*** Committing to MOZILLA_1_7_BRANCH...
new revision: 1.27.16.1; previous revision: 1.27
*** Committing content/xul/document/src/nsXULControllers.cpp on AVIARY_1_0_1_20050124_BRANCH
new revision: 1.27.30.1; previous revision: 1.27
*** Committing content/xul/document/src/nsXULControllers.cpp on MOZILLA_1_8_0_BRANCH
new revision: 1.28.36.1; previous revision: 1.28
Comment 26•19 years ago
|
||
This caused bug 326248. :(
Updated•19 years ago
|
Whiteboard: [sg:low]
Comment 27•19 years ago
|
||
Comment on attachment 210208 [details] [diff] [review]
Proposed patch
This is what we want for the old branches, a=dveditz
Attachment #210208 -
Flags: approval1.8.0.2+
Attachment #210208 -
Flags: approval1.7.13+
Attachment #210208 -
Flags: approval-aviary1.0.8+
Comment 28•19 years ago
|
||
Comment on attachment 210546 [details] [diff] [review]
Branch-safe patch
Turned out to be not so branch-safe (bug 326248)
Attachment #210546 -
Flags: approval1.8.0.2-
Attachment #210546 -
Flags: approval1.8.0.2+
Attachment #210546 -
Flags: approval1.7.13-
Attachment #210546 -
Flags: approval1.7.13+
Attachment #210546 -
Flags: approval-aviary1.0.8-
Attachment #210546 -
Flags: approval-aviary1.0.8+
Comment 29•19 years ago
|
||
Checked-in the original CAPS fix ("proposed patch" attachment 210208 [details] [diff] [review]) to the old branches (aviary101/moz17/moz180) and backed out the "branch-safe patch".
Keywords: qawanted
Whiteboard: [sg:low] → [sg:low] qawanted: verify fix
Comment 30•19 years ago
|
||
v.fixed on 1.0.1 Aviary branch with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.13) Gecko/20060220 Firefox/1.0.8, testcases all appear to work ok.
Keywords: fixed-aviary1.0.8 → verified-aviary1.0.8
Updated•19 years ago
|
Attachment #210546 -
Flags: approval-branch-1.8.1?(jst) → approval-branch-1.8.1-
Updated•19 years ago
|
Flags: testcase+
Updated•19 years ago
|
Whiteboard: [sg:low] qawanted: verify fix → [sg:low] qawanted: verify fix[rft-dl]
Updated•19 years ago
|
Keywords: fixed1.8.0.2 → verified1.8.0.2
Updated•19 years ago
|
Keywords: qawanted
Whiteboard: [sg:low] qawanted: verify fix[rft-dl] → [sg:low] [rft-dl]
Updated•18 years ago
|
Group: security
Updated•18 years ago
|
Target Milestone: --- → mozilla1.8.1beta2
Comment 31•18 years ago
|
||
Can we get a patch for the 1.8 branch here, e.g., at least whatever we took on 1.8.0?
Comment 32•18 years ago
|
||
This is fixed on the 1.8 branch, by the checkin for bug 326248.
Keywords: fixed1.8.1
Updated•18 years ago
|
Flags: in-testsuite+ → in-testsuite?
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
You need to log in
before you can comment on or make changes to this bug.
Description
•