home *** CD-ROM | disk | FTP | other *** search
/ Chaos Computer Club 1997 February / cccd_beta_feb_97.iso / chaos / ds54 / ds54_13.txt < prev    next >
Text File  |  1997-02-28  |  4KB  |  151 lines

  1.     Seite 12    Aus~be 54
  2.  
  3. From: Frank Andrew Stevenson
  4. cfrank@ funcom.no~
  5. TQ. cypherpunks@toad.com
  6. Subject: Cracked: WINDOWS,PWL
  7. Date: Mon, 4 Dec 1995 17:51:36 +0100
  8. (ME~
  9.  
  10. A few days ago Peter Gutmann posted a
  11. description on how Windews 95 produces
  12. RC4 keys of 32 bits size to protect the .pwl
  13. files. I verif~ed the information and wrote a
  14. program to decrypt ,pwl files with a known
  15. password, I then discovered that the .pwl files
  16. where well sulted for a known plaintext
  17. attack as the 20 D~rst bytes are completely pre-
  18. dictable.
  19. The 20 first bytes of any .pwl files contains
  20. the username, which is the same as the f~lena-
  21. me, in capitals, padded with 0x00. From then
  22. I wrote a program to bruteforce the .pwl file
  23. and optimized it so it would run in less than
  24. 24 hours on an SGI. I run a test of the bruter
  25. software and recovered an untnown rc4 key
  26. in 8 hours, but the decrypted f~le was still lar-
  27. gely uninteligeble, I then proceeded to
  28. decrypt the file at all possible starting points,
  29. and discovered valuable information
  30. (cleartext passwords) offset in the file. This
  31. has enormous implications: RC4 is a stream
  32. cipher, it generates a long pseudo randor,n
  33. stream that it uses to XOR the data byte by
  34. byte. This isn't neccecaraly weak encryption
  35. if you don't use the same strearn twice: howe-
  36. ver WIN95 does, every resource is XORed
  37. with the sarne pseudo random stream. What's
  38. more the 20 first bytes are easy to ,guess. This
  39. is easy to exploit: XOR the 20 bytes starting
  40. at position 0x20X with the user name in
  41. uppercase, and slide this string through the
  42. rest of the file (xoring it with whatever is
  43. there) this reveal,s the 20 f~rst bytes of the dif-
  44. ferent resources.
  45. From there I went on to study the structure of
  46. the .pwl file it is something like this (decryp-
  47. ted):
  48.  
  49.     USERNA}4E    WPWPWPWPWPWPWPWP
  50.  
  51. wpwp
  52. rs???????
  53.  
  54. rs
  55.  
  56. rs
  57. rs?7?????????
  58. rs???????
  59.  
  60. where wp is i word pointer to the different
  61. resoürces (from start of pwl file) The 2 first
  62. bytes of the resource (rs) is its length in bytes
  63. (of course XOR with RC4 outpüt) It is the
  64. fairly easy to find all the resource pointers by
  65. jumping from start of resource to next resour-
  66. ce, had it not been for the fact that the size
  67. sometimes is incorrect (courtesy of M$)
  68. What follows is a short c program that tries to
  69. remedy this and reconstruot the pointertable
  70. thüs generating at least 54 bytes of the pseu-
  71. dorandom stream, and then proceedes to
  72. decrypt as much as possible from the
  73. different resources.
  74. What does this show? Although RC4 is a fair-
  75. ly strong cipher, it has the same limitations as
  76. any XOR streamcipher, and implementing it
  77. without sufficient knowledge can have dire
  78. consequences. I stron.gly suggest that the pro-
  79. grarnmers at Microsoft do their homework
  80. before trying anything like this again!
  81. DISCLAIMER:
  82. This is a quick hack, I don't make any claims
  83. about usefulness for any purpose, nor do I
  84. take responsibility for use nor consequences
  85. of use of the software. F[JNCOM of Norway
  86. is not ~esponsible for any of this,
  87. (I speak for myself, and let others speak for
  88. themselves)
  89.  
  90. This source is hereby placed in the public
  91. domain, please improve if you can.
  92.  
  93.     ~c ~sicnie~ku~cr - Das wissenschaftliche Fachblatt fÜr Daterueisende    [ -
  94.  
  95. ~f. £st - - Ial~cr - Das wissenschaftliche Fachblatt fUr Datenreisende.
  96.  
  97. Aüsgabe 54
  98.  
  99. Seite 13
  100.  
  101. glide c ---
  102.  
  103. #include cstdio.h~
  104. #include cstrTng h>
  105.  
  106. unsigned char Data[100001 l;
  107. unsigned char keystream[1001];
  108. int Rpointl300];
  109.  
  110. main (int argc,char ~argv~)
  111. FILE *fd;
  112. int i,j,k;
  113. int size;
  114. char ch;
  115. char *name;
  116. int cracked;
  117. int sizemask;
  118. int maxr;
  119. int rsz;
  120. int pos;
  121. int Rall[300]; /* resource allocation table */
  122.  
  123. if (argcc2) ~
  124. prinff(''usage: glide filename (usemame)");
  125. exit(1 );
  126.  
  127. t. read PWL file ./
  128.  
  129. fd=fopen(argvl1 ],"rb");
  130. if(fd--NULL) (
  131. printf(''can't open file %s",argv[2]);
  132. exit(1 );
  133. )
  134. size=0;
  135. while(ffeof(fd))
  136.  
  137. stze--;
  138. fciose(fd);
  139.  
  140. Datalsize++]=fgetc(fd);
  141.  
  142. /* find usemame */
  143. name=argv|1];
  144. if(argc>2) name=argv|2];
  145. pRntf("Use mame: %sYn",name);
  146.  
  147. /* copy encrypted text inlo keystream */
  148.  
  149. [^
  150.  
  151.