Closed Bug 634983 (CVE-2011-0066) Opened 13 years ago Closed 13 years ago

Use-after-free vulnerability in OBJECT's mObserverList (ZDI-CAN-1033)


(Core :: DOM: Core & HTML, defect)

1.9.1 Branch
Not set



Tracking Status
blocking2.0 --- -
status2.0 --- unaffected
blocking1.9.2 --- .17+
status1.9.2 --- .17-fixed
blocking1.9.1 --- .19+
status1.9.1 --- .19-fixed


(Reporter: bsterne, Assigned: jst)



(Keywords: csectype-uaf, verified1.9.1, verified1.9.2, Whiteboard: [sg:critical?] fixed by 604262)


(1 file)

The following was reported to by ZDI:

ZDI-CAN-1033: Mozilla Firefox OBJECT mObserverList Remote Code Execution Vulnerabililty

-- CVSS ----------------------------------------------------------------
9, (AV:N/AC:L/Au:N/C:P/I:P/A:C)

-- ABSTRACT ------------------------------------------------------------

TippingPoint has identified a vulnerability affecting the following products:

    Mozilla Firefox

-- VULNERABILITY DETAILS -----------------------------------------------

This vulnerability allows remote attackers to execute arbitrary code on vulnerable installations of Mozilla Firefox. User interaction is required to exploit this vulnerability in that the target must visit a malicious page or open a malicious file.

The specific flaw exists within Firefox's handling of observer OBJECTs. If an observer OBJECT is removed from the mObserverList during an iteration of LOOP_OVER_OBSERVERS macro, one can heap spray over |mObserverList.mNext| and change the execution flow. This would allow the attacker to execute arbitrary code under the context of the user running the browser.

Version(s) tested: Firefox 3.6.13
Platform(s) tested: Windows XP SP3

As the OBJECT element implements nsIImageLoadingContent interface it is possible to register custom observer (implementing imgIDecoderObserver) and force our OBJECT removal during e.g.  onStartContainer| callback (other hooks are probably dangerous as well). That would also destroy object's observers linked list, |mObserverList|. If that happens during iteration of LOOP_OVER_OBSERVERS macro one can heap spray over |mObserverList.mNext| and change the execution flow.

From content/base/src/nsObjectLoadingContent.cpp:

// Macro to call some func on each observer.  This handles observers
// removing themselves.
#define LOOP_OVER_OBSERVERS(func_)                                      
    for (ImageObserver* observer = &mObserverList, *next; observer;     
         observer = next) {                                             
      next = observer->mNext;                                           
      if (observer->mObserver) {                                        

-- CREDIT --------------------------------------------------------------

This vulnerability was discovered by:
    * regenrecht
Whiteboard: [sg:critical?]
This looks like it's saying "a Firefox extension could do something critically bad by implementing imgIDecoderObserver". That's not a security flaw in itself.
Looks like on 3.6 untrusted content can call addObserver.  We don't allow that on trunk.
Moving to 1.9.2 branch per comment 2.
Version: Trunk → 1.9.2 Branch
On trunk this was fixed in bug 604262.  We should probably just backport that patch.
And I'd add a dep, but that bug is public, so....
blocking1.9.2: --- → ?
Depends on: 604262
Summary: Use-after-free vulnerability in OBJECT's mObserverList → Use-after-free vulnerability in OBJECT's mObserverList (ZDI-CAN-1033)
Whiteboard: [sg:critical?] → [sg:critical?] fixed by 604262
blocking1.9.1: --- → ?
blocking1.9.2: ? → .15+
status1.9.1: --- → ?
Verified not to be affected on the 1.9.1 nightly.
blocking1.9.1: ? → ---
Assignee: nobody → jst
Al, how did you verify that exactly?  I would expect 1.9.1 to have this problem.
blocking1.9.1: --- → ?
To be clear, if you're using the attached testcase, the build is unaffected if opening the testcase shows an exception in the error console.  If there is no exception, then the build has this bug.
(In reply to comment #8)
> Al, how did you verify that exactly?  I would expect 1.9.1 to have this
> problem.

I believe he ran the testcase from bug 604262 in Firefox 3.5 and didn't see the crash.  Was that an incorrect verification?
Yes.  The testcase in that bug doesn't crash in Firefox 3.6 either, for whatever reason, whereas this bug is clearly present in 3.6, right?
I checked the testcase in bug 604262 as Brandon asked me to do in triage today since I had a 1.9.1 system running at the moment. If that is wrong, we can change the 1.9.1 status. I didn't even look at 1.9.2 since we were in triage and wondering about 1.9.1.
blocking2.0: --- → -
There is no exception from the testcase in 3.5.18pre
blocking1.9.1: ? → .18+
This is fixed for 1.9.2, moving to 1.9.1.
Version: 1.9.2 Branch → 1.9.1 Branch
This is fixed in Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20110420 Firefox/3.5.19 for I see an exception in the error console: 

Error: uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIImageLoadingContent.addObserver]"  nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: :: <TOP_LEVEL> :: line 5"  data: no]

This exception wasn't present in 1.9.19 build 1 (before we fixed this).

BTW, I see the same message in
Alias: CVE-2011-0066
Marking fixed as this landed on all relevant branches, marking fixed.
Closed: 13 years ago
Resolution: --- → FIXED
Group: core-security
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.