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

RESOLVED FIXED

Status

()

Core
Security: CAPS
P2
minor
RESOLVED FIXED
16 years ago
4 years ago

People

(Reporter: Jesse Ruderman, Assigned: dveditz)

Tracking

({csectype-sop, fixed1.4.3})

Trunk
x86
Windows NT
csectype-sop, fixed1.4.3
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [sg:fix])

Attachments

(2 attachments)

536 bytes, text/html
Details
3.90 KB, patch
Christopher Aillon (sabbatical, not receiving bugmail)
: review+
dveditz
: superreview+
Christopher Aillon (sabbatical, not receiving bugmail)
: approval1.4.3+
dveditz
: approval1.7+
Details | Diff | Splinter Review
(Reporter)

Description

16 years ago
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.
(Reporter)

Comment 1

16 years ago
Created attachment 38551 [details]
demo using blur()
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
(Reporter)

Comment 3

16 years ago
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
Last Resolved: 16 years ago
Resolution: --- → FIXED

Comment 6

16 years ago
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 → ---

Updated

15 years ago
Keywords: adt1.0.2
(Assignee)

Updated

15 years ago
Group: security
Keywords: adt1.0.2
(Assignee)

Updated

15 years ago
Group: security
Keywords: adt1.0.2-
Target Milestone: mozilla0.9.5 → ---
Group: security
Group: security
(Assignee)

Comment 8

13 years ago
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.
Created attachment 144693 [details] [diff] [review]
Only allow getting allAccess functions across domains, don't allow setting them.

Updated

13 years ago
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.
Fair enough.
(Assignee)

Comment 14

13 years ago
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.
(Assignee)

Comment 18

13 years ago
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
Last Resolved: 16 years ago13 years ago
Resolution: --- → FIXED

Comment 20

13 years ago
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.)

Comment 21

13 years ago
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.

Comment 23

13 years ago
(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...

Updated

13 years ago
Flags: blocking1.7?
(Assignee)

Comment 25

13 years ago
Adding Jon Granrose to CC list to help round up QA resources for verification
Attachment #144693 - Flags: approval1.4.3?
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: fixed1.4.3
(Reporter)

Updated

4 years ago
Keywords: csec-sop
You need to log in before you can comment on or make changes to this bug.