Skip to content
Memory corruption Disclosed report Advanced CVE-2013-0634CVE-2014-0559CVE-2015-0330

Adobe Flash Player Out-of-Bound Access Vulnerability

A crafted regular expression with many left brackets causes an out-of-bounds read of a stack array in Flash Player, leading to a string with a huge length field. An attacker could use this to defeat ASLR or execute arbitrary code.

hhj4ck Follow

Originally disclosed on HackerOne

Bounty$2,000 View original
  • Fixed in 16 days
  • Paid in 16 days
  • Disclosed after 46 days

I. Summary Adobe Flash Player is prone to a vulnerability which leads to Out-of-Bound memory access memory via carefully crafted regular expression. An attacker can exploit this issue to defeat ASLR protection or even execute arbitrary code in the context of affected application (Internet Explorer, EXCEL...).

II. Description Adobe Flash is a multimedia and software platform used for authoring of vector graphics, animation, games and rich Internet applications (RIAs) that can be viewed, played and executed in Adobe Flash Player.

When constructing a RegExpObject, most part of memory was applied from the heap. While heap overflow may also happen as it is with CVE-2013-0634, CVE-2014-0559, the matching result is stored on the stack. A fixed size int ovector[99] is defined to store the matching index numbers of the target string. A simple line of ActionScript could lead to a crash caused by reading inaccessable memory:

"Venus".match("(((((((((((((((((((((((((((((((((((((((((((((((((?P<G2>)))))))))))))))))))))))))))))))))))))))))))))))))");

For the given regular expression above, ovector[99] will be filled with zeros. Then Flash Player managed to construct an Array containing the matching result recognized by AS3. Since there is a named group G2, the Array will also contain a string index entry (G2) that is filled with substring of the target string. The start address of the substring is calculated as follow: start address of target string + ovector[nameIndex2]. The length of the substring is calulated as: ovector[nameIndex2+1] - ovector[nameIndex*2].

The problem is that nameIndex equals to the number of left brackets inside the given regular expression. As the number of left brackets is fully controlled, ovector[nameIndex2+1] is able to read values out of the stack memory ovector. Flash took mitigations where it checks if the nameIndex is larger than 49, ignoring the fact that nameIndex can be 49 itself. When nameIndex equals to 49, nameIndex2+1 equals to 99, ovector[nameIndex2+1] will point to stack memory out of bound. Normally, ovector[nameIndex2+1] points to the saved EIP under windows and it is a very large value for length field.

This may result in returning a string with a fake length field with enormous value to the AS3 interface. Advanced Heap Fengshui techniques may even allow an attacker build workable exploit via such string to access arbitrary memory.

poc and its source code are attached.

III. Impact Out-of-Bound Access

IV. Reference It has got assigned as CVE-2015-0330. https://helpx.adobe.com/security/products/flash-player/apsb15-04.html https://code.google.com/p/chromium/issues/detail?id=450198

V. Credit Wen Guanxing from Venustech ADLAB is credited for this vulnerability.

The original report as published on HackerOne, by hhj4ck. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely an off-by-one check: the code rejects a group index larger than 49 but allows exactly 49, so the index calculation reads one element past the fixed-size array.

Impact

An attacker could defeat ASLR or potentially execute arbitrary code in the context of the affected application, though the text notes that advanced heap techniques may be needed for a working exploit.

What the attacker needed

Flash Player is installed

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Flash Player stores match positions in a fixed-size list on the stack. Too many groups make it read past the list and use a nearby value as a length, creating an oversized string. This can crash the program or let an attacker access memory they should not.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by hhj4ck

View all

20 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.