Skip to content
Memory corruption Disclosed report Advanced CVE-2014-0564

Adobe Flash Player Out-of-Bound Read/Write Vulnerability

A malformed regular expression in Adobe Flash Player causes an out-of-bounds read/write of stack and heap memory during RegExp compilation. An attacker could use this to leak memory addresses and bypass ASLR, or with advanced heap manipulation, achieve arbitrary code execution.

hhj4ck Follow

Originally disclosed on HackerOne

Bounty$5,000 View original
  • Fixed in 4 months
  • Paid in 4 months
  • Disclosed after 5 months

I. Summary Adobe Flash Player is prone to a vulnerability which leads to Out-of-Bound access of memory. During the compilation of a malformed regular expression, relevant operations would cause Out-of-Bound Read/Write of stack and heap memory. Successful exploits may allow an attacker to gain access to sensitive memory addresses information in the context of the user running the affected application, which could be used to bypass ASLR protection. Advanced Heap Fengshui techniques may even allow an attacker to rewrite stack or heap variable, resulting in arbitrary code execution in the context of the user running the affected application.

II. Description Building RegExp Object via a malformed regular expression, such as:

var exp:RegExp=new RegExp("(?:(VenusTech)(?2){0,1020}(b))?)");

will normally cause memory crash because of Out-of-Bound read of stack memory. RegExp object used a fixed size stack variable cworkspace during the compilation. Since cworkspace can get filled up by repetitions of forward references, expanding cworkspace mechanism is introduced. After a potential stack overflow is detected, the original cworkspace will be replaced by a block of newly created heap block that is large enough to hold everything. Pointers related to cworkspace will also be updated to newly created heap memory block.

The problem is, the updating of cworkspace pointers happens inside a recursively called function. A local variable of cworkspace pointer is not synchronizing upon different calls.

Further operations try to copy the content of the original cworkspace, beginning with the out-of-date local pointer of cworkspace and ending up with a pointer of newly created heap block. Since the local variable of cworkspace is still a stack pointer, it is normally in lower address than the newly created heap memory. The copying operations will read values out of bound of the stack.

With advanced technique (such as Heap Fengshui), stack can adjacent to another block of heap memory controlled by the attacker. Copying operations may allow the modification to the length field of Vector.<int>, gaining attacker the ability to read and write arbitrary memory address. Or else, one could simply use Out-of-Bound read to gain the address of ActionScript objects or OS structs.

III. Impact Out-of-Bound Read/Write

IV. Affected Adobe Flash Player under Windows XP and Windows 7. Other versions may also be affected.

V. Reference It has got assigned as CVE-2014-0564. http://helpx.adobe.com/security/products/flash-player/apsb14-22.html

VI. 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, a local pointer to a stack buffer (cworkspace) is not updated when the buffer is moved to the heap inside a recursive function, so later copy operations use a stale stack pointer and read out of bounds.

Impact

An attacker could read sensitive memory to bypass ASLR, and with advanced heap techniques may rewrite stack or heap variables to achieve arbitrary code execution.

What the attacker needed

Victim runs affected Flash Player; attacker supplies malformed regex

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.

A regular expression is a pattern used to match text. In Flash Player, compiling a specially crafted pattern caused the program to read and write memory outside its intended bounds. This could let an attacker see secret memory addresses or even run their own code.

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.