home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / sci / crypt / 6052 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  14.4 KB

  1. Xref: sparky sci.crypt:6052 alt.sources:2852
  2. Newsgroups: sci.crypt,alt.sources
  3. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!dog.ee.lbl.gov!network.ucsd.edu!qualcom.qualcomm.com!cancun!rdippold
  4. From: rdippold@cancun.qualcomm.com (Ron Dippold)
  5. Subject: WPCRACK.DOC
  6. Message-ID: <rdippold.725047389@cancun>
  7. Sender: news@qualcomm.com
  8. Nntp-Posting-Host: cancun.qualcomm.com
  9. Organization: Qualcomm, Inc., San Diego, CA
  10. Date: Tue, 22 Dec 1992 18:03:09 GMT
  11. Lines: 319
  12.  
  13. WPCRACK 1.0 - Word Perfect 5.x Password Finder
  14. Now, files with forgotten passwords are no longer lost forever!
  15.  
  16. Copyright (C) 1991 Ron Dippold
  17.  
  18. What This Is
  19. ------------------------------------------------------------------------------
  20. Word Perfect's manual claims that "You can protect or lock your documents with
  21. a password so that no one will be able to retrieve or print the file without
  22. knowing the password - not even you," and "If you forget the password, there
  23. is absolutely no way to retrieve the document."  [1]
  24.  
  25. Pretty impressive!  Actually, you could crack the password of a Word Perfect
  26. 5.x file on a 8 1/2" x 11" sheet of paper, it's so simple.  If you are counting
  27. your files being safe, they are NOT.  Bennet [2] originally discovered how the
  28. file was encrypted, and Bergen and Caelli [3] determined further information
  29. regarding version 5.x.    I have taken these papers, extended them, and written
  30. some programs to extract the password from the file.
  31.  
  32. If you don't care about theory, skip to the next section (Why This Program).
  33.  
  34.  
  35. Stupid, Stupid, Stupid!
  36. -----------------------------------------------------------------------------
  37. Word Perfect allows you to add a password to a file.  When you save it, it will
  38. be encrypted, and it requires the password to uncrypt it.  Word Perfect
  39. encrypts the file by a method of two exclusive ORs.  First, it takes the length
  40. of the password plus 1 and increments this for each character, wrapping from
  41. 255 to 0.  This incrementing sequence is XORed with the text to be encrypted.
  42. Secondly, the password is repeatedly XORed with blocks of the plaintext of
  43. the same size as the password.
  44.  
  45. As a simple example, say the password is "BONE".  The incrementing sequence
  46. would start with 5 (one more than the number of characters in BONE).  BONE in
  47. hexidecimal is 42 4F 4E 45.
  48.  
  49.     Text:        H  e  l  l  o  !
  50.                              48 65 6C 6C 6F 21
  51.     Sequence:    05 06 07 08 09 0A
  52.     Password:    42 4F 4E 45 42 4F
  53.     -------------------------------
  54.     Result:      0F 2C 25 21 24 64
  55.  
  56. It also stores a 16-bit checksum that is computed as following:
  57.  
  58.     checksum = 0
  59.     for each character in the password {
  60.         rotate the checksum right by one bit
  61.         XOR the character into the high 8 bits of the checksum
  62.     }
  63.  
  64. Now, this method of encryption worked well in Word Perfect 4.x., where the
  65. actual text is the only thing encrypted.  To determine the password that was
  66. used, you would have to determine the characters and the length.  Not easy, and
  67. it would take lots of compuuting power, basically brute force trying different
  68. passwords that had the correct checksums (very thoughtful of them to leave that
  69. in there).
  70.  
  71. However, someone did a very dumb thing and extended this scheme to Word Perfect
  72. 5.x incorrectly.  In Word Perfect 5.x, when you encrypt a file IT ENCRYPTS
  73. INFORMATION THAT IS CONSTANT FROM FILE TO FILE.  There are certain bytes that
  74. are guaranteed to be the same always, and 22 total bytes that never seem to
  75. change.
  76.  
  77. What this means is that we have known plaintext for some encrypted text!  And
  78. because the method of encryption is so regular, it is a simple method to
  79. reverse the encryption method to find the password.  The password is repeatedly
  80. applied to the text, so we have a check.
  81.  
  82. Say we are trying a password length of 4.  We know the incrementing sequence
  83. must start at 5 (4+1).  So we XOR that, the first encrypted byte, and the known
  84. value of that byte and we get back a character.  This might be the first
  85. character of the password.  Now, we check it!  We just move over 4 bytes (since
  86. it repeats), increment the sequence number by 4, and repeat.  If the character
  87. is the same as the password we first got, this could be the password.
  88.  
  89. In reality, it's not so easy.  The known bytes are spread out, and for some
  90. password lengths there are some letters we can't figure out.  And if anything
  91. that I expect to stay constant changes that'll mess things up.
  92.  
  93. The first problem can be solved if there is only one missing character: since
  94. WP was so nice as to include the checksum, I can just try all possible values
  95. of the missing character until the checksum matches.
  96.  
  97. The second problem I deal with by trying to get up to five complete versions
  98. of the password for each length from different sections of the known info.
  99. Then I run a "vote" to see how well each charcter agrees with each other and
  100. an overall confidence level for that length.  Any that are above a threshold
  101. I explore further as shown below.
  102.  
  103. I also know that certain password values are forbidden, namely anything above
  104. 128 and lower case characters (they are translated to upper case) so this helps
  105. pare down the choices.
  106.  
  107. If there is more than one missing character (possible on very long passwords,
  108. above 14 characters), then it is up to the person running the program to figure
  109. out what they could possibly be.  After all, if it is "IMP_RTANT REPO_T" where
  110. the "_" are the missing characters, "IMPORTANT REPORT" should be obvious to
  111. most people.
  112.  
  113. The method is very flexible, it seems to get most passwords easily, and
  114. anything really strange should be caught by the flexible threshold.
  115.  
  116.  
  117.  
  118. Why This Program
  119. ------------------------------------------------------------------------------
  120. I know people are going to instantly accuse me of writing this just as a tool
  121. for hackers to steal confidential data.  However, I have seen too many people
  122. asking how to recover their own locked files ("I forgot my password!") and
  123. losing many hours to think that this does not have plenty of legitimate use.
  124.  
  125. The algorithm for cracking the programs has been available for quite some time,
  126. I just automated it and did some filling in the blanks.  Anyone who thought
  127. their files were safe when encrypted like this was fooling themselves (or were
  128. fooled by the claims made about the encryption).  What can I say, every tool
  129. has the potential for abuse.  The idea here is for you to save your files that
  130. you've forgotten the password to.
  131.  
  132. WPCRACK also has some purely technical interest value.  Watching how easily
  133. it can crack a WP file, even on a 4 MHz XT, can be unnerving.  The algorithm
  134. really doesn't take that much processing power.
  135.  
  136.  
  137.  
  138. How to Use It
  139. -------------------------------------------------------------------------------
  140.  
  141. The syntax is:
  142.    WPCRACK (-d) (-t) <filename> ( <threshold> )
  143.  
  144. Parameters:
  145.  
  146. <filename> is the Word Perfect file to crack.
  147.  
  148. <threshold> is the percentage confidence threshold over which a length is
  149. considered to be a possibility.  This can vary from 0 (always) to 100
  150. (only the best) and defaults to 80.  If you can't get a password from
  151. a file you KNOW is protected, lower the threshold.  You'll have more
  152. garbage to sort through, but you'll get something.
  153.  
  154. Switches:
  155.  
  156. -d : Normally when WPCRACK prints the characters, it prints the actual
  157.      characters. Unfortunately, control characters are allowed in passwords,
  158.      and these can do strange things to the screen output.  The -d switch
  159.      will print the decimal values of each character on the line below.  This
  160.      is not pretty, but may be the only option you have to find out what
  161.      character that really is.
  162.  
  163. -t : This will force WPCRACK to print all answers in table form, rather
  164.      that using special displays for passwords with one or no missing
  165.      characters (see below).  This lets you see ALL possible passwords.
  166.  
  167. Note:
  168.  
  169. WPCRACK can spit out quite a bit out output.  You might consider redirecting
  170. the output to a file by adding a "> filename" to the end of the line if it goes
  171. by too fast.  This will send all the output to the file, which you can then
  172. edit, print, or do whatever you want with.  For example:
  173.  
  174.   WPCRACK MYFILE.WP > OUTPUT.TXT
  175.  
  176. And then you can view or print OUTPUT.TXT
  177.  
  178.  
  179.  
  180. The Results
  181. -------------------------------------------------------------------------------
  182. WPCRACK will check the file for passwords of length 1 to 17 currently.  It will
  183. generate up to five passwords for each length (less for the larger passwords,
  184. as we only have 22 bytes to work with total).  It then decides how closely
  185. all the guesses agree with each other.  If we chose the wrong length, we would
  186. expect the different guesses to be almost random.  If the length is correct,
  187. they should almost all agree.
  188.  
  189. WPCRACK weights the results for each length to get a "confidence level" and
  190. then compares that to the threshold.  Any below the threshold are automatically
  191. discarded and no longer figure in anything more.
  192.  
  193. The remaining lengths are sorted by confidence level, highest to lowest.  Then
  194. for each of the lengths, the following is done.
  195.  
  196. CRACKWP checks to see how many missing letters there are.  These are positions
  197. in the password that we have absolutely _no_ guesses for.
  198.  
  199. No Missing Characters:
  200.  
  201. If there are no missing characters, WPCRACK tried every combination of the
  202. possible characters for each position.  It determines the checksum for that
  203. combination, and if it matches the checksum stored in the file, it prints the
  204. password.
  205.  
  206. For a file where the correct password is "PASS1" you will see:
  207.  
  208.   PASS1   -- Good Checksum
  209.  
  210.  
  211. One Missing Character:
  212.  
  213. When there is only one missing character, WPCRACK makes use of the checksum
  214. stored in the file.  It generates every combination of the known characters
  215. in the password.  Then it works backwards from these and the checksum to
  216. figure out what the character must have been.  If the character is a legal
  217. character for a password, the resulting password is printed.
  218.  
  219. For a file where the correct password is "BIG_PASSWORD" you might see:
  220.  
  221.  
  222.   BIG_PASSWO D
  223.             ^
  224.  The missing character will be extrapolated from the checksum
  225.  
  226.   BIG_PASSWORD   -- Good Checksum
  227.  
  228.  
  229. More Missing Characters or Table Mode:
  230.  
  231. When there is more that one missing character, there isn't anything to do
  232. except show you all the possibilities and let the superior text recognition
  233. system in your head see if it recognizes anything reasonable.
  234.  
  235. In addition, if just letting WPCRYPT run doesn't produce the desired results,
  236. this will let you bypass all the extra processing and do it yourself straight
  237. from the possibilities.
  238.  
  239. The format of a password table for a length is:
  240.  
  241.    # of matches: 43355
  242.   Primary Guess: PASS1  Checksum good!
  243.  
  244. The "Primary Guess" means that all these characters are the best guesses for
  245. each position.  The numbers above them are the number of occurences of each
  246. character.  In the above example, there were 4 places that WPCRACK attempted to
  247. determine the first character of the password.  "P" turned up 4 times.  "A"
  248. turned up in the second position 3 times.  The number of times per character
  249. varies because the known bytes are not evenly distributed.
  250.  
  251. In this case, the checksum of the primary guess matched, so it shows that.
  252.  
  253. Now if we have a case where there are multiple character possibilities for
  254. one or more positions, you will see something like this:
  255.  
  256. Password length of 15 with 20% confidence level:
  257.  
  258.    # of matches: 111111101100121
  259.   Primary Guess: FWII/N E'  Y];  (Incomplete!)
  260.  
  261.    # of matches: 100010000100001
  262.      Alternates: Z           ?
  263.  
  264. In this case, there are three characters that we have no clue about (the ones
  265. with zeros above them in the primary guess.  There is another line of counts
  266. and characters below it - these are more possibilities.  Here, the first
  267. character of the password is equally likely to be a "F" or "Z".  A more useful
  268. useful result might be something like this if you force table mode:
  269.  
  270.    # of matches: 43353
  271.   Primary Guess: HELLA  Checksum bad!
  272.  
  273.    # of matches: 00002
  274.      Alternates:     O
  275.  
  276. In this case, three times the last character turned out to be "A", and twice it
  277. was "O".  "O" was the correct letter, apparently, for then it would spell
  278. "HELLO".  Table mode lets you see this, although the "no missing characters"
  279. display should have picked the "HELLO" correctly as well.  I'm sure there is
  280. some good use for this...  It's too nifty to leave out and makes a good
  281. safety net.
  282.  
  283.  
  284.  
  285. Notes
  286. -------------------------------------------------------------------------------
  287.   The longer the password used, the less chance of determining all of it.
  288. Luckily, most people don't use passwords greater than 13 characters, and
  289. CRACKWP should get anything less than that.  And when CRACKWP can't figure it
  290. out, you will be shown all of the password that it can figure out and you might
  291. be able to do something with what's shown, just like a crossword puzzle.
  292.  
  293.   If any of the 22 bytes I assumed are constant change, then things get
  294. hairy!  This is why I do all the contortions with voting, table display, etc.
  295. Unless the change is really drastic, CRACKWP should be able to find it anyway.
  296.  
  297.   I'd suggest the folks at Word Perfect use a different method in version 6.0!
  298. For a product such as this, it's really bad that it's so insecure.  This is
  299. good for those of us who forget our passwords, but bad for someone who thinks
  300. their data is safe.
  301.  
  302.   I haven't tried this on any Word Perfect 5.x other than the IBM version.  If
  303. you have it for another computer and are interested in getting a version for
  304. it, and you have InterNet access, send me the following:  a UUENCODED (short)
  305. Word Perfect 5.x file, a UUENCODED version of the file after it has been
  306. saved with a password, and a letter saying hello and the password you used.
  307. See my address below.
  308.  
  309.  
  310.  
  311. References
  312. -------------------------------------------------------------------------------
  313. [1] "WordPerfect for IBM Personal Computers" WordPerfect Corporation, 1989
  314. [2] Bennet,J "Analysis of the Encryption Algorith used in the Word Perfect
  315.     Word Processing Program" 1987, "Cryptologia" Vol XI, No. 4. pp 206-210
  316. [3] Bergen, H.A. and Caelli, W. J. "File Security in WordPerfect 5.0" 1990,
  317.     "Cryptologia"
  318.  
  319.  
  320. ==============================================================================
  321. You can reach me at my Internet address of rdippold@qualcomm.com or contact
  322. me at one of the fine boards below:
  323.  
  324. Board                   Phone                    My Username
  325. -------------------------------------------------------------
  326. ComputorEdge On-Line    (619) 573-1635           SYSOP .
  327. Radio-Active            (619) 268-9625           Iceman
  328.  
  329. -- 
  330. All employees:  We are phasing in a paperless office. We are starting with
  331. the restrooms.
  332.