During the research of the Flash vulnerability I’ve managed to create a functional PoC.

The process of the exploit is the following:

  1. Spray the heap in order to achieve the following:
    1. The aforementioned path conditions would pass.
    2. A DWORD memory overwrite with user controlled target and value would take place when the vulnerability is triggered.
    3. Allocate a placeholder for the shellcode. The target of the memory overwrite would be some function pointer, the value would be the location of the shellcode’s placeholder.
  2. Trigger the vulnerability.
  3. Free the placeholder of the shellcode.
  4. Allocate the shellcode by spraying the heap.
  5. Trigger some function which calls the function pointer.

The reason that there are 2 passes for allocating the shellcode is the fact that after the arbitrary overwrite occurs, some random chunks are also written to the location of the shellcode, hence the block has to be freed and re-allocated.

The exploit contains the following components:

  1. Exploit.fla/as – main code
  2. HeapLib.as – ActionScript3 Heap Spraying library
    The Heap Spraying library bypasses the ActionScript’s maximum execution time limitation by using a Timer that allocates small chunks at each iteration.
    It provides two basics functions:
    1) alloc(value, size)
    2) free()
  3. TriggerVuln.swf -  malformed SWF which triggers the vulnerability (i.e: intf_count=0)
  4. TriggerFunc.fla – ActionScript2 code which triggers a call to the function pointer by invoking LoadVars.sendAndLoad
  5. Exploit.htm – HTML wrapper for the Exploit.as

The exploit has been tested against Windows XP SP3 with IE7. Flash is assumed to be loaded at VA 0x10000000. However, since the vulnerable code is wrapped by a permissive SEH handler, brute-force is possible (not covered by the PoC).

The binaries and source code of the PoC can be found here.