home *** CD-ROM | disk | FTP | other *** search
/ For Beginners & Professional Hackers / cd.iso / hackers / tools / diskreet.ha / DISKR2.TXT < prev    next >
Encoding:
Internet Message Format  |  1995-10-24  |  12.5 KB

  1. From: pgut1@cs.aukuni.ac.nz (Peter Gutmann)
  2. Subject: Norton's InDiskreet
  3. Date: Thu, 11 Nov 1993 12:37:43 GMT
  4.  
  5. People have mentioned Norton's [In]Diskreet here recently and I thought I'd
  6. have a look at it to see how good (or bad) its DES implementation really is (I
  7. didn't bother with the "fast, proprietary method", by all indications it's
  8. worthless).  As the summary line in the header says, don't throw away your copy
  9. of PGP yet.  For those of you who have a copy and would like a quick look at
  10. the sort of security you're buying, try the following:
  11.  
  12.    - Create a test file, I used 128 zeroes.
  13.    - Encrypt it with the password 'xxxxxx'
  14.    - Decrypt it with the password 'xxxxxx'
  15.    - Decrypt it with the password 'xxxxyy'
  16.    - Decrypt it with the password 'yyyyxx'
  17.  
  18. The DES routines themselves seem to be taken from a DES library rather than
  19. being written by Symantec/Norton.  Symantec provide the front-end, and Peter
  20. Norton provides the picture of himself wearing a pastel shirt and silly smirk
  21. for the cover of the box.  This seemed to be a good indication - perhaps the
  22. DES implementation was by someone vaguely competent, which meant Symantec would
  23. have little chance of screwing it up.
  24.  
  25. Unfortunately, as the above test shows, it isn't.  The front-end gets a
  26. password in the range of 6..40 characters, and converts it to all-uppercase
  27. (red neon sign lights up and flashes "MISTAKE.  MISTAKE.  MISTAKE").  Then it
  28. packs it into a struct along with a collection of other information and passes
  29. it to the DES library.  The DES library then takes the password and reduces it
  30. to 64 bits by cyclically xor-ing in the full-length password into an 8-byte
  31. buffer initially set to all zeroes, ie:
  32.  
  33.     for( index = 0; *password; index++ )
  34.         buffer[ index % 8 ] = *password++;
  35.  
  36. Finally, the top 32 bits of this buffer is passed to the key schedule routines
  37. and some of it used for the key schedule (this is what the sample en/decryption
  38. shows up).  They seemed to be doing a DES key schedule, but I didn't bother
  39. verifying its correctness - there didn't seem much point really.  Note that the
  40. first mistake was made by the front-end, but the second two were made in the
  41. DES library itself, meaning that both parts are incompetently implemented.  Oh
  42. well, at least Peter Norton's contribution to the whole affair doesn't weaken
  43. it's security.  Usually I check DES implementations against the NBS test data,
  44. but I couldn't be bothered ripping out the code, and the key handling provides
  45. holes big enough to drive a bus through anyway.  Note that it doesn't even use
  46. a proper 56-bit key as per the FIPS docs (although, admittedly, it's in good
  47. company there), or check for the weak keys which are possible with the key
  48. setup they're using.
  49.  
  50. The encryption itself uses DES in CBC mode with a fixed IV.  This means that,
  51. in combination with the tiny key space, it's possible to create a precomputed
  52. collection of plaintext/ciphertext pairs and "break" most encrypted files by
  53. reading the results out of a table.  Since the whole-disk encryption always
  54. begins with a fixed DOS FAT (file allocation table), this instant decryption is
  55. entirely feasible.  When encrypting files, [In]Diskreet stores the file name,
  56. date, and various other pieces of information at the start of the data and a
  57. key check sequence at the end, allowing a quick and easy check for correct
  58. passwords.
  59.  
  60. In summary, there may be a possibly-correct DES implementation in there
  61. somewhere, but it doesn't help much.  [In]Diskreet will stop a casual browser,
  62. but won't give you any protection at all against any serious attack.
  63.  
  64. ObPropaganda: There should be an encrypting filesystem offering *real* security
  65.               available within a few weeks.  The initial version will be for
  66. DOS only, and will provide sector-level encryption for entire disks. I just
  67. need to test it a bit more, I'll call for beta-testers here once it's ready.
  68.  
  69. Peter.
  70. --
  71.  pgut1@cs.aukuni.ac.nz||p_gutmann@cs.aukuni.ac.nz||gutmann_p@kosmos.wcc.govt.nz
  72. peterg@kcbbs.gen.nz||peter@nacjack.gen.nz||peter@phlarnschlorpht.nacjack.gen.nz
  73.              (In order of preference - one of 'em's bound to work)
  74.              -- DOS 6 - Double your disk space: delete Windoze --
  75.  
  76.  
  77. From: kocherp@leland.Stanford.EDU (Paul Carl Kocher)
  78. Subject: Norton Diskreet (Security overview)
  79. Date: Thu, 18 Nov 93 23:43:32 GMT
  80.  
  81.  
  82. The signal-to-noise ratio here has made me mostly stop reading
  83. sci.crypt, but I saw this and thought I'd contribute the results of
  84. some work I did with the program a year or so ago.  Hopefully there'll
  85. be a moderated group soon so I can come back (hint hint)...!
  86.  
  87.  
  88. First off, the "propriatary" algorithm is fairly easy to crytanalyze.  
  89. It uses the DES key schedule and leaks information badly.  
  90. Consequently it's quite easy to break.  Fine for stopping casual 
  91. snoopers, but definitely not something I'd use on important data.
  92. (I'm afraid my code is not available.  See note at the end.)
  93.  
  94. The DES function orders the output bits in a nonstandard way (they do
  95. the permutation differently from everyone else), but otherwise the
  96. algorithm is correct.  CBC mode is used, with a new initialization 
  97. vector every so often (I forget the block length).  The IVs repeat,
  98. so if you encrypt a few megs of zeros, the output will repeat.
  99.  
  100. The key initialization function is a very, very, very bad problem,
  101. though.  The function is actually worse than people have been
  102. suggesting, since it's case insensitive and the parity bit is
  103. the least significant bit.  The algorithm is:
  104.  
  105.       unsigned char DESKey[8] = { 0,0,0,0,0,0,0,0 };
  106.       for (n = 0; n < password_length; n++)
  107.           DESKey[n % 8] ^= toupper(password[n]);
  108.                  /* toupper converts lowercase ascii to uppercase */
  109.                  /* (n % 8) equals (n mod 8) */
  110.  
  111. To see just how bad this is, consider a password containing just
  112. letters that is known to be 16 bytes long.  This *should* give
  113. an effective keyspace significantly above that of the DES
  114. key (26^16 = 4.3 x 10^22, while the 56-bit DES key has 2^56 =
  115. 7.2 x 10^16 possibilities).  However for this password, the
  116. keyspace is actually only 32 bits (4 billion passwords):
  117.  
  118.   - The total keyspace in DESKey is 64 bits.
  119.   - The most significant bit (value 128) is zero in each password
  120.        byte, and consequently is zero in each byte the DES key,
  121.        reducing the keyspace to 56 bits.
  122.   - The bit with value 64 is set to 1 for all capital letters, lowering
  123.        the keyspace to 48 bits.
  124.   - The bit with value 32 is set to 0 in all capital letters, lowering
  125.        the keyspace to 40 bits.  (If the password length isn't known,
  126.        there are 16 different possible combinations for the bit in 
  127.        this position if the password only contains letters.)
  128.   - The lowest bit is the parity bit, and is not used, lowering the
  129.        total to 32 bits.
  130.  
  131. A PC is more than adequate to crack such passwords.  I hacked my 32-bit 
  132. DES code to optimize key searches quickly, and it took about a week to
  133. find a password for a client.  I seem to recall that I was getting a bit
  134. over 15000 passwords/second on a '386-33, though it might have been
  135. faster.  Fortunately the password was all letters, or it would 
  136. have taken longer...
  137.  
  138. >How is the key check computed? Could you post the algorithm?
  139.  
  140. It uses DES, and should be secure.  (There is quite a bit of known
  141. plaintext in the file header, and it checks to make sure this decrypts
  142. peroperly.  However, with the propriatary algorithm, this known
  143. plaintext is enough to crack the password.)
  144.  
  145. -- Paul Kocher
  146. kocherp@leland.stanford.edu
  147.  
  148. PLEASE READ BEFORE RESPONDING TO THIS POST:
  149.  
  150. My e-mail box is already flooded with messages; it has over 900 
  151. in it, about 150 of which I still have to respond to.  So if you 
  152. write please keep understand if I don't respond immediately.  If
  153. you don't hear back within a couple weeks and want a reply, resend
  154. your message, since I could easily have missed it.  So I don't have
  155. to write the same thing to 50 people:  My code/executables for 
  156. breaking DISKREET passwords are NOT available, and I don't have
  157. time to find forgotten passwords for people.  Sorry to sound so 
  158. rude and all, but I can't afford the risk of annoying the
  159. government (e.g. ITAR, etc.) or companies I'm working with by 
  160. giving out crypto code.  Plus I haven't been to bed before 3am in
  161. weeks and need more sleep :-).  While I am sometimes available for 
  162. contract work, I don't have any time available before January.
  163.  
  164.  
  165. From: pgut1@cs.aukuni.ac.nz (Peter Gutmann)
  166. Newsgroups: sci.crypt,comp.security.misc
  167. Subject: Norton's [In]Diskreet: An update
  168. Date: 13 Jul 1994 17:21:57 GMT
  169.  
  170.  
  171. Last November I picked apart part of the Diskreet encryption program and posted
  172. what I found to this group.  By some miracle I had a bit of spare time this
  173. afternoon, so I've had another quick look at it.  The result is some more
  174. information on the proprietary encryption algorithm and the file format it
  175. uses.  First, a recap of what I presented last time:
  176.  
  177. The key setup process is very badly done.  The front-end gets a password in the
  178. range of 6..40 characters, and converts it to all-uppercase.  Then it packs it
  179. into a struct along with a collection of other information and passes it to the
  180. DES library used by Diskreet.  The first thing this does is take the password
  181. and reduce it to 64 bits by cyclically xor-ing the full-length password into an
  182. 8-byte buffer initially set to all zeroes, ie:
  183.  
  184.     for( index = 0; password[ index ]; index++ )
  185.         buffer[ index % 8 ] = password[ index ];
  186.  
  187. It then performs what looks like a standard DES key schedule with the 64-bit
  188. output from this operation.  This creates 128 bytes of subkeys for encryption
  189. and 128 bytes of subkeys for decryption.  These are either used for the
  190. proprietary encryption method or for DES encryption.  Here's a rundown of the
  191. proprietary method:
  192.  
  193. All operations are performed on 16-bit words.  byteSwap() performs an
  194. endianness-reversal on a word.  Chaining is performed by xor-ing in the
  195. previous ciphertext word.  The keyTable is the 256-byte array of DES subkeys,
  196. treated as an array of words.
  197.  
  198.     data[ -1 ] = 0x1234;
  199.     index = sectorNo % 128;
  200.     index = keyTable[ index ] % 128;
  201.  
  202.     for( i = 0; i < SECTOR_SIZE / 2; i++ )
  203.         {
  204.         value = keyTable[ index++ ] + data[ i ];
  205.         byteSwap( value );
  206.         value ^= data[ i - 1 ];
  207.         data[ i ] = value;
  208.         index %= 128;
  209.         }
  210.  
  211. As can be seen, a known-plaintext attack will recover the (expanded) encryption
  212. key without too much trouble - it's just a repeated addition of a 128-word
  213. array to the data, with the previous word xor'd in for chaining purposes.  The
  214. xor and byteSwap are basically nop's and can be stripped off without any
  215. problems, revealing the key stream used to encrypt the data.  Since encryption
  216. is done by sectors, the same key data is used twice for each sectors.
  217.  
  218. How do we perform a known-plaintext attack?  It's quite simple actually, since
  219. Diskreet itself provides us with about as much known plaintext as we need.  The
  220. file format is:
  221.  
  222.     General header
  223.  
  224.     BYTE[ 16 ]          "ABCDEFGHENRIXYZ\0"
  225.     char[ 13 ]          fileName
  226.     LONG                fileDate
  227.     BYTE                fileAttributes
  228.     LONG                fileSize
  229.     LONG                file data start
  230.     BYTE[ 16 ]          0
  231.  
  232.     File data
  233.  
  234.     BYTE[ 32 ]          0
  235.  
  236.     Padding to make it a multiple of 512 bytes
  237.  
  238. Everything from the 16-byte magic value to the end of the file is encrypted in
  239. blocks of 512 bytes.  The proprietary scheme will directly reveal its key
  240. stream on the 16-byte check value, the 16 bytes of zeroes at the start, and the
  241. 32 bytes (minimum) of zeroes at the end of the data.  Interestingly enough, the
  242. presence of the 16-byte known plaintext right at the start would tend to
  243. confirm the rumours that that's one of the criteria for having an encryption
  244. program approved by the NSA.  The plaintext also gives us the name of one of
  245. the programmers involved.
  246.  
  247. In my previous posting I said:
  248.  
  249.   The encryption itself uses DES in CBC mode with a fixed IV.  This means that,
  250.   in combination with the tiny key space, it's possible to create a precomputed
  251.   collection of plaintext/ciphertext pairs and "break" most encrypted files by
  252.   reading the results out of a table.
  253.  
  254. The 16-byte known plaintext makes this attack a certainty.  In addition, if two
  255. pieces of data are encrypted with the same key, one with the proprietary method
  256. and one with DES, the DES key can be recovered from the proprietary-encrypted
  257. data and used to decrypt the DES-encrypted data.  Again quoting from my
  258. previous posting:
  259.  
  260.   In summary, there may be a correct DES implementation in there somewhere, but
  261.   it doesn't help much.  [In]Diskreet will stop a casual browser, but won't
  262.   give you any protection at all against any serious attack.
  263.  
  264. Peter.
  265.  
  266.