Closed Bug 286629 Opened 19 years ago Closed 19 years ago

Allow untrusted script access to Components.lookupMethod

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: ted, Assigned: jst)

References

Details

Attachments

(3 files)

Components.lookupMethod allows script to get the "original" implementation of a
method.  In XBL that is bound to an untrusted DOM, this method is not available,
so webpages can break XBL bindings by redefining necessary methods such as
createElement.

This can be seen in particular in the Flashblock extension, which attaches an
XBL binding to embed tags, and uses document.createElement, which means
arbitrary pages can redefine that function and break the binding, thus letting
Flash through.
This change lets anyone call Components.lookupMethod() from anywhere. I can't
see any harm in permitting that, so I'm proposing we check this in.
Attachment #177799 - Flags: superreview?(brendan)
Attachment #177799 - Flags: review?(dveditz)
Comment on attachment 177799 [details] [diff] [review]
Let anyone call Components.lookupMethod

r=dveditz

If we're going to make changes here, how 'bout allowing isSuccessCode too? No
reason to block it, and could prevent errors in code that doesn't expect a
non-zero success.
Attachment #177799 - Flags: review?(dveditz) → review+
Comment on attachment 177799 [details] [diff] [review]
Let anyone call Components.lookupMethod

>+    static const char* allowed[] = { "lookupMethod", nsnull};

Uber-nit: space after nsnull before the closing brace?

I agree with Dan, why not expose isSuccessCode too?  Gotta stick up for
NS_COMFALSE (blech! ;-) here.

/be
Attachment #177799 - Flags: superreview?(brendan) → superreview+
Do we still perform the correct security checks at some point? (I'm not up on
whether we do the method security checks at invocation or reference).
(In reply to comment #4)
> Do we still perform the correct security checks at some point? (I'm not up on
> whether we do the method security checks at invocation or reference).

The security check happens in XPCWrappedNative::CallMethod(), which is invoked
no matter how you get at a JS function for a XPConnect implemented
method/getter/setter on a native wrapper, so it's all good AFAIKT (and testing
verified this too).
Attachment #177799 - Flags: approval1.8b2?
Comment on attachment 177799 [details] [diff] [review]
Let anyone call Components.lookupMethod

a=chofmann
Attachment #177799 - Flags: approval1.8b2? → approval1.8b2+
FIXED.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Depends on: 693733
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: