Closed Bug 453751 Opened 16 years ago Closed 15 years ago

XUL Garbage Collection Dangling Pointer Code Execution Vulnerability (ZDI-CAN-385)

Categories

(Core :: XUL, defect)

defect
Not set
critical

Tracking

()

RESOLVED FIXED
Tracking Status
status1.9.2 --- unaffected
status1.9.1 --- unaffected

People

(Reporter: dveditz, Assigned: dveditz)

References

Details

(Keywords: fixed1.9.0.7, Whiteboard: [sg:dupe 474456] same as ZDI-CAN-423)

Advisory received from ZDI:
---------------------------

ZDI-CAN-385: Mozilla Firefox XUL Garbage Collection Dangling Pointer Code Execution Vulnerability

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

TippingPoint has identified a vulnerability affecting the following 
products:

    Mozilla Firefox 3.0.x

-- 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.

The specific flaw exists in the browser's handling of a specific series
of XUL JavaScript operations which lead to a cycle in the garbage
collector. This cycle can result in an exploitable memory corruption
allowing attackers to execute arbitrary code under the context of the
current user.

The following example sequence will result in a call to an invalid
address which can be exploited via standard heap fill techniques:

  xulelem = document.getElementById('mainxul');
  tree=document.createElementNS(xulns,'tree');
  tabbox=document.createElementNS(xulns,'tabbox');
  xulelem.appendChild(tabbox);
  content=document.createElementNS(xulns,'content');
  content.appendChild(xulelem);
  menupopup=document.createElementNS(xulns,'menupopup');
  tmptmp = menupopup.cloneNode(false);
  clone = tmptmp;
  tree.appendChild(clone);

mainxul is a <xul> element. After a reload of the page, release will be
called on the tree object multiple times during garbage collection. Each
release will lead to a decrease of the reference counter of the already
freed object. If the reference counter is zero after a decrease, the
same memory region will be deleted again. Object deletion will cause
multiple method calls on the object.

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

This vulnerability was discovered by:
    * Anonymous
When I run code like the above on the latest code and reload several times, I get no crashes, an equal number of nsXULElements created and destroyed, and no missing or extra calls specificially for trees.

It isn't clear from the description what 'the tree object' is or how its references were measured. The code above never inserts the tree into the DOM though, so I assume the nsXULElement is meant. (as no frames or xbl would get applied). However, I don't get any errors even if I do insert the tree either.
Whiteboard: [sg:investigate]
Alias: ZDI-CAN-385
Assignee: nobody → dveditz
Summary: XUL Garbage Collection Dangling Pointer Code Execution Vulnerability → XUL Garbage Collection Dangling Pointer Code Execution Vulnerability (ZDI-CAN-385)
Whiteboard: [sg:investigate] → [sg:needinfo]
blocking1.9.1: --- → ?
status1.9.1: --- → ?
Flags: wanted1.9.0.x?
Flags: blocking1.9.2?
Flags: blocking1.9.0.16?
Whiteboard: [sg:needinfo] → [sg:critical?]
Dan, can you reproduce with their testcase?
On Linux, I don't see any valgrind warnings on either trunk 64-bit debug or 3.0.10 release loading the payload.html/exploit.html cycle.
blocking1.9.1: ? → .5+
Flags: wanted1.9.0.x?
Flags: wanted1.9.0.x+
Flags: blocking1.9.0.16?
Flags: blocking1.9.0.16+
Flags: blocking1.9.2? → wanted1.9.2+
This is fixed in Firefox 3.0.7. I haven't nailed the specific fix range but it's between 2009/2/1 and 2009/2/14 -- I suspect bug 474456 also submitted by ZDI (as ZDI-CAN-423).
blocking1.9.1: .5+ → ---
Depends on: 474456
Flags: wanted1.9.2+
Flags: blocking1.9.0.16+
Keywords: fixed1.9.0.7
Whiteboard: [sg:critical?] → [sg:critical?] fixed by 474456
Yes, this was fixed between the 2009-02-04-05 nightly and the 2009-02-05-06 nightly. bug 474456 is really the only likely fix in that range.

http://bonsai.mozilla.org/cvsquery.cgi?module=AviaryBranchTinderbox&branch=HEAD&date=explicit&mindate=2009-02-04&maxdate=2009-02-05%2005:00&cvsroot=%2Fcvsroot
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Group: core-security
Whiteboard: [sg:critical?] fixed by 474456 → [sg:dupe 474456]
Whiteboard: [sg:dupe 474456] → [sg:dupe 474456] same as ZDI-CAN-423
You need to log in before you can comment on or make changes to this bug.