New issue
Advanced search Search tips
Starred by 1 user
Status: Fixed
Owner:
Closed: Feb 2016
Cc:



Sign in to add a comment
Adobe Flash: Type Confusion in TextField Constructor
Project Member Reported by natashenka@google.com, Jan 14 2016 Back to list
There is a type confusion vulnerability in the TextField constructor in AS3. When a TextField is constructed, a generic backing object is created and reused when subsequent TextField objects are created. However, if an object with the same ID has already been created in the SWF, it can be of the wrong type. The constructor contains a check for this situation, though, and throws an exception and sets a flag to shut down the player if this occurs. The backing object is then set to be of type TextField to avoid any modifications that have been made on it by the constructor from causing problems if it is used as an object of its original type elsewhere in the player.

However, if the exception thrown by the constructor is caught, the exception handler can create another TextField object, and since the type of the generic backing object has been changed, an object of the wrong type is now backing the TextField, which makes it possible to set the pointers in the object to integer values selected by the attacker.

The PoC swf for this issue needs to be created by hand. The original swf code is:

try{

     var t = new TextField();

} catch(e:Error){

     var t2 = new TextField();
     t2.gridFitType;

}

Then in the swf, a backing object of a different type with ID 0xfff9 is created, which causes the first constructor call to fail, and the second to cause type confusion.

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.
 
textfield3.swf
4.6 KB Download
Project Member Comment 1 by natashenka@google.com, Feb 17 2016
Labels: -Restrict-View-Commit CVE-2016-0985
Status: Fixed
Fixed in Feb update
Comment 2 by athmi...@gmail.com, Mar 31 2016
Hello Natalie, 

Here you say "The PoC swf for this issue needs to be created by hand". Does this mean that you modified the file is generated using this code?

try{

     var t = new TextField();

} catch(e:Error){

     var t2 = new TextField();
     t2.gridFitType;

}

This code generates an swf file that is very similar to yours but it does not trigger the vulnerability. I cannot seem to identify exactly what is special about your PoC. If possible, can you shed some light regarding this? 
Project Member Comment 3 by natashenka@google.com, Mar 31 2016
Yeah, triggering this issue requires compiling the swf and modifying it. Basically, it changes the ID of an object in the swf to a reserved value (0xfff9), which causes a problem. I recommend compiling the PoC and then diffing it with the crashing one to see where the changes were made.
Comment 4 by athmi...@gmail.com, Apr 1 2016
Thank you for the reply. That was very helpful.
Sign in to add a comment