home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / WP / WPUNPASS.ZIP / CRYPT.WP next >
Internet Message Format  |  1991-03-29  |  21KB

  1. From: gnu@hoptoad.uucp (John Gilmore)
  2. Newsgroups: comp.os.msdos.apps,sci.crypt
  3. Subject: Word Perfect "locked document encryption" is trivial to break
  4. Message-ID: <12163@hoptoad.uucp>
  5. Date: 27 Aug 90 22:58:27 GMT
  6. Organization: Cygnus Support, Palo Alto
  7.  
  8. One thing that came up at Crypto '90 was a short paper from Ms. Helen
  9. Bergen at Queensland U. in Australia.  She noticed the 'locked
  10. document' commands in Word Perfect, used by all the secretaries in her
  11. dept., and looked to see how strong it was.  It turned out that the
  12. MSDOS DEBUG command and an envelope for scratch paper are enough for
  13. anyone to decode both a document AND the key used for it!  Word Perfect
  14. Corp. didn't care about her results (letter reproduced below), but I
  15. thought that some Word Perfect losers, I mean users, here on the net
  16. might want to know.
  17.  
  18. You should consider WP locked documents like ROT13:  fine to keep the
  19. text garbled until you type a command, useless for keeping things private.
  20.  
  21.     John Gilmore
  22.  
  23. From: <CSZBERGEN@qut.edu.au>
  24. Date: Mon, 27 Aug 90 10:28 +1000
  25. To: cygint!gnu
  26.  
  27. Dear John,
  28.  
  29.    Here is the letter and a copy of the Latex source of my paper. It
  30. will be published in CRYPTOLOGIA in the near future. Thanks for your
  31. interest,
  32.  
  33. Regards,
  34.       Helen Bergen
  35.  
  36. ****************************************************
  37. Quote from letter received from WordPerfect Pacific:
  38.  
  39. Thankyou for the copy of your paper entitled "File Security in
  40. WordPerfect 5.0". I sent a copy of the paper to WordPerfect Corporation
  41. in the USA and recently received a reply from them.
  42.  
  43. They confirmed that people have written programs to break the password.
  44. However, WordPerfect Corporation does not have such a program and
  45. therefore has no way of breaking it. They also pointed out that very
  46. few users would know how to write such a program.
  47.  
  48. It is possible that the manual may be amended in a future edition to
  49. clarify the protection that a password gives. They recommend that
  50. anyone concerned about security may want to take higher precautions
  51. than the password protection.
  52.  
  53. Thankyou for your interest in WordPerfect
  54.  
  55. ********************************
  56.  
  57.         FILE SECURITY IN WORDPERFECT 5.0
  58.  
  59.     H.A. Bergen     School of Computing Science
  60.     W.J. Caelli     Information Security Research Centre
  61.  
  62.        Faculty of Information Technology
  63.        Queensland University of Technology
  64.        G.P.O. Box 2434, Brisbane, Q 4001, AUSTRALIA
  65.  
  66. ABSTRACT: Cryptanalysis of files encrypted with the 'locked document'
  67. option of the word processing package WordPerfect V5.0, is shown to be
  68. remarkably simple.  The encryption key and the plaintext are easily
  69. recovered in a ciphertext only attack. File security is thus
  70. compromised and is not in accord with the claim by the manufacturer
  71. that: "If you forget the password, there is absolutely no way to
  72. retrieve the document".
  73.  
  74. KEYWORDS: Cryptanalysis, WordPerfect.
  75.  
  76. INTRODUCTION
  77.  
  78. WordPerfect is one of the most popular word processing packages in use
  79. today.  It has a 'locked document' option which aims at protection of a
  80. WordPerfect file from unauthorised access. The manual states "You can
  81. protect or lock your documents with a password so that no one will be
  82. able to retrieve or print the file without knowing the password - not
  83. even you".  The manual also claims that "If you forget the password,
  84. there is absolutely no way to retrieve the document" [1].
  85.  
  86. This option is used to 'add' a password to an existing or newly created
  87. WordPerfect file. The file is then encrypted using the password as the
  88. cryptographic key, and is stored on disk. Any subsequent retrieval or
  89. printing of the file via WordPerfect requires the entry of the correct
  90. password.  With the increasing use of distributed file systems and
  91. sharing of data, this option might appear to be an attractive means of
  92. protecting sensitive files, particularly where they may reside on a
  93. shared network server.  It is easily implemented without the expense
  94. and installation of another software protection/encryption package.
  95.  
  96. The encryption algorithm used in the WordPerfect 4.2 version, however,
  97. was successfully cryptanalysed by Bennett [2]. He concluded that the
  98. encryption system was unsatisfactory for protection of sensitive
  99. documents.
  100.  
  101. The present study extends this work to an investigation of the security
  102. of the WordPerfect 5.0 encryption system on both the IBM PC and DEC VAX
  103. systems as well as WordPerfect 5.1 on the IBM PC.
  104.  
  105. WORDPERFECT FILES
  106.  
  107. WordPerfect version 5.0 was used on an IBM-PC and other compatible
  108. systems to create various files consisting of original documents and
  109. their associated ciphertext with different passwords. The DOS utility
  110. DEBUG was used to display the content of the files in hexadecimal
  111. notation.
  112.  
  113. The WordPerfect files were created on three different systems. By this
  114. we mean, three different licenced copies of WordPerfect running on
  115. different Personal Computers with different printers. An example from
  116. just one of these systems has been given in detail.
  117.  
  118. Version 4.2 format
  119.  
  120. Files created under 4.2 contain just the ASCII representation of the
  121. character text. Printer definitions and setup parameters are in
  122. separate files and are used only when the file is to be printed.
  123.  
  124. For example, a file may contain zeros (ASCII code 30 hex) and new line
  125. characters (these are converted to the ASCII line feed character, 0A
  126. hex).  The plaintext file in hexadecimal would be
  127.  
  128.      30 30 30 30 30 30 30 30 30 30 0A
  129.      30 30 30 30 30 30 30 30 30 30 0A
  130.      30 30 30 30 30 30 30 30 30 30
  131.  
  132. The corresponding ciphertext file with a key value of the ASCII letter A is
  133.  
  134.      FE FF 61 61 41 00
  135.      73 72 75 74 77 76 79 78 7B 7A 47
  136.      7C 7F 7E 61 60 63 62 65 64 67 5C
  137.      69 68 6B 6A 6D 6C 6F 6E 51 50
  138.  
  139. Encrypted files contain an extra 6 bytes, shown in the first line of
  140. the above.  The first 4 bytes are constant for all keys and are used by
  141. the WordPerfect program to determine whether the file is plaintext or
  142. ciphertext.  The latter 2 bytes contain a checksum derived from the
  143. key, as described by Bennett [2].
  144.  
  145. For example,
  146.      FE FF 61 61 43 00       key = C
  147.      FE FF 61 61 71 C0       key = AA
  148.  
  149. Version 5.0 format
  150.  
  151. Files created under version 5.0 are stored in a different format. With
  152. the default WordPerfect format, the file contains the document text
  153. appended to printer setup information.  There are other options to save
  154. the file in DOS text format or in 4.2 format, and in these the printer
  155. information is omitted. For example, a document containing 32
  156. characters of text is saved in 5.0 format as a file of approximately
  157. 600 - 1000 bytes (depending on the particular printer system) and in
  158. 4.2 or DOS format as a file of 32 bytes.
  159.  
  160. The locked document  option in version 5.0 allows encryption of files
  161. only in WordPerfect format, the one containing all the printer
  162. information.
  163.  
  164.   *  All version 5.0 files, original and encrypted forms have
  165. the same four characters in byte positions 0 - 3 :
  166.  
  167.       FF 57 50 43     (HEX)
  168.   or          W  P  C    (ASCII)
  169.  
  170. These codes were unchanged for files created on three different
  171. systems, i.e., three different licenced copies of WordPerfect 5.0 on
  172. three different PC's using different printers.
  173.  
  174.   *  BYTES 4 - 7 are related to the offset address of the text, ie. the
  175. start of the document text.
  176.  
  177.   *  BYTES 8 - 11 are constant for all files:
  178.  
  179.       01 0A 00 00
  180.  
  181.   *  ENCRYPTED TEXT STARTS HERE
  182.  
  183.   *  BYTES 12 - 15 are constant for a plaintext file:
  184.  
  185.       00 00 00 00
  186.  
  187. For an encrypted file, however, bytes 12 and 13 in the above contain a
  188. checksum related to the key value used.  This checksum appears to be
  189. the same as that used in the 4.2 version [2].
  190.  
  191.   *  BYTES 16 - 21 were constant for files prepared on the three
  192. different systems and contained:
  193.  
  194.       FB FF 05 00 32 00
  195.  
  196.   *  BYTES 22 - 31. Of these 10 bytes, 22, 23, 28 are file and system
  197. dependent, but bytes 24, 26, 29, 30, 31 are constant with value 00.
  198.  
  199.   *  BYTES 32 - 39 were constant for files prepared on the three
  200. different systems and contained
  201.  
  202.        42 00 00 00 02 00 56 00
  203.  
  204.   *  BYTES 40 - 47. Of these 8 bytes, 42, 46, 47 are file and system
  205. dependent, but bytes 40, 41, 43, 44, 45 are constant with value 00.
  206.  
  207.   *  The remaining bytes of the printer header information are
  208. dependent on the particular hardware and printer in use. These might
  209. change according to the printer setup values.
  210.  
  211.   *  The remaining bytes are document text.  The offset address in
  212. bytes 4 - 5 gives the start of the document text. This is dependent on
  213. the size of the printer information and this can obviously change from
  214. one system to another.
  215.  
  216.   *  Other systems may well have different printers or setup parameters
  217. which change some of the bytes that we found to be constant. In general
  218. though, there will be a reasonable number of constant known plaintext
  219. bytes.
  220.  
  221. ANALYSIS
  222.  
  223. The encryption algorithm was found to be the same as that used in the
  224. 4.2 version [2]. The main differences between version 4.2 and 5.0 are
  225. in the file formats.
  226.  
  227. Bytes 0 - 15 of the original and encrypted files contain some useful
  228. information.  The offset address in bytes 4-5 gives the starting point
  229. of the document text. The checksum of the key in the encrypted file is
  230. in bytes 12 - 13. This gives the key directly if the key is a single
  231. character.
  232.  
  233. The encryption of the file starts at byte number 16, so all the printer
  234. information as well as the document is encrypted.
  235.  
  236. The Encryption Algorithm
  237.  
  238.   *  Firstly, the ciphertext is XORed with an ascending sequence of
  239. bytes based on the sequence in Hexadecimal :
  240.  
  241.       02 03 04 ... 79 7A 7B ... FD FE FF 00 01 02 03 ...
  242.  
  243. Note that the sequence repeats from 00 not 02 after reaching FF.  The
  244. keylength determines the starting point of the sequence to be used, ie.
  245.  
  246.      starting point = keylength + 1
  247.  
  248. For example, for key = QWERTY the starting point of the ascending
  249. sequence would be at position 6 in the sequence giving a starting value
  250. of 07.
  251.  
  252.   *  Secondly, the resulting text is XORed with the key characters in
  253. blocks of key length, to restore the original plaintext. This type of
  254. polyalphabetic substitution is called a Vigenere cipher.  The analysis
  255. of Vigenere ciphers is well known and covered in the standard
  256. cryptography literature e.g. [3,4,5].
  257.  
  258. Plan of attack
  259.  
  260. In the 4.2 version, the only text encrypted was that contained in the
  261. actual document. This is unknown plaintext. In version 5.0, however,
  262. the printer information as well as the document text is encrypted.  We
  263. have identified bytes 16 - 21, 24 - 27, 29 - 41, 43 - 45 as being
  264. constant for a particular system (as defined earlier, a particular
  265. licenced copy of WordPerfect on a particular PC and printer), and they
  266. do not change markedly from one system to another.
  267.  
  268. So we have the ideal situation of known plaintext for a reasonable
  269. number of bytes.  This can greatly simplify our attack as it makes it
  270. possible to recover the actual key. Then it is trivial to recover the
  271. plaintext  by using WordPerfect to retrieve the file using the
  272. recovered key as the ''password''.  Alternatively, a program could be
  273. written to do this as the encryption/decryption algorithm is known.  We
  274. outline a strategy with the following example from one particular
  275. system:
  276.  
  277. Document text consists of three lines of ten ASCII zeros each.  The
  278. size of the original file and the encrypted file is 651 bytes.
  279.  
  280.      0000000000
  281.      0000000000
  282.      0000000000
  283.  
  284. Plaintext file contains in hexadecimal (for a particular printer):
  285.  
  286. BYTES  0-15      FF 57 50 43 6B 02 00 00-01 0A 00 00 00 00 00 00
  287.       16-31      FB FF 05 00 32 00 2D 02-00 00 07 00 11 00 00 00
  288.       32-47      42 00 00 00 02 00 56 00-00 00 53 00 00 00 0C 00
  289.     .            ........
  290.     .
  291.      619-623                                      30 30 30 30 30
  292.      624-639     30 30 30 30 30 0A 30 30-30 30 30 30 30 30 30 30
  293.      640-650     0A 30 30 30 30 30 30 30-30 30 30
  294.  
  295. Ciphertext file contains in hexadecimal:
  296.  
  297. BYTES  0-15      FF 57 50 43 6B 02 00 00-01 0A 00 00 6E 50 00 00
  298.       16-31      B0 B4 42 41 7E 47 6C 46-53 53 58 59 45 5F 59 4C
  299.       32-47      19 5B 57 51 5E 57 07 74-63 63 3C 69 64 6F 65 7C
  300.     .            .......
  301.     .
  302.      619-623                                      19 14 1F 19 0C
  303.      624-639     1B 1B 17 11 1C 2D 11 14-03 03 0F 09 04 0F 09 1C
  304.      640-650     31 0B 07 01 0C 07 01 E4-F3 F3 FF
  305.  
  306. We will illustrate a known ciphertext only attack, even though we
  307. obviously know the exact plaintext in this particular example. So we
  308. assume that we have a ciphertext file produced on some other hardware
  309. system using a different licenced copy of WordPerfect. As explained
  310. earlier, we can be confident that a substantial portion of text is
  311. common to all systems. Thus to summarise, the known plaintext we have
  312. is
  313.  
  314.     BYTES 16 - 21  known
  315.     BYTES 22 - 31  known except for 22, 23, 28
  316.     BYTES 31 - 39  known
  317.     BYTES 40 - 47  known except for 42, 46, 47
  318.  
  319.   *  Firstly, look at bytes in positions 12 - 15 in the ciphertext file
  320. above which contain the checksum of the key. If the key is one
  321. character, it will be evident in byte number 12. For longer keys bytes
  322. 12 and 13 are probably non zero. In this example the checksum is 6E 50
  323. which implies a key size greater then 1.
  324.  
  325.   *  Now we consider bytes 16 - 47.  For byte number 16, we will try to
  326. deduce the key character used.  To do this, choose a keylength starting
  327. with likely values say, 4 to 10 characters. Then XOR the plaintext
  328. characters with the ascending sequence (in the algorithm section)
  329. starting with position keylength which has the value keylength + 1.
  330. Then XOR that result with the associated ciphertext and the key
  331. character should result. For example,
  332.  
  333.          keylength of 4      keylength of 8
  334.  
  335.      plaintext   FB   1111 1011      FB  1111 1011
  336.      sequence    05   0000 0101      09  0000 1001
  337.       xor         ---------          ---------
  338.               1111 1110          1111 0010
  339.  
  340.      cipher      B0   1011 0000      B0  1011 0000
  341.       xor         ---------          ---------
  342.               0100 1110          0100 0010
  343.           => key    4    E             4   2
  344.  
  345. Thus we get the following table:
  346.  
  347.      keylength    starting       possible
  348.           sequence     key character
  349.  
  350.      4            05            4E
  351.      5            06            4D
  352.      6            07            4C
  353.      7            08            43
  354.      8            09            42
  355.      9            0A            41
  356.     10            0B            40
  357.  
  358.   *  Now for a keylength of 4, byte 16 gives a possible key character
  359. of 4E. Bytes 20, 24, 28 ...  must also have been created from the same
  360. key character, so we deduce a potential key character for these other
  361. bytes to see if it is also 4E. It turns out that the other potential
  362. key characters are not 4E.
  363.  
  364.   *  So we take the next possible key length, 5. Deduce the key
  365. character for bytes 21, 26 .. to see if they match the value for byte
  366. number 16 for that keylength, which is 4D. They do not.
  367.  
  368.   *  When a match is obtained for the first key character, deduce the
  369. key characters for the remaining positions.  We show the full analysis
  370. for bytes 16 - 31 for a keylength of 8.  As we stated earlier, bytes at
  371. positions 22, 23 and 28 are unknown, and we signify these as ??.
  372.  
  373. BYTES 16 - 23
  374.      plaintext   FB  FF  05  00  32  00  ??  ??
  375.      sequence    09  0A  0B  0C  0D  0E  0F  10
  376.       xor    ------------------------------
  377.          F2  F5  0E  0C  3F  0C  ??  ??
  378.  
  379.      cipher      B0  B4  42  41  7E  47  6C  46
  380.       xor    ------------------------------
  381.        => key    42  41  4C  4D  41  49  ??  ??
  382.  
  383. BYTES 24 - 31
  384.      plaintext   00  00  07  00  ??  00  00  00
  385.      sequence    11  12  13  14  15  16  17  18
  386.       xor    ------------------------------
  387.          11  12  14  14  ??  16  17  18
  388.  
  389.      cipher      53  53  58  59  45  5F  59  4C
  390.       xor    -------------------------------
  391.        => key    42  41  4C  4D  ??  49  4E  54
  392.  
  393.   *  The repeating sequence for the key is obvious, even with three
  394. unknown bytes at positions 22, 23 and 28, and so the key characters
  395. are:
  396.  
  397.        42 41 4C 4D 41 49 4E 54
  398.         B  A  L  M  A  I  N  T
  399.  
  400.   *  Further checks on the key could be done using the known bytes from
  401. 32-47, if the repeating pattern of the key characters is ambiguous.
  402.  
  403.   *  In general, the probability of deducing the key bytes is dependent
  404. on the keylength. Some definitions relating to the key byte are
  405. useful:
  406.  
  407.      *  Known: the key byte may be determined at two or more
  408.     different positions which correspond to known plaintext.
  409.  
  410.      *  Possible: the key byte may be determined at only one position.
  411.  
  412.      *  Unknown: the key byte may not be determined as there is no
  413.     overlap of this byte with known plaintext.
  414.  
  415. In summary, for a keylength of 1-9, the key bytes are all known and
  416. thus all of the key may always be deduced. For a keylength of 10-13,
  417. 15-17, there is a small proportion of possible to known key bytes. Thus
  418. all the key may be deduced with a high probability.  Keys with
  419. keylengths of 14, 18-24 contain one, two or three unknown key bytes and
  420. an increasingly high proportion of possible to known key bytes. At
  421. least five bytes of the key may always be determined.
  422.  
  423.   *  Retrieve the plaintext using WordPerfect with the
  424. key as the password. This is the easiest way to decrypt
  425. the document text.
  426.  
  427.   *  If no access to WordPerfect is available, then it is
  428. straightforward to recover the plaintext with a short C
  429. program which implements the decryption algorithm as described
  430. previously. This has been done successfully.
  431.  
  432. CONCLUSION
  433.  
  434. The encryption key is easily recovered in an apparent KNOWN CIPHERTEXT
  435. ONLY attack, as the system provides enough known plaintext in the
  436. printer information regardless of the document plaintext.  The
  437. analysis, as shown, can literally be done on the back of a (large)
  438. envelope.
  439.  
  440. The analysis may be slightly more difficult where the physical system
  441. on which the files were prepared is completely unknown and vastly
  442. different to any system we have encountered, as this may reduce the
  443. amount of known plaintext.  In these situations, statistical analysis
  444. based on the characteristic frequencies of characters in a language is
  445. used to decipher text files.  This is a standard method which is
  446. straightforward although a program may have to be written.
  447.  
  448. In summary, the cryptanalysis of files encrypted with the 'locked
  449. document' option in WordPerfect version 5.0 is remarkably simple.  The
  450. inclusion of portions of known plaintext in the encrypted file is a
  451. fatal flaw in the system, since it provides a mechanism of attack in
  452. which the key can be recovered by hand, and document plaintext easily
  453. retrieved.  All of the key can easily be recovered for keylengths of
  454. 1-13 and 15-17, far in excess of commonly used passwords of 8
  455. characters.  A high proportion of the key can be deduced for keylengths
  456. of 14 and 18-24.  The cipher used is too weak, providing little or no
  457. protection.
  458.  
  459. If the attacker has knowledge of any other unencrypted file from the
  460. same system, the analysis is made even more simple.  We stress that
  461. **both the key and the plaintext can be recovered**, independent of
  462. the content of the plaintext.
  463.  
  464. The worst problem is that it may give a false sense of security. For
  465. example, an attacker may decrypt a document, modify it and re-encrypt
  466. so that the originator is unaware of the alterations.  We conclude that
  467. the file security is not consistent with claims made by the
  468. manufacturer and is not sufficent to protect sensitive documents from
  469. anything but the most naive attack.
  470.  
  471. References
  472.  
  473. 1. WORDPERFECT CORPORATION (1989): WordPerfect for IBM Personal
  474. Computers.\\
  475. 2. BENNETT, J (1987): Analysis of the encryption algorithm
  476. used in the WordPerfect Word Processing Program,
  477. Cryptologia, Vol XI. No 4. pp 206-210.\\
  478. 3. KONHEIM, A G (1981): {\em Cryptography, A Primer}, Wiley.\\
  479. 4. DENNING, D E (1981): {\em Cryptography and Data Security},
  480. Addison Wesley.\\
  481. 5. CARROLL, J and Robbins, L E (1989): Computer Cryptanalysis
  482. of Product Ciphers, Cryptologia, Vol XIII. No 4. pp 303-326.\\
  483.  
  484. Biographical
  485.  
  486. Helen Bergen is a Lecturer in the School of Computing Science, Faculty
  487. of Information Technology, at the Queensland University of Technology.
  488. Her research interests within the Information Security Research Centre,
  489. Faculty of Information Technology, include cryptology and the
  490. application of supercomputers.
  491.  
  492. Bill Caelli is Director of the Information Security Research Centre
  493. within the Faculty of Information Technology at the Queensland
  494. University of Technology. He is also Technical Director and Founder of
  495. ERACOM Pty. Ltd., a manufacturer of cryptographic equipment. His
  496. research interests lie in the development and application of
  497. cryptographic systems to enhance security, control and management of
  498. computer and data network systems.
  499. --
  500. John Gilmore      {sun,pacbell,uunet,pyramid}!hoptoad!gnu        gnu@toad.com
  501.  The Gutenberg Bible is printed on hemp (marijuana) paper.  So was the July 2,
  502.   1776 draft of the Declaration of Independence.  Why can't we grow it now?
  503.