Last Comment Bug 576616 - (CVE-2010-3178) cross-site information disclosure via modal calls
(CVE-2010-3178)
: cross-site information disclosure via modal calls
Status: RESOLVED FIXED
[sg:high]
:
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: unspecified
: x86 Windows XP
: -- major (vote)
: ---
Assigned To: Blake Kaplan (:mrbkap)
:
Mentors:
http://eaea.sirdarckcat.net/weirdyes....
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-02 13:08 PDT by Eduardo Vela N
Modified: 2015-10-16 11:47 PDT (History)
11 users (show)
dveditz: in‑testsuite?
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
beta3+
.11+
.11-fixed
.14+
.14-fixed


Attachments
Proposed fix (2.65 KB, patch)
2010-07-22 15:36 PDT, Blake Kaplan (:mrbkap)
jst: review+
Details | Diff | Splinter Review
For 1.9.2 (4.42 KB, patch)
2010-08-17 17:28 PDT, Blake Kaplan (:mrbkap)
jst: review+
christian: approval1.9.2.11+
Details | Diff | Splinter Review
merged to 1.9.1 (4.83 KB, patch)
2010-09-29 15:25 PDT, Daniel Veditz [:dveditz]
mrbkap: review+
christian: approval1.9.1.14+
Details | Diff | Splinter Review

Description Eduardo Vela N 2010-07-02 13:08:13 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.86 Safari/533.4
Build Identifier: 

This site:
http://eaea.sirdarckcat.net/weirdyes.php?loc=http://google.com/#//0x.lv/xss.php?plain_xss=

Shows a vulnerability that allows an attacker to access some objects it shouldn't (eg. the location object).

1.- Setting the URL of a frame to javascript:LockExecution();InterestingObject;
2.- LockExecution can be alert() or XHR.send(), or XML.open(), etc..
3.- The attacker then sets the frame's location to the target website.
4.- When the target page finishes loading, the LockExecution function is unlocked, and a new window is created leaking a reference to InterestingObject to the page.
5.- interestingObject.toString() is called by firefox and its result is written in the hosting page.

Reproducible: Always

Steps to Reproduce:
1. Visit http://eaea.sirdarckcat.net/weirdyes.php?loc=http://google.com/#//0x.lv/xss.php?plain_xss=
2. google.com redirects to www.google.com (poc)
3. eaea.sirdarckcat.net is able to read window.location
Actual Results:  
eaea.sirdarckcat.net is able to read window.location

Expected Results:  
eaea.sirdarckcat.net shouldn't able to read window.location
Comment 1 Eduardo Vela N 2010-07-02 13:41:13 PDT
If an attacker is able to use a reference to an object, he can do:

javascript:function X(){};X.prototype=document;x=new X;x.toString=document.constructor.prototype.__lookupGetter__('cookie');LockingFunction();x

and x should return the cookie..
Comment 2 Blake Kaplan (:mrbkap) 2010-07-22 15:36:42 PDT
Created attachment 459615 [details] [diff] [review]
Proposed fix
Comment 3 Johnny Stenback (:jst, jst@mozilla.com) 2010-07-22 15:51:52 PDT
Comment on attachment 459615 [details] [diff] [review]
Proposed fix

r=jst if you do the same in nsJSContext::ExecuteScript().
Comment 4 Blake Kaplan (:mrbkap) 2010-07-22 16:54:39 PDT
http://hg.mozilla.org/mozilla-central/rev/ae3ea4a4320f
Comment 5 Blake Kaplan (:mrbkap) 2010-07-22 17:27:38 PDT
http://hg.mozilla.org/mozilla-central/rev/93c41e057f90 as well.
Comment 6 Reed Loden [:reed] (use needinfo?) 2010-07-22 17:37:00 PDT
Can we get a roll-up patch for the branches?
Comment 7 Blake Kaplan (:mrbkap) 2010-08-17 17:28:15 PDT
Created attachment 466865 [details] [diff] [review]
For 1.9.2
Comment 8 Blake Kaplan (:mrbkap) 2010-08-17 17:46:49 PDT
Comment on attachment 466865 [details] [diff] [review]
For 1.9.2

(sorry, wrong branch request -- I'll need another patch for the 1.9.1 branch)
Comment 9 Daniel Veditz [:dveditz] 2010-08-23 15:16:50 PDT
Can we get a testcase into the bug and into the tree?

A testcase that shows cookie capture would be good, too.
Comment 10 Eduardo Vela N 2010-08-23 17:12:43 PDT
The cookie attack scenario depends on the ability of the attacker to get a reference to an object.. What happens apparently is that when my code is ran, the object's principal is still eaea.sirdarckcat.net, so www.google.com does not have access to eaea.sirdarckcat.net.

So bottom line is:
 - All the references I have are in eaea.sirdarckcat.net's context
 - My code is executing in www.google.com context

so my code cant access the objects.. :(

I could try to get the reference, it may be possible by simply getting a reference to window.top (if top is www.google.com) or something like that..

Greetings!!
Comment 11 Eduardo Vela N 2010-08-23 17:13:35 PDT
Oh, on the other hand, you could use the original demo

http://eaea.sirdarckcat.net/weirdyes.php?loc=http://google.com/#//0x.lv/xss.php?plain_xss=


as a testcase.
Comment 12 christian 2010-08-27 10:07:47 PDT
Comment on attachment 466865 [details] [diff] [review]
For 1.9.2

a=LegNeato for 1.9.2.10. Please only land this on the default branch, *not* a relbranch
Comment 13 Daniel Veditz [:dveditz] 2010-08-30 10:25:06 PDT
(In reply to comment #1)
> If an attacker is able to use a reference to an object, he can do:

but the location object is special because HTML/DOM grandfathers in certain legitimate cross-origin uses of it. If you can get arbitrary object access I'd agree with "sg:high", but if all we're leaking is the location that bumps it down to sg:moderate. Depending on the site it could be a bad leak (single-signon tokens in the URL?) but in general it's more of a privacy problem.

moz_bug_r_a4: I'm assuming the location object is the only thing affected, but the patch looks generic. Maybe you can turn this into more damage.

Blake: do we need this on the 1.9.1 branch too?
Comment 14 Eduardo Vela N 2010-08-30 20:48:26 PDT
The cookie of 0x.lv is dom=0x.lv

Test URL: http://0x.lv/xss.php?100&frame_xss=htmledit.html&html_xss=%3Ciframe%20src=//www.google.com%3E%3C/iframe%3E

The content of the script is:
<iframe src="http://www.google.com/webhp"></iframe>
<script>
ci=setInterval(function(){
   if(frames.length){
      clearInterval(ci);
      frames[0].location='javascript:alert(1);function M(){this.toString=this.__lookupGetter__("cookie");};M.prototype=document;({toString:[].join,length:1,0:new M});';
   }
},1);
</script>

The cookie I get is 0x.lv's and not google.com's..

So the statement of comment 1 is wrong, getting a reference is not enough to exploit it, I think you are right.

> but the location object is special because HTML/DOM grandfathers in certain
> legitimate cross-origin uses of it.
makes sense.

> If you can get arbitrary object access I'd agree with "sg:high", but if all 
> we're leaking is the location that bumps it down to sg:moderate.
I agree, I originally thought this was more serious.

> Depending on the site it could be a bad leak (single-signon tokens in the
> URL?)
right, that's why it's good its fixed.

> moz_bug_r_a4: I'm assuming the location object is the only thing affected, but
> the patch looks generic. Maybe you can turn this into more damage.
I'm looking forward to that!

Greetings!!
Comment 15 Eduardo Vela N 2010-08-30 20:50:35 PDT
oh now that I re-read my last PoC it's over-complicated.. I was originally testing with top.frames[0], anyways..
Comment 16 moz_bug_r_a4 2010-09-04 09:38:22 PDT
Just for the record, the first testcase in this bug now works on trunk because
there is a bug about Location object's principal (bug 593602).
Comment 17 Daniel Veditz [:dveditz] 2010-09-05 22:01:47 PDT
Let's get an automated regression test for this. Could've saved us some potential embarrassment had moz_bug_r_a4 not noticed this got "unfixed" before we released an advisory for it (see bug 593602).
Comment 18 Daniel Veditz [:dveditz] 2010-09-29 15:25:10 PDT
Created attachment 479591 [details] [diff] [review]
merged to 1.9.1
Comment 19 Daniel Veditz [:dveditz] 2010-09-29 15:29:35 PDT
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/fb800ed2a4b1
Comment 20 Daniel Veditz [:dveditz] 2010-09-29 15:57:00 PDT
Checked-in presuming clegnitto's retroactive approval.
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/06ad1b12aef9
Comment 21 Daniel Veditz [:dveditz] 2010-09-29 16:08:29 PDT
bustage fix
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/620daaba9c3a

Note You need to log in before you can comment on or make changes to this bug.