Monorail Project: project-zero Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 3 users
Status: Fixed
Owner:
Email to this user bounced
Closed: Jan 2015
Cc:



Sign in to add a comment
File Reference Object Constructor Does Not Clear Destructor
Project Member Reported by natashenka@google.com, Oct 30 2014 Back to list
When a file reference object is created, the type and user data of the object are set, but the destructor function is not cleared. This means that if the file reference object is constructed with a 'this' object that already has a destructor, it will get called on the wrong type of data when the object is destroyed, leading to native method calls on an object of the wrong type, which is usually exploitable.

A sample SWF is attached, it works as follows:

1) Pressing the full blue square on the left of the attached SWF will cause a FileReferenceList to be created. After it is created, the FileReference constructor is overwritten as follows:

var b = flash.net;
b.FileReference = q;

This code overwrites the FileReference constructor with method q.

2) browse() is then called on the FileReferenceList, causing a file selection dialog to be spawned

3) If the user selects a file, the function q will be called to construct a FileReference to hold the file the user selected. q is defined as:

this.f = flash.display.BitmapData
var c = new this.f(1000, 1000, true, 1000)

Note that Flash CS3 doesn't build this code as expected, and I had to manually correct a few actions in the SWF.

Calling this method causes the this object passed into the constructor to be initialized as type BitmapData, which sets the BitmapData destructor. After the method is exited, the browse function sets the type of the returned object to be a FileReferenceObject, but doesn't clear the destructor.

4) A crash will occur when GC happens, the button on the right of the poc can be used to trigger GC with limited reliability if the crash doesn't happen right away.

POC SWF is attached. This issue is marked as moderate, as FileReferenceList.browse always requires user interaction.
 
fdestroy9.swf
2.7 KB Download
Project Member Comment 1 by natashenka@google.com, Nov 3 2014
Adding some extra info.

This issue occurred in Flash 15.0.0.189 in FF and IE. I could not get the issue to work in Chrome.

POC code is attached, but note that this code needs to be modified after it is compiled for the SWF to work. To get the working SWF:

1) Compile the attached code, and disassemble the output SWF using flasm (http://www.nowrap.de/flasm)

flasm Untitled-1.swf -d > test.flm

2) Open test.flm, and find function2 q (). Delete the following four actions (the last four actions in the function):

        setRegister r:2
        pop
        push r:this
        trace

So that q is defined as:

    function2 () (r:1='this')
      function2 q () (r:1='this')
        push 'in FR costructor', r:this, '__flavorStr'
        getMember
        add
        trace
        push r:this
        trace
        push r:this, 'f', 'flash'
        getVariable
        push 'display'
        getMember
        push 'BitmapData'
        getMember
        setMember
        push r:this, 'f'
        getMember
        trace
        push 1000, TRUE, 1000, 1000, 4, r:this, 'f'
        newMethod
      end // of function q

3) Recompile the SWF: flasm -a test.flm

test.as
1.2 KB Download
Untitled-1.fla
46.5 KB Download
Comment 2 by cevans@google.com, Nov 4 2014
This bug is subject to a 90 day disclosure deadline. If 90 days elapse without a broadly available patch, then the bug report will automatically become visible to the public.

Comment 3 by cevans@google.com, Nov 4 2014
Labels: -Reported-2014-Oct-30 Reported-2014-Nov-3
Comment 4 by cevans@google.com, Nov 4 2014
Labels: Id-3120
Comment 5 by cevans@google.com, Jan 10 2015
Labels: CVE-2015-0305
Comment 6 by cevans@google.com, Jan 14 2015
Labels: Fixed-2015-Jan-13
Fixed: http://helpx.adobe.com/security/products/flash-player/apsb15-01.html
Comment 7 by cevans@google.com, Jan 14 2015
Status: Fixed
Comment 8 by cevans@google.com, Jan 26 2015
Labels: -Restrict-View-Commit
Issue has now been fixed for 7+ days, so opening up for public view.
Comment 9 by cevans@google.com, Apr 10 2015
Labels: -Severity-Moderate Severity-Medium
Sign in to add a comment