home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3892 / APPENDIX next >
Encoding:
Text File  |  1991-08-23  |  12.4 KB  |  278 lines

  1. Odds and sods that I thought are interesting:
  2.  
  3. ********
  4.  
  5. Several people have asked me why I don't write Crack so that it
  6. distributes dictionaries over the network and hacks the same password
  7. file on each machine, as opposed to spreading users over the network and
  8. using the same dictionaries.
  9.  
  10. There are several reasons for this, which I will outline.
  11.  
  12. The reasoning that spreading the dictionaries over the network is faster
  13. is correct in the case of cracking the passwords of ONE user - it is
  14. most efficient to run different dictionaries on him on several machines,
  15. and you will break his password eventually.
  16.  
  17. Scaling this by a factor of 'n' users causes problems.  Firstly, if a
  18. machine guesses one persons password, it must inform all others on the
  19. network not to waste time cracking him, but to get on with the other
  20. users.  This is difficult and nasty.
  21.  
  22. Secondly, it is not what Crack was designed to do.  The name "Crack" is
  23. actually a misnomer - Crack really ought to be called "Passwdcheck" or
  24. something similar, but such names lack sex appeal.
  25.  
  26. Crack is not a program designed to break the password of every user in
  27. the file.  Rather, it is designed to find weak passwords in the file, by
  28. attacking those sorts of bad passwords which are most likely to be used,
  29. in the order in which they would most easily be found (ie: are most
  30. likely to be used by a moronic user).
  31.  
  32. Crack is not designed to break user passwords; it is designed to break
  33. password files.  This is a subtle but important distinction.
  34.  
  35. If you want to break into a safe, you do not take a hammer at every bit
  36. of it in turn; instead, first you try some simple combinations, then you
  37. try blowing the hinges off, then you get out an acetylene torch and go
  38. for the bolt.  If that doesnt work, THEN you start on the walls.  You go
  39. for the bits which are most likely to be weak first.
  40.  
  41. Consider a password file with 'n' users in it.  Say that your serial
  42. password cracker uses a dictionary of 1000 words, and tries each word 6
  43. ways (upper/lower/mixed case, permuted with forwards/backwards)
  44.  
  45. Also consider that out of that 1000 users, only one (the last one) has a
  46. guessable password - "fred".
  47.  
  48. Also say that it takes time 'T' seconds to encrypt a word.
  49.  
  50. If you use the "try each user in turn" method, like the COPS password
  51. cracker, you will have to wait for a time:-
  52.  
  53.     999 users * 1000 words * 6 ways * T = 5994000 T seconds
  54.  
  55. before you get to that last user.  Spreading this load around on a
  56. network only alleviates the number of words to be searched (divides them
  57. by the number of machines you are working on).
  58.  
  59. Thus, if you use 10 machines, the machine which will guess "fred" will
  60. get to that last user in:-
  61.  
  62.     999 * (1000 / 10) * 6 ways = 599400 T seconds.
  63.  
  64. Alternatively you can try it the Crack way - "fred" is a word which
  65. appears in a forwards dictionary.  You will only wait:-
  66.  
  67.     999 users * 1000 words * 1st way * T = 999000 T seconds
  68.  
  69. to get to that user.  Now split the _USERS_ across 10 machines:-
  70.  
  71.     (999 / 10) users * 1000 words * 1st way = 99900 T seconds
  72.  
  73. To get to his password, in ONLY 17% of the time taken by networking
  74. using the serial cracking method.  This is only a boundary case, but I
  75. hope I have illustrated the concept.
  76.  
  77. ********
  78.  
  79. Crack has several other optimisations because of its structured password
  80. guesses.  The figures below are entirely empirical, but I reckon that
  81. they're as good as any:
  82.  
  83. The first pass that Crack makes is over the user data user information
  84. gleaned from the users' password field.  In my test file, this gets
  85. about 3% of the passwords (out of a total of 11% guessed).  This pass
  86. also completes the quickest of all, working as it does from a very small
  87. amount of data, but one which is very frequently used for passwords.
  88.  
  89. My test password file is 1150 users big, and the first pass completes in
  90. a little over 2 minutes.  In that time Crack gets 35 accounts.
  91.  
  92. The first sweep of the second pass, consisting of lowercase dictionary
  93. words, gets about another 5% of the passwords.  This means that, for our
  94. 1150 users, we have now cracked a cumulative total of 91 accounts.  The
  95. length of the first sweep depends on how much CPU and how many
  96. dictionaries I supply, but using the Ultrix /usr/dict/words and my
  97. bad_pws.dat, over 4 CPUs, it doesn't take much more that a couple of
  98. hours.
  99.  
  100. For the further sweeps, the percentages cracked per sweep tail off, 2%,
  101. 1%, 0.5%...  But they are the people with fairly exotic passwords, and
  102. it's only common sense that that they will take some time to crack.
  103.  
  104. ********
  105.  
  106. There is one more major optimisation that I haven't mentioned.  Because
  107. of the way the UNIX crypt() algorithm works, each encryption is "salted"
  108. with a two letter sequence which is stored as the first two characters
  109. of the encrypted password.  This salting means that the word "fred" can
  110. be encrypted and appear in a password file in (literally) thousands of
  111. different ways - so long as each encryption has a different salt.
  112.  
  113. Hence, it makes sense to do things in this manner:
  114.  
  115. 1) sort and group the input data by encryption salt.
  116. 2) for each different groups' encryption salt
  117.     * get a dictionary word
  118.     * encrypt it using that salt (This is the time consuming bit)
  119.     * compare the encryption with each member of the group with that salt
  120.     * if it matches, you have guessed that users password.
  121.  
  122. This knocks (empirical guesswork time again) up to one third of the
  123. dictionary encryptions off - thus saving you 0.3 of the time all the
  124. dictionary sweeps would ordinarily take.  You can work out this figure
  125. yourself: Crack gives this statistic when it says
  126.  
  127.     pwc: Loaded 'n' password entries into 'm' salted lines.
  128.  
  129. so you can work out the percentage of users who have the same salt:-
  130.  
  131.             x = (m / n) * 100
  132.  
  133. and hence the percentage of encryption time that you save = (100 - x).
  134.  
  135. ********
  136.  
  137. Listening to the REM album 'Green' on the way back from the Cropredy
  138. folk festival yesterday, whilst I was thinking over things to do to
  139. Crack, and I was struck (not for the first time) by the words of the
  140. first verse to 'World Leader Pretend':-
  141.  
  142.     I sit at my table, and wage war upon myself.
  143.     It seems like it's all, it's all for nothing.
  144.     I know the barricades, and I know the mortar in the wall
  145.     I recognise the weapons, I use them well.
  146.  
  147.     This is my mistake, let me make it good,
  148.     I raised the wall, and I will be the one to knock it down...
  149.  
  150. - writing password cracking programs gets to you after a bit.
  151.  
  152. ********
  153.  
  154. Some people have asked me how to generate safe passwords.  This, sadly,
  155. has become a religious issue, and there are now, on USENET, several
  156. vociferous "password geeks" who will say "my method is the best", in the
  157. same way that some mathematicians will try to compare so-called "random
  158. number generating algorithms".  Such statements are pointless.  I'm
  159. sorry for adding to the confusion, but I must say that I think they are
  160. wrong.
  161.  
  162. Okay, so I am a security fatalist and a security philosopher, but I am
  163. not going to give and hard and fast answers; rather, I'd like to make
  164. some points and recommendations to the people out there.  Security isn't
  165. a tangible thing, it is applied psychology.
  166.  
  167. The whole point of a password is to prevent people accessing your
  168. system, getting into it from outside.  Once someone is inside your
  169. system, assuming that they have the relevant knowledge of your O/S, it
  170. is safest to assume that anyone can get to be 'superuser'.  Your only
  171. security once someone is on your system is called "security by
  172. obscurity".  If your user has sufficient knowledge, you've "had it". 
  173.  
  174. The question isn't "How secure can my system be made?".
  175.  
  176. The question really should be, "How much do I care, how much can I trust?".
  177.  
  178. A system can be perfectly secure without any passwords at all, so long
  179. as it is in an environment of people who recognise its purpose and
  180. depend on it.  I say this after having had acounts on several 'public'
  181. machines, which could have been taken to bits by any competent Unix
  182. person, but were largely safe - because when someone worked out who did
  183. anything nasty, the culprit was ostracised from the community.  There
  184. _is_ a caveat to this, however. 
  185.  
  186. The problem is the sort of people who go around the world 'collecting'
  187. computer accounts and breaking machines, those who have either a
  188. childish mentality or an ulterior motive. 
  189.  
  190. The former are like the little boys who go around breaking windows and
  191. vandalising things 'for kicks'.  They are the ones who see every
  192. password file as a "NO ENTRY" sign, and therefore, driven by what they
  193. think is anarchy and fun, they break in and smash the place up.  Tell
  194. them that they are behaving like children, and they will behave moreso. 
  195.  
  196. The latter are driven by personal motives or money.  Their reasons are
  197. too complex for me to analyse here. 
  198.  
  199. The 'babyish' hackers need a lesson (which I hope that eventually they
  200. learn) that true anarchy is for the general good, and is best achieved
  201. by fiat amongst the community.  USENET is a good example - there is a
  202. lot of petty bickering and arguing, but an incredible amount of good
  203. comes out of it.  It is anarchy that the old greek philosophers would
  204. have approved of. 
  205.  
  206. What I am trying to say is that, when I say that if someone gets into
  207. your system, you've "had it", you should consider whether there is
  208. anything to have "had" in the first place.  There is no point in getting
  209. yourself paranoid over security - if you do, you'll lose out.  Don't be
  210. too paranoid.  Be SENSIBLE instead, and secure your system according to
  211. it's needs, and not according to some 'holy bible' of absolute security. 
  212.  
  213. If someone gets into your system, you find out how they did it, patch
  214. the hole, check for back doors, brush yourself off, and start again. 
  215. It's not the end of the world. 
  216.  
  217. What this statement doesn't address (yet) is the needs of system
  218. managers who have a REAL need for security - be it corporate data or
  219. research work - on their system.  As I have said before, most O/S's have
  220. gaping holes in them that cannot be entirely filled, and so the users
  221. must be stopped on the doorstep.  At the password login. 
  222.  
  223. People who say that they have a way of generating safe passwords are
  224. misinformed, IMHO.  Saying that the password "wyufwqpl" is secure is as
  225. meaningful as saying that the number "4" is random.  Password security,
  226. like any other form of computer security, is not an absolute, but should
  227. be taken in context. 
  228.  
  229. You can't say that a certain method will provide secure, random
  230. passwords, because, in defining an algorithm to create these passwords,
  231. you will use only a subset of all the possible passwords that could ever
  232. exist.  You have shrunk the 'search space' for the passwords. 
  233.  
  234. Someone merely has to write a password cracker which will search this
  235. small subset of passwords, in order to break your system.  Passwords
  236. generated by any algorithm, human or computer based, are merly
  237. pseudo-secure, in the same way that numbers can be pseudo-random.  For
  238. illustration of this aspect of password security, read the document
  239. "Password Security, A Case History" by Morris and Thompson.
  240.  
  241. There is an incredibly large set of possible passwords in the world, and
  242. the best approach toward choosing a password is not to try to find a way
  243. to generate 'secure' passwords - there are no such things - but rather
  244. you should learn to choose passwords which are not easily searched for. 
  245. Passwords which are out of the 'search space' of most password crackers
  246. like 'Crack'. 
  247.  
  248. Read the Crack documentation.  See what sort of things other programs
  249. like Crack would search for.  Think of some yourself.  I am not going to
  250. specifically mention methods, you should really work something out for
  251. yourself. 
  252.  
  253. At the bottom line, the password "fred" is just as secure (random) as
  254. the password "blurflpox"; the only problem is that "fred" is in a more
  255. easily searched part of the "password space". 
  256.  
  257. Both of these passwords are more easily found than "Dxk&2+15^N" however. 
  258. Now you must ask yourself if you can cope with remembering "Dxk&2+15^N". 
  259.  
  260. 8-)
  261.  
  262. ********
  263.  
  264. I'd like to thank Chris Samuel & Piercarlo (Peter) Grandi for all their
  265. help in beta-testing Crack, and in Peter's case especially, for dropping
  266. me into the deep end of troff.  Die, you bastard.  8->
  267.  
  268. I'd also like to thank Chris Myers for giving me an archive site to work
  269. from (saving me a lot of tedious email) and heaps of suggestions. 
  270.  
  271. Similarly for Randal Schwartz for his information and Chris Lewis (the
  272. psroff guy) for all his suggestions. 
  273.                         - alec
  274. --
  275. INET: aem@aber.ac.uk      JANET: aem@uk.ac.aber      BITNET: aem%aber@ukacrl
  276. UUCP: ...!mcsun!ukc!aber!aem         ARPA: aem%uk.ac.aber@nsfnet-relay.ac.uk
  277. SNAIL: Alec Muffett, Computer Unit, Llandinam UCW, Aberystwyth, UK, SY23 3DB
  278.