home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / E_bliss / cosh3.txt < prev    next >
Text File  |  2000-05-25  |  9KB  |  209 lines

  1.                 *****************************************
  2.                 *                                       *
  3.                 *          RingZer0   Presents          *
  4.                 *                                       *
  5.                 *     "CoSH Crackme3"  by PUSILLUS      *
  6.                 *              23/2/99                 *
  7.                 *****************************************
  8.  
  9.  
  10. Sorry for my bad english :(
  11.  
  12. Tools:
  13.  
  14.   SoftIce.
  15.  
  16.  
  17.  
  18.  
  19. Run the program, enter in SIce and type TASK:
  20.  
  21. Taskname      SS:SP       StackTop   StackBot   StackLow   TaskDB   hQueue   Events 
  22. crackme3    0000:0000     005ED000   05F0000                11DE    0E47     0000
  23. ...
  24.  
  25. Type "HWND crackme3" to get handles of our program:
  26.  
  27. Window-Handle   hQueue    SZ    QOwner   Class_Name       Window Procedure
  28. 03AC(1)         OE47      32    CRACKME3 #32770 (Dialog)  1457:00000694
  29.  03CC(2)        OE47      32    CRACKME3 Button           ...
  30.  03A8(2)        OE47      32    CRACKME3 Static           ...
  31.  0400(2)        OE47      32    CRACKME3 Static           ...
  32.  03FC(2)        OE47      32    CRACKME3 Edit             ... 
  33.  03E0(2)        OE47      32    CRACKME3 Edit             ... 
  34.  ...
  35.  
  36. Put a breakpoint at "BMSG 03fc WM_GETTEXT" and exit Sice.
  37.  
  38. Type some values in edit controls of the dialogbox, for example 
  39. "pusillus" and "00000000", and click on "OK" button. The debugger break in
  40. Kernel.alloc with F12 we return from various calls and we can see the MFC42
  41. calling at GetWindowTextA.
  42. before this call there are some instructions:
  43. ....
  44. PUSH EAX 
  45. PUSH DWORD PTR [ESI+20]
  46. GetWindowTextA
  47. ....
  48. we can put a break in PUSH EAX to get the address where the edit control text is
  49. stored.
  50. When I've executed the program for the first time  I've pressed one more time F12
  51. to go back in the crackme code, and I've explored the contents of registers, 
  52. ECX contain the location of stored text ;). 
  53. for the first call to MFC GetWindowTextA at address 00401533, ECX is 00760A7C (the address of
  54. name), and for the second call at 00401548 ECX is 00760A9C (the address off password)
  55.  
  56.  
  57. ---------------------------
  58. :00401521 8B45E0                  mov eax, dword ptr [ebp-20]
  59. :00401524 05E0000000              add eax, 000000E0
  60. :00401529 50                      push eax
  61. :0040152A 8B4DE0                  mov ecx, dword ptr [ebp-20]
  62. :0040152D 81C1A0000000            add ecx, 000000A0
  63.  
  64. * Reference To: MFC42.Ordinal:0F22, Ord:0F22h
  65.                                   |
  66. :00401533 E866030000              Call 0040189E                <----- read the Name
  67. :00401538 8B4DE0                  mov ecx, dword ptr [ebp-20]
  68. :0040153B 81C1E4000000            add ecx, 000000E4
  69. :00401541 51                      push ecx
  70. :00401542 8B4DE0                  mov ecx, dword ptr [ebp-20]
  71. :00401545 83C160                  add ecx, 00000060
  72.  
  73. * Reference To: MFC42.Ordinal:0F22, Ord:0F22h
  74.                                   |
  75. :00401548 E851030000              Call 0040189E                <----  read the Pwd
  76. :0040154D 8B55E0                  mov edx, dword ptr [ebp-20]
  77. :00401550 81C2E0000000            add edx, 000000E0
  78. :00401556 52                      push edx
  79. :00401557 8D4DE4                  lea ecx, dword ptr [ebp-1C]
  80. ---------------------------
  81.  
  82. with F10 walk through the code, at address 00401570 the program resets all registers
  83. and at 0040157D  it move in EAX the address of the name:  
  84.  
  85.  
  86. ---------------------------
  87. :00401570 33C0                    xor eax, eax        
  88. :00401572 33DB                    xor ebx, ebx          
  89. :00401574 33C9                    xor ecx, ecx
  90. :00401576 B901000000              mov ecx, 00000001            <--  cl=1
  91. :0040157B 33D2                    xor edx, edx
  92. :0040157D 8B45E4                  mov eax, dword ptr [ebp-1C]  <--  EAX=00760A7C
  93.  
  94. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  95. |:0040158B(C)
  96. |
  97. :00401580 8A18                    mov bl, byte ptr [eax]       <-- bl=byte pointed by EAX       
  98. :00401582 32D9                    xor bl, cl                   <-- xor bl , cl  
  99. :00401584 8818                    mov byte ptr [eax], bl       <-- byte pointed by EAX is
  100.                                    replaced with bl
  101. :00401586 41                      inc ecx                      <-- ECX + 1      
  102. :00401587 40                      inc eax                      <-- EAX + 1
  103. :00401588 803800                  cmp byte ptr [eax], 00
  104. :0040158B 75F3                    jne 00401580                 <-- processing all values 
  105.                                    in the string
  106. ---------------------------                                                               
  107.                                                                   
  108. in my example:
  109.  
  110. 00760A7C =             70 75 73 69 6c 6c 75 73          (pusillus)
  111.            XOR cl      01 02 03 04 05 06 07 08
  112. 00760A7C =             71 77 70 6d 69 6a 72 7b
  113.  
  114.  
  115. proceding with F10, we reach the code where the pwd is processed:
  116.  
  117. ---------------------------
  118. :0040158D 33C0                    xor eax, eax
  119. :0040158F 33DB                    xor ebx, ebx
  120. :00401591 33C9                    xor ecx, ecx
  121. :00401593 B90A000000              mov ecx, 0000000A            <-- ECX=0A
  122. :00401598 33D2                    xor edx, edx
  123. :0040159A 8B45F0                  mov eax, dword ptr [ebp-10]  <-- EAX=00760A9C 
  124.  
  125. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  126. |:004015A8(C)
  127. |
  128. :0040159D 8A18                    mov bl, byte ptr [eax]       <-- bl= byte pointed by eax
  129. :0040159F 32D9                    xor bl, cl                   <-- xor bl , cl
  130. :004015A1 8818                    mov byte ptr [eax], bl       <-- byte pointed by eax = bl
  131. :004015A3 41                      inc ecx
  132. :004015A4 40                      inc eax
  133. :004015A5 803800                  cmp byte ptr [eax], 00       <-- looping for all the string 
  134. :004015A8 75F3                    jne 0040159D                     
  135. ---------------------------
  136.  
  137. password processing is the same but CL is initialized with 0A:
  138.  
  139.  
  140. 00760A9C =             30 30 30 30 30 30 30 30          (00000000)
  141.            XOR cl      0A 0B 0C 0D 0E 0F 10 11
  142. 00760A9C =             3A 3B 3C 3D 3E 3F 20 21
  143.  
  144.  
  145. The two modified strings are compared:
  146.  
  147. ---------------------------
  148. :004015AA 8B45E4                  mov eax, dword ptr [ebp-1C]  <-- 00760A7C
  149. :004015AD 8B55F0                  mov edx, dword ptr [ebp-10]  <-- 00760A9C
  150.  
  151. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  152. |:004015BF(C)
  153. |
  154. :004015B0 33C9                    xor ecx, ecx
  155. :004015B2 8A18                    mov bl, byte ptr [eax]       <-- bl= byte pointed by eax
  156. :004015B4 8A0A                    mov cl, byte ptr [edx]       <-- cl= byte pointed by edx
  157. :004015B6 3AD9                    cmp bl, cl                   <-- comparison
  158. :004015B8 7509                    jne 004015C3                 <-- not equals jump to "ERROR"
  159. :004015BA 40                      inc eax
  160. :004015BB 42                      inc edx
  161. :004015BC 803800                  cmp byte ptr [eax], 00       <-- end string control
  162. :004015BF 75EF                    jne 004015B0                 <-- cycling all the string 
  163. :004015C1 EB16                    jmp 004015D9                 <-- jump to "YOU DID IT"         
  164.  
  165. * Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
  166. |:00401503(U), :0040151C(U), :004015B8(C)
  167. |
  168. :004015C3 6A00                    push 00000000
  169.  
  170. * Possible StringData Ref from Data Obj ->"ERROR"
  171.                                   |
  172. :004015C5 686C304000              push 0040306C
  173.  
  174. * Possible StringData Ref from Data Obj ->"One of the Details you entered "
  175.                                         ->"was wrong"
  176.                                   |
  177. :004015CA 6840304000              push 00403040
  178. :004015CF 8B4DE0                  mov ecx, dword ptr [ebp-20]
  179.  
  180. * Reference To: MFC42.Ordinal:1080, Ord:1080h
  181.                                   |
  182. :004015D2 E8BB020000              Call 00401892
  183. :004015D7 EB14                    jmp 004015ED
  184.  
  185. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  186. |:004015C1(U)
  187. |
  188. :004015D9 6A00                    push 00000000
  189.  
  190. * Possible StringData Ref from Data Obj ->"YOU DID IT"
  191.                                   |
  192. :004015DB 6834304000              push 00403034
  193.  
  194. * Possible StringData Ref from Data Obj ->"Well done,Cracker"
  195.                                   |
  196. :004015E0 6820304000              push 00403020
  197. ---------------------------
  198.  
  199. Ok we can calculate a valid serial for name "pusillus":
  200.  
  201.         71 77 70 6d 69 6a 72 7b  <-- values calculated by the program for "pusillus"
  202.         0A 0B 0C 0D 0E 0F 10 11  <-- xoring
  203.         7B 7C 7C 60 67 65 62 6A  <-- correct password: {||`gebj
  204.         
  205.         
  206. Please visit our Italian cracking homepage at http://ringzer0.cjb.net
  207.  
  208.  
  209. Pusillus.