home *** CD-ROM | disk | FTP | other *** search
/ KeyGen Studio 2002 / KeyGen_Studio_2002.iso / Tutorials / Code Inside / Tut8.txt < prev    next >
Encoding:
Text File  |  2001-09-21  |  7.5 KB  |  162 lines

  1. ********************************************************************************************************************************************************************
  2.                     cyT0m!c's CrackMe #1
  3. ********************************************************************************************************************************************************************
  4.  
  5. Author:        cyT0m!c
  6. Protection:    Name / Serial
  7. URL:        http://www.blubb.at/sweety/cracking/crackmez/Cytomic.zip
  8. Tools:        SoftICE 4.05
  9.         W32Dasm V8.93
  10.         Hex-Editor
  11.  
  12.  
  13. --->    Intro...
  14.  
  15. Hi welcome to my next CrackMe Tutorial !!!
  16. This CrackMe has a very simple Algo and is meant for Newbies :)
  17. First i'm going to "Sniff the Serial" then i'll patch it.
  18.  
  19.  
  20. --->    Let's Begin...        *** Serial Sniffing ***
  21.  
  22. Open the CrackMe and you'll see two edit boxes, one for your Name and one for your Serial.
  23. Just fill in some Name and Serial, i've used:
  24.  
  25. Name:        CoDe_InSiDe
  26. Serial:        1234567890
  27.  
  28. Ok, now were going to set a breakpoint.
  29. Get into SoftICE (CTRL+D) and type "bpx hmemcpy" then press enter, and out of SoftICE (CTRL+D). then press "Try It..." and SoftICE will popup.
  30. Ok, now type "BC *" to disable the breakpoint and press (F12) 12 times and we're in the CrackMe code.
  31. Now you'll see this:
  32.  
  33. --------------------------------------------------------------------------------------------------------------------------------------------------------------------
  34.  
  35. :0042506A 8D55F4                  lea edx, dword ptr [ebp-0C]        <--- HERE WE LAND AFTER THE BREAK !!!
  36. :0042506D 8B83BC010000            mov eax, dword ptr [ebx+000001BC]
  37. :00425073 E888C9FEFF              call 00411A00
  38. :00425078 8B45F4                  mov eax, dword ptr [ebp-0C]
  39. :0042507B 8D55F8                  lea edx, dword ptr [ebp-08]
  40. :0042507E E871D7FDFF              call 004027F4                <--- Here it puts the "Fake" Serial in a Register in Decimal format
  41. :00425083 8BF0                    mov esi, eax                <--- Move EAX in ESI
  42. :00425085 8B45FC                  mov eax, dword ptr [ebp-04]
  43. :00425088 E813010000              call 004251A0                <--- Here's the Algo !!!
  44. :0042508D 8BF8                    mov edi, eax                <--- Move EAX in EDI
  45. :0042508F 3BFE                    cmp edi, esi                <--- Compare ESI with EDI
  46. :00425091 7418                    je 004250AB                <--- If equal jump to Good Guy, else continue to Bad Guy (Remember this spot for Patching :)
  47.  
  48. --------------------------------------------------------------------------------------------------------------------------------------------------------------------
  49.  
  50. Ok, once you land here you can skip the first CALL so trace to the CALL 004027F4.
  51. It's not necessary to look in this CALL, but maybe its interesting :)
  52. I won't explain it too much, but your "Fake" Serial will be put in Decimal format in Register EAX.
  53. When your out of the CALL you can do a "? EAX" to see your "Fake" Serial in Decimal format :)
  54. Ok, now step into the CALL 004251A0 <--- This is the Algo :)
  55. And you'll see this:
  56.  
  57. --------------------------------------------------------------------------------------------------------------------------------------------------------------------
  58.  
  59. :004251A0 53                      push ebx
  60. :004251A1 89C3                    mov ebx, eax                <--- Move EAX in EBX    (EBX now holds the offset to our Name)
  61. :004251A3 83FB00                  cmp ebx, 00000000            <--- Compare EBX with 00000000
  62. :004251A6 7413                    je 004251BB                <--- If equal jump to the end, else continue
  63. :004251A8 B801000000              mov eax, 00000001            <--- Move 00000001 in EAX
  64. :004251AD 31C9                    xor ecx, ecx                <--- XOR ECX which is now 00
  65.  
  66. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  67. |:004251B9(U)
  68. |
  69. :004251AF 8A0B                    mov cl, byte ptr [ebx]        <--- Move first Char in CL
  70. :004251B1 80F900                  cmp cl, 00                <--- Compare CL with 00 (Are we at the end of our Name ?)
  71. :004251B4 7405                    je 004251BB                <--- If equal we jump to the end, else continue to make the Serial
  72. :004251B6 F7E1                    mul ecx                <--- You can see this as "Multiply ECX with EAX"
  73. :004251B8 43                      inc ebx                <--- EBX +1
  74. :004251B9 EBF4                    jmp 004251AF                <--- Repeat loop
  75.  
  76. * Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
  77. |:004251A6(C), :004251B4(C)
  78. |
  79. :004251BB 25FFFFFF0F              and eax, 0FFFFFFF            <--- Logical AND between 0FFFFFFF and EAX
  80. :004251C0 5B                      pop ebx
  81. :004251C1 C3                      ret
  82.  
  83. --------------------------------------------------------------------------------------------------------------------------------------------------------------------
  84.  
  85. Ok, so here we got the Algo very small :)
  86. Well it goes like this:
  87.  
  88. "CoDe_InSiDe"
  89. Move 00000001 in EAX
  90. Move first char in CL            Which is "C" (Hex = 43)
  91. Compare CL with 00            Are we at the end of our Name ?
  92. Multiply ECX (43) with EAX (01)        EAX now holds 00000043    (43*1=43)
  93. Increase EBX                Points to the next Char
  94.  
  95. Move Second Char in CL            Which is "o" (Hex = 6F)
  96. Compare CL with 00            Are we at the end of our Name ?
  97. Multiply ECX (6F) with EAX (43)        EAX now holds 00001D0D    (6F*43=1D0D)
  98. Increase EBX                Points to the next Char
  99. And so on...
  100.  
  101. At the end it also does "and eax, 0FFFFFFF" this is to make the last Character a "0" so that the Serial won't be negative :)
  102.  
  103. Ok, now the final result is within EAX , now when you get out of this CALL you'll see that it moves EAX to EDI.
  104. And then it compares ESI ("Fake" Serial) with EDI ("Real" Serial) very easy huh? :)
  105. Now to know our "Real" Serial (In Readable Characters) we just do a "? EDI" and you'll notice a decimal value in SoftICE, my Serial was:
  106.  
  107. Name:        CoDe_InSiDe
  108. Serial:        156742880
  109.  
  110. Ok, that's it for the "Serial Sniffing" now on to the Patching :)
  111.  
  112.  
  113. --->    Let's Begin        *** Patching ***
  114.  
  115. Ok, fire up W32Dasm and disassemble the file "CrackMe.exe", now we can get to the Patching place in 2 ways.
  116.  
  117. 1. In W32Dasm go to "String Data References" and search for "That isn't it, keep on trying..." or the Good Guy message and double click on it, then trace a few
  118.    lines up till you see "je 004250AB".
  119.  
  120. 2. Did you remembered where i said (in this file) "Remember this spot for Patching :)", well in W32Dasm you can go to the same offset by pressing (SHIFT+F12)
  121.    and then typing "00425091" and click OK.
  122.  
  123. When your there notice the line at the bottom of W32Dasm, it says:
  124.  
  125. Line:86494 Pg 1730 and 1731 of 1738 Code Data @:00425091 @Offset 00024491h in File:CrackMe.exe
  126.  
  127. The only important part for us is "@Offset 00024491h". Now open up an Hex-Editor and go to that offset "00024491".
  128. We know that it needs to jump to make us succeed :) so we're going to put an "EB" into it, change it into this (Don't forget to close W32Dasm):
  129.  
  130. 7418    --->    EB18
  131.  
  132. That's it save the file (or make a backup) and run it, now every Serial will work :)
  133. You can also change this, notice the two bytes in front of the JE it's:
  134.  
  135. 3BFE    --->    (cmp edi, esi)
  136.  
  137. You can change this into:
  138.  
  139. 3BFF    --->    (cmp edi, edi)
  140.  
  141. Now it checks the "Real" Serial with the "Real" Serial so it's always correct :)
  142. Or you can change it into:
  143.  
  144. 3BF6    --->    (cmp esi, esi)
  145.  
  146. Now it checks the "Fake" Serial with the "Fake" Serial so that's also always correct :), have fun with it...
  147.  
  148.  
  149. --->    Greetings...
  150.  
  151. Everybody at TrickSoft        (www.TrickSoft.net)
  152. Everybody at Cracking4Newbies    (www.Cracking4Newbies.com)
  153. And You...
  154.  
  155.  
  156.                Don't trust the Outside, trust the InSiDe !!!
  157.  
  158.                         Cya...
  159.  
  160.                      CoDe_InSiDe
  161.  
  162. Email:    code.inside@home.nl