home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / hacking / unix / unix2.hal < prev    next >
Encoding:
Text File  |  2003-06-11  |  12.2 KB  |  236 lines

  1.  
  2. ===============================================================================
  3.                 RUSH2112
  4.                 Presents
  5.                A HALE Production
  6.     H ackers    A gainst       L aw        E nforcement
  7.              Call HALE Central. (619)472-0xxx
  8.     Active HALE members are: Ripper, Trashman, Rush2112.
  9.     The Underground Newsletter: Vol I.  Issue I, Part II
  10. ===============================================================================
  11. Note:    Feel free to distribute the file provided none of its contents or 
  12.     credits are changed.
  13. Date:    September 3, 1989.
  14. Topic:    A Guide to Unix Systems, Part II.
  15.  
  16.     In Part I of TUN, I explained the very basic fundamentals of the
  17. Unix operating system.  In Part II, which I'm sure a lot of you will be
  18. more interested in, I will show you a sample run of how and what a hacker
  19. would do (for example - what I would do) if I were on some unknown Unix
  20. account.
  21.  
  22. I.  Access to a Unix account.
  23.     First off, you need to find yourself an account.  Briefly, here are
  24. some of the most popular methods I use some of which are hard and some of
  25. which are easy.
  26.  
  27.     1.  You can try to hack one out at the login: prompt.  Of course this
  28. is the old traditional method of trial and error and some standard login 
  29. accounts.  (It is suggested but as a last resort - though it has worked for me
  30. in the past I opt for other routes to getting an account.)  Well, the first 
  31. thing of course when you hit a Unix system is  to try the standard accounts.  
  32. This would include: uucp, nuucp, daemon, ftp
  33.     Some systems include public accounts that you may also want to try
  34. as many of them give you shell access.  
  35. You might want to try: guest, info, bbs, games
  36.     Sooner or later, you'll find a system that has a vulnerability like
  37. non-passworded accounts or simple passwords for a login.  Some of the things
  38. you should try are the login names as a password.  Even the magazine UNIX
  39. Review claims it was surprised how entries in /etc/passwd on systems they
  40. checked used login names as the actual passwords.  My own experiences shows
  41. this is true.
  42.  
  43.     2.  You can get one if you know someone who already has a Unix account.
  44. (I find this works very well, by working from the inside you're guaranteed to
  45.  get an account if you know what you're doing.)
  46.     Of course the hack attack from the login: prompt could be fruitless
  47. and you may never get an account this way so the best way to get into a Unix
  48. system is from the inside.  This means of course you know someone on that
  49. system with an account, who could help you find an account either by searching
  50. the /etc/passwd for non-passworded account with shell access.  Or hunting the
  51. entire file system for files with "other" and/or "group" privileges in hopes
  52. of finding a password or some account names or other neat info to get you
  53. started on Unix.
  54.  
  55.     3.  You can try a trojan horse program to gain someone's login and
  56. password.  Some popular trojan horses are password capturing programs and 
  57. emulators that emulator the login screen.  This method by-far is the EASIEST 
  58. way to do it but it requires you have an account to run the trojan horse 
  59. from.  This can be done easily if your friend lets you use his account.  You 
  60. won't even have to tell him what you're using it for.
  61.  
  62.     I'll have more about this at a later date.  Maybe an issue on trojan
  63. horses and emulators, etc.. is in order?
  64.  
  65. II.  Working with an account.
  66.     Once you have access some important points to remember and do are:
  67.     1.  Set history to 0 if on BSD or erase .history on Sys V before logoff
  68.     2.  Turn off your messages.
  69.     3.  Get a buffer of the /etc/passwd.
  70.     4.  Get a buffer of the login process.
  71.     5.  Get a buffer of the ENTIRE file system online.
  72.  
  73.     Assuming that you have gotten into someone else's account, the first
  74. thing to do when you log in is shut your messages off with "mesg n" (messages 
  75. no).  This will turn off write permission to your tty in /dev/ttyXX (where XX 
  76. is your tty number).  It will prevent people from writing to you while you're 
  77. online buffering system information.  It will also stop people from 
  78. redirecting output to your tty.  Plus, you'll be busy so you want no 
  79. disturbances of any type.
  80.     If you're on an account running csh you should set the history to 0.
  81. You can do that with the command 'set history=0'.  History is just that... it
  82. keeps a history of everything that you do, all the commands you pass to the
  83. csh is stored.   Typing 'history' by itself will show you a list of previous
  84. commands entered by the user.  By setting it to 0, it will not record your
  85. commands from the shell.  On Sys V under Bourne shell, history is stored
  86. sometimes in the "hidden file" .history in your home directory ($HOME/.history)
  87. You should delete the file before logging off.
  88.     Now you should get a copy of the password file.  This is easily
  89. accomplished with 'cat /etc/passwd'.  Make sure you buffer the contents, you'll
  90. need this for later.  You may also wish to get the /etc/group file, this file
  91. has information on all the groups on the system along with members of each
  92. group.  (I'll talk about groups in another file.)  Just type 'cat /etc/group'
  93. and buffer its contents.
  94.     Now comes the interesting part.  You'll want to get a listing of every
  95. single file on the system and buffer it.  Here's what you would do:
  96.  
  97. $cd /
  98.     (at this point open your buffer)
  99. $find . -type f -exec ls -al {} \;
  100.     (when this is finish, close your buffer)
  101.     This will take quite a while if the system you're on has a lot of 
  102. files.  Basically, you are going to the root directory ('cd /') which is the
  103. top of the directory tree hierarchy.  From there you will execute the 'find'
  104. command which is a file find utility.  We are asking it to print out all the
  105. filenames of type 'f' (which is normal file) from the current directory (which
  106. is root) and all  directories below it (which is the rest of the directory 
  107. tree) and search all files recursively and pass its findings via -exec to
  108. the "ls" utility which will list its file information (-al including file
  109. attributes).. but anyway, if this is too complicated to follow, don't worry.
  110. Try typing 'man find' for perhaps a better explanation.   Suffice it to say
  111. you should now have buffered a listing of all files in the directory tree.
  112.     Next take a look at your hidden files like .profile on Sys V or
  113. .login and .cshrc on BSD Unix.  They contain login information such as commands
  114. to automatically execute and perhaps some aliases definitions.  If there is
  115. anything interesting you should buffer it.
  116.     Find out who the hell is on at the time with the "who" command.  Then
  117. find out what everyone is doing with the "ps" command.  For example on Sys V
  118. Unix you might do something like this:
  119.  
  120. who -HTu    (see "man who" for what the full explanation of all switches)
  121.     - basically this shows all users on currently and gives other
  122.       information on their tty status like "mesg y" or "mesg n" (A + means
  123.       messages are on, a - means messages are off.)  It will also report
  124.       tty IDLE time, nice to know if someone is working or not.
  125.  
  126. After you see who's on, you'll want to know what they're doing.  This can be
  127. done with the "ps" (Process Status) command:
  128.  
  129. ps -fu username    (read the on-line manual for full options)
  130.     - where username is the login name of whoever it is that you wanted to 
  131.       check up on.
  132. ps -fa | more
  133.     - shows ALL processes on the system.  Piping through more will pause
  134.       tty output every screenful.
  135.  
  136.     Using the "ps" utility is handy in getting some interesting paths to
  137. programs run by users on the system as it shows the path to the entire process.
  138. I have found many neat programs and utilities by watching what other people
  139. do on the system with the "ps" command.
  140.     At this point you are interested in getting your own account if
  141. possible.  You have several options now.  You could install a trojan horse
  142. program in hopes of getting an account or you may want to play around with
  143. the account you have.
  144.     Installing a trojan horse.  I'll be going into more details about
  145. trojan horses in a future issue of TUN as there are many ways to do this.
  146. You should check first to see that your Unix system has a C compiler on it.
  147. (yes, you'll unfortunately have to know a little bit of programming so go
  148. get those books on C and start reading!).  If it doesn't have a C compiler
  149. you'll be out of luck, but not completely helpless, you could start writing
  150. shell scripts (again probably another issue of TUN to cover shell scripts).
  151.     If you want to play around on the system, here are a few things to do.
  152. One of the most basic tricks of Unix is called i/o redirection.  This is a
  153. process whereby you "redirect" standard input/output to some other device.
  154. An example would be if I were to send a file to my screen to look at it, I 
  155. would redirect the output to another file, or screen, or printer, or any other
  156. device on the system.  Let's go with redirection to a file for a simple first
  157. step.  Suppose I had a text file called "textfile001".
  158. To view to the screen I would type:
  159.  
  160. $cat textfile001
  161.  
  162. What happens when you type the 'cat' command is it views the file and send
  163. its output to your tty or terminal screen.  Now if I were to do this:
  164.  
  165. $cat textfile001 > newfile
  166.  
  167. You can see that nothing happens to the screen and it will come back to the
  168. main prompt.  However you will now have a new file called "newfile" whose 
  169. contents are those of textfile001.  The redirection symbol > told it to cat
  170. the file textfile001 but redirect standard output to the file called "newfile".
  171.  
  172.     Using this principal, you can try to redirect things to people's tty's
  173. or terminal screen.  (Note - redirection to tty's will not work on BSD Unix
  174. ver 4.3 due to a bug fix.)  The way to do that is like this:
  175.  
  176. $cat textfile001 > /dev/ttyXX
  177.  
  178. Where XX is the tty number you wish the standard output to go to.  So for 
  179. example if I were to do a 'who' command and I find that there is a user name
  180. 'steve' on the system on 'tty12' I could send the text file to his tty with:
  181.  
  182. $cat textfile001 > /dev/tty12
  183.  
  184. Now the standard output of 'cat' will go to tty12 which belongs to user steve.
  185.     Another trick to to redirect stty outputs to people's tty's.  The 
  186. stty command handles certains setups for your tty, including how to process 
  187. erase keys, interrupt keys, baud rate, hangups, etc...  For a list type 
  188. 'man stty' to get the on-line manual entry for stty.  Anyways, the command
  189. stty 0 will automatically terminate phone connection to the system (i.e. hang
  190. you up).  So if you were to type:
  191.  
  192. $stty 0
  193.  
  194. You would gracefully exit the system with a &[1 NO CARRIER or some equivalent.
  195. Now using redirection you can send your stty commands to other tty's.  So using
  196. the above example of stty 0:
  197.  
  198. $stty 0 > /dev/tty12
  199.  
  200. will hang up user steve.  Unfortunately, due to the way Sys V handles stty
  201. processing, this will not work on System V or later versions of BSD Unix 
  202. (4.3 to be exact.)
  203.     Other nasty things to do is to cat binary files to people's tty.  Due
  204. to the big file sizes of certain binary executables you should do redirection
  205. in the background..that is with the & symbol at the end of the command line.
  206. For example to send the "ls" binary file to user steve we would type:
  207.  
  208. $cat /bin/ls > /dev/tty12 &
  209.  
  210. Once typed in, you will get a Process ID (PID) or job number (on BSD) for
  211. the background job.  You will also get your prompt back so you can proceed
  212. as normal while Unix is sending the ls binary to user steve.  To kill the
  213. process you could type:
  214.  
  215. $kill -9 PID        where PID is the number returned to you from the
  216.             background command.
  217.  
  218. On BSD:
  219. $kill %jobnumber     for example if the job number returned was 1 then
  220.             $kill %1  will do the job.
  221.  
  222. This is handy to remember since doing a ps -fu username on your username
  223. will reveal you are sending him a binary file in the background.   You could
  224. easily be dubbed the culprit messing with people's tty's.
  225.  
  226.     Well, at this point I would like to wrap up Part II.  If there are
  227. typos my apologies.. it's late.   Part III will be a bit more technical but
  228. hopefully you'll get something out of it.  I will be going over trojan horses
  229. and emulators, and perhaps a discussion of file protections is in order and
  230. of course how to get other people's files and give yourself more permission.
  231.     This file is for informational purposes only.  
  232.     Brought to you by:
  233. --------H.ackers--------A.gainst-----------L.aw---------E.nforcement-----------
  234.  
  235.  
  236.