Closed
Bug 311892
Opened 19 years ago
Closed 19 years ago
XSS: fixes for bug 311024 and bug 311619 can be circumvented by using window.__proto__
Categories
(Core :: JavaScript Engine, defect, P2)
Tracking
()
RESOLVED
FIXED
mozilla1.8rc1
People
(Reporter: moz_bug_r_a4, Assigned: mrbkap)
References
Details
(Keywords: testcase, verified1.7.13, verified1.8, Whiteboard: [sg:high] xss (splitwindows))
Attachments
(6 files, 4 obsolete files)
587 bytes,
text/html
|
Details | |
611 bytes,
text/html
|
Details | |
167 bytes,
text/html
|
Details | |
450 bytes,
text/html
|
Details | |
4.24 KB,
patch
|
brendan
:
review+
asa
:
approval1.8rc1+
|
Details | Diff | Splinter Review |
2.81 KB,
application/zip
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050916
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051010 Firefox/1.6a1
Please see Bug 311024, Bug 311619 and Bug 310664.
Exploit:
code in subframe:
function a(w) {
with (w) alert(location.href + "\ncookie: " + document.cookie);
}
var f = eval("(" + a.toSource() + ");", window.__proto__);
code in main:
var x = frames[0].f;
frames[0].location = "http://www.yahoo.com/";
x(frames[0]);
I've tested on the hourly build 2005101002.
Reproducible: Always
Steps to Reproduce:
Reporter | ||
Comment 1•19 years ago
|
||
Reporter | ||
Comment 2•19 years ago
|
||
Updated•19 years ago
|
Assignee: dveditz → mrbkap
Status: UNCONFIRMED → NEW
Component: Security → JavaScript Engine
Depends on: splitwindows
Ever confirmed: true
Flags: blocking1.8rc1+
Flags: blocking1.7.13+
Flags: blocking-aviary1.0.8+
Whiteboard: [sg:high] xss (splitwindows)
Assignee | ||
Comment 3•19 years ago
|
||
I'm looking into this. This might end up being a data: url problem (where the
data URL is exposing bad principals).
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → mozilla1.8rc1
Reporter | ||
Comment 4•19 years ago
|
||
(In reply to comment #3)
> I'm looking into this. This might end up being a data: url problem (where the
> data URL is exposing bad principals).
Exploits work without data: url.
Reporter | ||
Comment 5•19 years ago
|
||
Reporter | ||
Comment 6•19 years ago
|
||
Assignee | ||
Comment 7•19 years ago
|
||
Yeah, I should have updated this bug earlier. brendan and I tracked this down
earlier and it has nothing to do with data: URIs and everything to do with eval
not checking its passed-in scopeobj if called directly. I'll have a patch tomorrow.
Reporter | ||
Comment 8•19 years ago
|
||
Reporter | ||
Updated•19 years ago
|
Attachment #199144 -
Attachment is obsolete: true
Assignee | ||
Comment 9•19 years ago
|
||
*** Bug 311962 has been marked as a duplicate of this bug. ***
Assignee | ||
Comment 10•19 years ago
|
||
This is basically the patch from yesterday, but I cleaned it up a bit.
Attachment #199183 -
Flags: review?(brendan)
Assignee | ||
Comment 11•19 years ago
|
||
Comment on attachment 199183 [details] [diff] [review]
wrong file
ffs, wrong file :(
Attachment #199183 -
Flags: review?(brendan)
Assignee | ||
Comment 12•19 years ago
|
||
Attachment #199183 -
Attachment is obsolete: true
Attachment #199184 -
Flags: review?(brendan)
Assignee | ||
Updated•19 years ago
|
Attachment #199183 -
Attachment description: possible fix → wrong file
Comment 13•19 years ago
|
||
Comment on attachment 199184 [details] [diff] [review]
possible fix
> callerVarObj = caller->varobj;
> if (obj != callerVarObj) {
> /* Set fp->varobj too, for the compiler. */
> caller->varobj = fp->varobj = obj;
> setCallerVarObj = JS_TRUE;
> }
This should move down too, per our face-to-face discussion.
>+ if (caller) {
>+ callerScopeChain = caller->scopeChain;
>+ if (scopeobj != callerScopeChain) {
>+ ok = CheckEvalAccess(cx, scopeobj, caller->script->principals);
>+ if (!ok)
>+ goto out;
>+
>+ scopeobj = js_NewObject(cx, &js_WithClass, scopeobj,
>+ callerScopeChain);
>+ if (!scopeobj) {
>+ ok = JS_FALSE;
>+ goto out;
>+ }
>+
>+ /* Set fp->scopeChain too, for the compiler. */
>+ caller->scopeChain = fp->scopeChain = scopeobj;
>+ setCallerScopeChain = JS_TRUE;
>+ }
>+ }
How about a brief comment, talking about change of scope, in addition to
indirect call, requiring this?
/be
Attachment #199184 -
Flags: review?(brendan)
Attachment #199184 -
Flags: review+
Attachment #199184 -
Flags: approval1.8rc1?
Comment 14•19 years ago
|
||
This ought to work. Blake will test and check into the trunk. Thanks.
/be
Attachment #199184 -
Attachment is obsolete: true
Attachment #199267 -
Flags: review+
Attachment #199267 -
Flags: approval1.8rc1?
Assignee | ||
Comment 15•19 years ago
|
||
Comment on attachment 199267 [details] [diff] [review]
better fix mrbkap pointed out we want, and he's right!
This doesn't work. Of course the script has access to window.__proto__, it
wouldn't be able to call eval with that parameter otherwise. The problem is
that searching the parent chain of window.__proto__ finds the outer window.
More thought is needed.
Attachment #199267 -
Flags: review-
Attachment #199267 -
Flags: review+
Attachment #199267 -
Flags: approval1.8rc1?
Comment 16•19 years ago
|
||
Comment on attachment 199184 [details] [diff] [review]
possible fix
clearing approval flag for an obsolete patch
Attachment #199184 -
Flags: approval1.8rc1?
Comment 17•19 years ago
|
||
Comment on attachment 199267 [details] [diff] [review]
better fix mrbkap pointed out we want, and he's right!
Also, caller could be null.
Perhaps this is close, though. It's moving in the right direction to separate
o.eval(s) and eval(s, o) cases.
/be
Attachment #199267 -
Attachment is obsolete: true
Comment 18•19 years ago
|
||
Blake and I talked this over and it seems like we need to make sure we never end
up with objects whose parent is an outer window to be safe against attacks like
this. The DOM objects currently parented at an outer window are
window.__proto__, window.navigator (including prototypes), and window.location
(also including prototypes). So this is getting rather messy, lots of things to
tune by hand to get all this right. Anyone have any ideas on a better approach here?
Comment 19•19 years ago
|
||
(In reply to comment #18)
> Anyone have any ideas on a better approach here?
No :-/. I told blake to fix it this way originally (I warned him, but did he
listen? Nooooooooooooo! ;-)
Sucks. I'll help.
/be
Assignee | ||
Comment 20•19 years ago
|
||
We need to make sure not to regress bug 304284 with these changes.
Assignee | ||
Comment 21•19 years ago
|
||
Brendan caught me when I was hungry and suggested this. This places an
arbitrary limitation on the scope object passed to either eval() or
script.exec() that it not have an innerizable object on its proto chain. The
comment is too brief since I don't want to give too much away in it (though I'm
not sure how much we have to worry about this).
Attachment #199494 -
Flags: review?(brendan)
Comment 22•19 years ago
|
||
Comment on attachment 199494 [details] [diff] [review]
Bah
Nits: ScopeChain, not ScopeObject, and maybe common the "Script.prototype.exec"
strict into a static const char [] explicitly?
/be
Attachment #199494 -
Flags: review?(brendan) → review+
Updated•19 years ago
|
Flags: testcase?
Assignee | ||
Comment 23•19 years ago
|
||
Fix checked into trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 24•19 years ago
|
||
Comment on attachment 199494 [details] [diff] [review]
Bah
This patch fixes a security bug by disallowing bad scoped objects from being
passed into eval.
Attachment #199494 -
Flags: approval1.8rc1?
Assignee | ||
Comment 25•19 years ago
|
||
Comment on attachment 199494 [details] [diff] [review]
Bah
Actually, I'm going to roll this into my monster "security fixer" branch patch.
Attachment #199494 -
Flags: approval1.8rc1?
Assignee | ||
Updated•19 years ago
|
Attachment #199494 -
Flags: approval1.8rc1?
Updated•19 years ago
|
Attachment #199494 -
Flags: approval1.8rc1? → approval1.8rc1+
Comment 27•19 years ago
|
||
tested with firefox 1.5 rc2 on winxp/linux
testcase 1: pass
testcase 2: pass
testcase 3: pass
Keywords: fixed1.8 → verified1.8
Comment 28•19 years ago
|
||
moz_bug_r_a4's tests.
Updated•19 years ago
|
Flags: testcase? → testcase+
Comment 29•19 years ago
|
||
Fixed on the aviary1.0/mozilla1.7 branches by the split-window alternative (bug 316589)
Keywords: fixed-aviary1.0.8,
fixed1.7.13
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/20060215 Firefox/1.0.8, all 3 testcases pass.
Keywords: fixed-aviary1.0.8 → verified-aviary1.0.8
Comment 31•19 years ago
|
||
v ff on 1.7.13 windows/mac 20060221 builds, moz on 1.7.13 windows 20060221
Keywords: fixed1.7.13 → verified1.7.13
Updated•19 years ago
|
Group: security
Updated•17 years ago
|
Flags: in-testsuite+ → in-testsuite?
Updated•12 years ago
|
Flags: in-testsuite? → in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•