#define _GNU_SOURCE #include #include #include #include int main(int argc, char *argv[]) { /* FIX: Bash drops privileges if Real UID != Effective UID. We are running setuid root (EUID=0), but Real UID is the user. We must promote ourselves to full root (Real UID = E-UID = 0) so Bash treats us as root and allows reading the 0700 script. */ if (setuid(0) != 0) { perror("Failed to setuid(0)"); return 1; } char *script_path = "/usr/lib/z-auth/core.sh"; char *new_argv[] = { "/bin/bash", script_path, NULL }; extern char **environ; execve("/bin/bash", new_argv, environ); perror("Failed to exec z-auth core script"); return 1; }