Bug 634983 (CVE-2011-0066)

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




6 years ago
18 days ago


(Reporter: bsterne, Assigned: jst)


({csectype-uaf, verified1.9.1, verified1.9.2})

1.9.1 Branch
csectype-uaf, verified1.9.1, verified1.9.2
Dependency tree / graph

Firefox Tracking Flags

(blocking2.0 -, status2.0 unaffected, blocking1.9.2 .17+, status1.9.2 .17-fixed, blocking1.9.1 .19+, status1.9.1 .19-fixed)


(Whiteboard: [sg:critical?] fixed by 604262)


(1 attachment)



6 years ago
The following was reported to security@mozilla.org 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


6 years ago
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.
Created attachment 513198 [details]
Testcase showing the problem (won't crash or anything)
Blocks: 634986

Comment 4

6 years ago
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: --- → ?
status1.9.2: --- → wanted
status2.0: --- → unaffected
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: ? → ---
status1.9.1: ? → unaffected


6 years ago
Assignee: nobody → jst


6 years ago
status1.9.1: unaffected → ?
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.

Comment 10

6 years ago
(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.


6 years ago
blocking2.0: --- → -
There is no exception from the testcase in 3.5.18pre
blocking1.9.1: ? → .18+
status1.9.1: ? → wanted
status1.9.2: wanted → .17-fixed

Comment 14

6 years ago
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 :: https://bug634983.bugzilla.mozilla.org/attachment.cgi?id=513198&t=DRUAWvZtUR :: <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
Keywords: verified1.9.1, verified1.9.2


6 years ago
status1.9.1: wanted → .19-fixed
Alias: CVE-2011-0066

Comment 16

6 years ago
Marking fixed as this landed on all relevant branches, marking fixed.
Last Resolved: 6 years ago
Resolution: --- → FIXED
Group: core-security
Keywords: csectype-uaf
You need to log in before you can comment on or make changes to this bug.