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

  1.  
  2. Greetings!  This has been written as informative document which will likely
  3. be used by two groups of people:  new crackers, and new administrators who
  4. would like to know about likely points of attack.  This is written entirely
  5. from the cracker's perspective and tells _how_ to gain access, there are
  6. however Administrator's notes that give ideas on what an Admin can do to
  7. make it harder on the new cracker.  The author of this document is _not_ a
  8. master cracker, and has very little knowledge at the system level of cracking.
  9.  
  10. Here we go:
  11.  
  12. So you want to crack a Unix system?  Well the big assumption that you already
  13. have access to _some_ Unix system will be made.  Here are the following items
  14. that you can achieve in order of greatness:
  15.  
  16. 1.  Root password.  Kind of the Holy Grail, with this you can do just about
  17. anything.  The only difference that will exist between you and the _real_
  18. admin is tha he will have physical access to the machine.
  19.  
  20. 2.  Root access.  As above except you don't know the password.
  21.  
  22. 3.  User X's password.  A particular target user's password, item 1 is the
  23. same thing with the target user being root.
  24.  
  25. 4.  User X's account access.  Same as above but you don't know their password.
  26.  
  27. 5.  Some user's password.  Just some random user, you don't pick them, you
  28. got them because they were easy.
  29.  
  30. 6.  Some user's account access.  Same as above but you don't know their
  31. password.
  32.  
  33. 7.  Wreaking havoc with tools already available to you, such as deleting
  34. other's files, crashing the system, etc.
  35.  
  36.  
  37. Here are some basic tools you should have:
  38.  
  39. 1.  Dan Farmer's COPS scripts, and/or TAMU's Tiger Scripts.
  40.  
  41. 2.  Crack (Unix password cracker than run on several machines at once)
  42.  
  43. 3.  CrackerJack (A DOS or OS/2 program that cracks Unix passwords)
  44.  
  45. 4.  A fair knowledge of Unix.  If you don't know the basic commands,
  46. learn them.  If you don't know how to write shell scripts or C code,
  47. learn the basics of that, those topics are not covered here.
  48.  
  49. Others:  Depending on the level of complexity you wish to delve into,
  50. getting access to past CERT advisories and anything put out by 8lgm
  51. could also be useful.  Also subscribe to comp.security.unix newsgroup.
  52.  
  53.  
  54. We'll start by cracking your local system.  Getting a specific user
  55. is very difficult to do.  We will start with getting access to _some_
  56. user.  That way you can perform all future hacking from that user's
  57. account, reducing the likelyhood of things being traced back to you.
  58.  
  59. Get the passwd file.  There is typically two ways to do this.  It is
  60. either stored in /etc/passwd, and you simply cat the file.  Or, you
  61. type "ypcat passwd" and it will pull it off a ypserver.  You will
  62. want to redirect the output to a file so you can crack it.  Some
  63. systems are starting to move toward "shadowed" password files, I've
  64. never seen one of these, but apparently only root can read the passwd
  65. file on such a system, if that is the case, the following won't help
  66. you.
  67.  
  68. Now that you have the passwd file, it's time to start cracking.  In
  69. most cases it is not wise to run Crack on system because it runs for
  70. long periods and is likely to be seen.  However, if this option is
  71. available to you, it can be very effective since it can crack many
  72. passwords much quicker than the alternative since it has the ability
  73. to run on multiple systems.  One thing to do is to use the next method
  74. to get _a_ account's password, then use that account to run Crack.
  75. The alternative I have been referring to is CrackerJack, this is a
  76. solid program that runs on DOS and OS/2 machines.  You simply have
  77. to copy your passwd file to the PC with CrackerJack and give it a
  78. dictionary file.  If you are in an educational environment, their
  79. are often PC labs that are accessible at late hours.  You can use
  80. several small dictionaries and run CrackerJack on several PC's, using
  81. each PC for several hours.  This is a very effective way to crack.
  82. The documentation with both of these is fairly complete, so no detail
  83. will be given on how to do the above.
  84.  
  85. **Administrator's note:  Ways to prevent the above include:
  86. * Using a shadowed passwd file, so Joe User can't get a look at it
  87. (I think, never seen one, as mentioned earlier).
  88. * There are several programs available that will do a quickcheck
  89. when a user tries to change their password to make sure they don't
  90. have it as something stupid.
  91. * Run Crack.  If you are the administrator, you can easily run it
  92. across all machines on your lan during low-use hours (1am - 5am)
  93. This being done on a regular basis (I'd recommend monthly if not
  94. weekly, it can be automated with a cron job) can keep weak passwords
  95. off your system.  If you are in an educational setting, new users
  96. tend to come in large groups (semester starts), this is the ideal
  97. time for the cracker to attack, since their are lots of new, usually
  98. clueless users with weak passwords.  You should up _your_ checking
  99. during these times.
  100. **
  101.  
  102. Okay!  That's one way to gain access to someone else's account, let's
  103. move on to another.  The key here is:  If you can get user X to run
  104. program Y, you can gain access to their account, this includes root.
  105. First we'll go into what program Y would need to do:
  106.  
  107. 1. Create a SUID shell script.  This attack is my least favorite
  108. since many systems are set up so that SUID scripts don't work from
  109. most filesystems.  However, /tmp seems to be an oversite in most
  110. cases.  Generally SUID programs can exist and be run from /tmp.
  111. The idea behind SUID is that when the program is run, it runs under
  112. the owner's account.  So if the program executes a shell, that shell
  113. is owned by the owner of the file, making the runner of the file
  114. that person (for all practical purposes).  You can make a program
  115. SUID by doing a "chmod 6xxx filename", the xxx would be the normal
  116. chmod settings, "man chmod" for more info.
  117.  
  118. 2. Add you to their .rhosts file.  Reasoning:  Whenever your try
  119. to rlogin to someone else's account, the rlogin program will look
  120. in that users home directory for a .rhosts file.  If the party
  121. trying to rlogin in listed in that file, from a particular machine,
  122. also listed in that file, rlogin will not ask for a password.
  123. .rhosts is set up like the following:
  124. <machinename> <username>
  125.  
  126. 3. The above two will get you access to their account, the following
  127. will give you a way to do the above two.  You can add a line to their
  128. .login, .cshrc, or .logout file so that will execute a program everytime
  129. they login.  One idea is illustrated in the following pseudocode:
  130.  
  131. if /tmp/backdoor exists run /tmp/backdoor
  132.  
  133. That way you only create /tmp/backdoor as needed and they don't get
  134. an error when it is not there.
  135.  
  136.  
  137. To be continued.....
  138.