Closed Bug 86028 Opened 23 years ago Closed 21 years ago

can redefine focus() and other allAccess functions at another domain

Categories

(Core :: Security: CAPS, defect, P2)

x86
Windows NT
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: dveditz)

Details

(Keywords: csectype-sop, fixed1.4.3, Whiteboard: [sg:fix])

Attachments

(2 files)

I can redefine focus() and several other functions on pages at another domain. I should only be able to call these functions, not redefine them. The redefined function runs with the principal of the attacker, and these functions aren't called with interesting parameters, so this isn't a huge security hole. Here's the line form all.js: pref("capability.policy.default.Window.focus", "allAccess"); I think this should be pref("capability.policy.default.Window.focus.get", "allAccess"); but I couldn't figure out how to test that change.
Attached file demo using blur() (deleted) —
Status: NEW → ASSIGNED
Priority: -- → P4
Target Milestone: --- → mozilla0.9.3
Target is now 0.9.4, Priority P2.
Priority: P4 → P2
Target Milestone: mozilla0.9.3 → mozilla0.9.4
Similar to bug 77503, possible to set window.toString for another domain.
Not critical for 0.9.4, moving to 0.9.5.
Target Milestone: mozilla0.9.4 → mozilla0.9.5
This appears to be fixed now, but the behavior is a little surprising. When I call x.focus(), where x is a window at another domain, XPConnect calls the security manager regarding a call to Window.focus(). When I attempt to redefine x.focus(), the DOM helper at nsDOMClassInfo calls the AddProperty security check, and that's what gets rejected. I think this is the correct behavior. Jesse, can you verify that this bug is fixed and maybe try some variations?
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Verified on 2001-10-10-branch build on WinNT I get the following error on the Js console when I run the attached test case Error: uncaught exception: Permission denied to set property Window.scriptglobals
Status: RESOLVED → VERIFIED
QA Contact: ckritzer → bsharma
This bug appears to have re-emerged.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Keywords: adt1.0.2
Group: security
Keywords: adt1.0.2
Group: security
Keywords: adt1.0.2-
Target Milestone: mozilla0.9.5 → ---
Group: security
Group: security
dang, fell through the cracks!
Assignee: security-bugs → dveditz+bmo
Status: REOPENED → NEW
Flags: blocking1.7?
Whiteboard: [sg:investigate]
Seems like Jesse's suggestion works as expected, patch coming up.
Attachment #144693 - Flags: superreview?(dveditz+bmo)
Attachment #144693 - Flags: review?(caillon)
Comment on attachment 144693 [details] [diff] [review] Only allow getting allAccess functions across domains, don't allow setting them. What is http://lxr.mozilla.org/mozilla/source/calendar/sunbird/app/profile/all.js and does that need the same changes? r=caillon once you figure that out.
Attachment #144693 - Flags: review?(caillon) → review+
Hmm, messed up. Yeah, that should be updated as well, but I think I'd rather file a bug on Sunbird to not duplicate all.js, since that's a mantenance nightmare, something we really really don't want with files like this. There are better ways. I filed bug 238569 on sunbird to not use a copy of all.js. But for now, I don't think we need to worry about that.
What am I missing? If I apply the patch the "demo using blur()" testcase still shows the bug for me.
Whiteboard: [sg:investigate] → [sg:fix]
Hmm, is your Mozilla build finding other prefs that override what you're setting? Does about:config reflect what you've changed in your all.js pref file?
Hmm, I guess we don't show these prefs in about:config at all, so that's not very helpful. I double checked that this does indeed fix the problem for me, I tried in a SeaMonkey debug tree, and in a Firefox release tree, problem solved in both cases. I now get an exception when trying to set window.blur across domains (using the attached testcase).
Those trees were both WinXP builds, tested on Linux (Firefox) as well.
Comment on attachment 144693 [details] [diff] [review] Only allow getting allAccess functions across domains, don't allow setting them. My bad -- misled by the all.js that's still installed under defaults\pref. The active settings from from the [GRE]\greprefs dir. Works just fine sr=dveditz a=dveditz for 1.7
Attachment #144693 - Flags: superreview?(dveditz+bmo)
Attachment #144693 - Flags: superreview+
Attachment #144693 - Flags: approval1.7+
Fix checked in, closing bug.
Status: NEW → RESOLVED
Closed: 23 years ago21 years ago
Resolution: --- → FIXED
Hard coding of the following pref is carried out in Camino. Isn't this influenced? capability.policy.default.Window.blur capability.policy.default.Window.close capability.policy.default.Window.focus http://lxr.mozilla.org/mozilla/source/camino/src/preferences/PreferenceManager.mm#329 (It may still be in other places.)
pinkerton-san, Please check, "capability.policy.default.*"
crot0@infoseek.jp, camino is not setting default prefs, but clearing user set values. Look at the code. By doing so, it is setting everything to the default which is in all.js. If for whatever reason camino does not have this all.js, then the default values would be "sameOrigin" and that is not succeptible to this bug.
(In reply to comment #16) >Hmm, I guess we don't show these prefs in about:config at all, so that's not >very helpful. That behaviour predates my involvement with about:config so I just carried it forward but perhaps you'd like a pref to show those prefs or something ;-)
(In reply to comment #23) > (In reply to comment #16) > >Hmm, I guess we don't show these prefs in about:config at all, so that's not > >very helpful. > That behaviour predates my involvement with about:config so I just carried it > forward but perhaps you'd like a pref to show those prefs or something ;-) I'm fine either way. I don't want people to mess with those pefs too much, so there's some value in not showing them to the users of about:config...
Flags: blocking1.7?
Adding Jon Granrose to CC list to help round up QA resources for verification
Comment on attachment 144693 [details] [diff] [review] Only allow getting allAccess functions across domains, don't allow setting them. a=blizzard
Attachment #144693 - Flags: approval1.4.3? → approval1.4.3+
Keywords: csec-sop
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: