Bug 505988 (CVE-2009-3374)

It's possible to access a double-wrapped object's underlying privileged object




8 years ago
8 years ago


(Reporter: moz_bug_r_a4, Assigned: mrbkap)


({verified1.9.0.15, verified1.9.1})

Windows XP
verified1.9.0.15, verified1.9.1
Dependency tree / graph
Bug Flags:
blocking1.9.2 +
blocking1.9.0.15 +
wanted1.9.0.x +
wanted1.8.1.x -
in-testsuite +

Firefox Tracking Flags

(status1.9.2 beta1-fixed, blocking1.9.1 .4+, status1.9.1 .4-fixed)


(Whiteboard: [sg:critical])


(1 attachment, 1 obsolete attachment)



8 years ago
XPCVariant::VariantDataToJS() unwraps double-wrapped objects even when it

Comment 1

8 years ago
Created attachment 390218 [details]
testcase - Arbitrary code execution
Component: Security → XPConnect
QA Contact: toolkit → xpconnect
Whiteboard: [sg:crit]
blocking1.9.1: --- → ?
Flags: blocking1.9.2+
Priority: -- → P1
Whiteboard: [sg:crit] → [sg:critical]
Do we need this on 1.9.0? This definitely block 1.9.1.x but not sure if it's for .2 or .3.
blocking1.9.1: ? → needed
status1.9.1: --- → wanted
Flags: wanted1.9.0.x?
Yes, this affects Firefox 3.0.x
Assignee: nobody → mrbkap
Flags: wanted1.9.0.x? → wanted1.9.0.x+
blocking1.9.1: needed → .3+
Flags: blocking1.9.0.13?

Comment 4

8 years ago
Created attachment 390374 [details] [diff] [review]
Work in progress

This patch fixes this bug, but I'm seeing spurious errors in the livemark service with it applied.

Comment 5

8 years ago
Created attachment 390563 [details] [diff] [review]
Proposed fix

The spurious errors were due to my incorrectly backing out bug 384632.
Attachment #390374 - Attachment is obsolete: true
Attachment #390563 - Flags: superreview?(jst)
Attachment #390563 - Flags: review?(bzbarsky)
The blocking1.9.0.13+ is a soft block, we'll take it on the 1.9.0 branch when it gets fixed on the 1.9.1 branch.
Flags: blocking1.9.0.13? → blocking1.9.0.13+
Comment on attachment 390563 [details] [diff] [review]
Proposed fix

Seems ok.
Attachment #390563 - Flags: review?(bzbarsky) → review+


8 years ago
Attachment #390563 - Flags: superreview?(jst) → superreview+


8 years ago
Keywords: checkin-needed
Last Resolved: 8 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Flags: in-testsuite+
This caused a bunch of password manager test failures along these lines:

/test/test_basic_form_observer_autofillForms.html | Checking foundLogins is array - got "Object", expected "Array"
82398 ERROR TEST-UNEXPECTED-FAIL | /tests/toolkit/components/passwordmgr
82407 ERROR TEST-UNEXPECTED-FAIL | /tests/toolkit/components/passwordmgr/test/test_basic_form_observer_foundLogins.html | Checking foundLogins is array - got "Object", expected "Array"

and various other stuff, but I suspect most of it is due to the tests that got the errors above failing and due to the fact that the tests in this dir all depend on each other(!).  Which means you have to run with


to test reasonably; just running a single test won't work.  And if you run a single test and then the whole dir that will also fail...

It's not clear to me whether this is a problem in the test or in the patch yet, but for now backed out to get the tree green: http://hg.mozilla.org/mozilla-central/rev/c1ab8650e0ce
Resolution: FIXED → ---
This is a P1 1.9.2 blocker, thus blocking Firefox 3.6a1 - any ETA on re-landing or analysing why this caused so many test failures?
Justin: can you take a second to see if you can figure out why the PW Mgr tests failed?
So, this was a  test added for bug 492153. That bug added notifications for when pwmgr does things when processing a form. The notification's subject is a nsIPropertyBag, with various properties set. One of these is a JS array of relevant logins.

The notification is built in nsLoginManager.js's _notifyFoundLogins() as

  propbag.setPropertyAsInterface("foundLogins", foundLogins.concat());

And the test is checking

  propbag.get("foundLogins").constructor.name, "Array", "Checking foundLogins is array");

I'd guess that either something is going wrong in setting the property (I think there's some XPCOM magic being used to shove an Array into an nsISupports param), or that checking .constructor.name isn't a reliable thing to do. [ISTR Firebug having run into similar problems.]

mrbkap, does this help?


8 years ago
Depends on: 508471


8 years ago
Depends on: 508483
I need to know if this needs to land for alpha 1 in order to make 1.9.2; it's literally holding our alpha production and branch at this point.

Please respond ASAP.

Comment 14

8 years ago
(In reply to comment #13)
> I need to know if this needs to land for alpha 1 in order to make 1.9.2; it's
> literally holding our alpha production and branch at this point.
> Please respond ASAP.

Sorry, I should have commented here... The reason for the MochiTest failures are now blocking this bug. Once those bugs land, this one should be able to as well.
This probably needs to wait for the next round of releases rather than trying to rush this into
blocking1.9.1: .3+ → .4+
Flags: blocking1.9.0.14+ → blocking1.9.0.15+

Comment 16

8 years ago


8 years ago
Last Resolved: 8 years ago8 years ago
Resolution: --- → FIXED


8 years ago
Depends on: 509583
Mass change: adding fixed1.9.2 keyword

(This bug was identified as a mozilla1.9.2 blocker which was fixed before the mozilla-1.9.2 repository was branched (August 13th, 2009) as per this query: http://is.gd/2ydcb - if this bug is not actually fixed on mozilla1.9.2, please remove the keyword. Apologies for the bugspam)
Keywords: fixed1.9.2
status1.9.2: --- → beta1-fixed
Keywords: fixed1.9.2
This is blocking and (code freeze Sept 22!). We probably need a branch patch that includes any regression fixes, or we need branch approval requests on those bugs too.
Whiteboard: [sg:critical] → [sg:critical][needs branch patch]


8 years ago
Attachment #390563 - Flags: approval1.9.1.4?
Attachment #390563 - Flags: approval1.9.0.15?
Comment on attachment 390563 [details] [diff] [review]
Proposed fix

Approved for and, a=dveditz
Attachment #390563 - Flags: approval1.9.1.4?
Attachment #390563 - Flags: approval1.9.1.4+
Attachment #390563 - Flags: approval1.9.0.15?
Attachment #390563 - Flags: approval1.9.0.15+

Comment 20

8 years ago

Checking in js/src/xpconnect/src/xpcprivate.h;
/cvsroot/mozilla/js/src/xpconnect/src/xpcprivate.h,v  <--  xpcprivate.h
new revision: 1.286; previous revision: 1.285
Checking in js/src/xpconnect/src/xpcvariant.cpp;
/cvsroot/mozilla/js/src/xpconnect/src/xpcvariant.cpp,v  <--  xpcvariant.cpp
new revision: 1.32; previous revision: 1.31
Checking in js/src/xpconnect/tests/mochitest/Makefile.in;
/cvsroot/mozilla/js/src/xpconnect/tests/mochitest/Makefile.in,v  <--  Makefile.in
new revision: 1.12; previous revision: 1.11
RCS file: /cvsroot/mozilla/js/src/xpconnect/tests/mochitest/test_bug384632.html,v
Checking in js/src/xpconnect/tests/mochitest/test_bug384632.html;
/cvsroot/mozilla/js/src/xpconnect/tests/mochitest/test_bug384632.html,v  <--  test_bug384632.html
initial revision: 1.1
status1.9.1: wanted → .4-fixed
Keywords: fixed1.9.0.15


8 years ago
Whiteboard: [sg:critical][needs branch patch] → [sg:critical]
Verified fixed for with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2009092805 GranParadiso/3.0.15pre (.NET CLR 3.5.30729). 

Verified fixed for 1.9.1 with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20090924 Shiretoko/3.5.4pre (.NET CLR 3.5.30729).
Keywords: fixed1.9.0.15 → verified1.9.0.15, verified1.9.1
Alias: CVE-2009-3374
This testcase doesn't run on the 1.8 branch because I get NS_ERROR_NOT_IMPLEMENTED from the document.setUserData() call. Is there some way to get the double unwrapping to happen on that branch? Or should we just not bother because that branch is missing so many wrappers anyway?

Comment 23

8 years ago
It seems that this bug is a regression from bug 384632 and that bug is not
fixed on the 1.8 branch and thus the 1.8 branch is not affected by this bug.

Comment 24

8 years ago
Created attachment 408197 [details]
testcase 2 - Arbitrary code execution

This testcase uses XSLTProcessor.setParameter().  This testcase works on
fx-3.5.3/fx-3.0.14 and is fixed on fx-3.5.4/fx-3.0.15.  On SeaMonkey-1.1.18, 
the same behavior as fx-3.5.4/fx-3.0.15.
Group: core-security
Flags: wanted1.8.1.x-
You need to log in before you can comment on or make changes to this bug.