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

  1. *******************************************************************************************************************************************
  2.                     DaNiEl-RJ CrackMe #1
  3. *******************************************************************************************************************************************
  4.  
  5. Author:        DaNiEl-RJ
  6. Protection:    Name / Serial
  7. URL:        http://www.mesa-sys.com/~eternal/a-d/daniel-rj.zip
  8. Tools:        W32Dasm v8.93
  9.         Hex-Editor
  10.  
  11.  
  12. --->    Intro...
  13.  
  14. Welcome to my next Tutorial !!!
  15. This time we're going to crack a Name/Serial Protection "without" SoftICE :P
  16.  
  17.  
  18. --->    Let's Begin...        *** Getting a Serial ***
  19.  
  20. Open the CrackMe and you'll see just a window and an MenuItem called "File" with 2 Sub Items:
  21.  
  22. Damn! Where's the whole thing???
  23. About
  24.  
  25. But the first one is grayed (disabled) hmm.. well anyway click on "About" ;)
  26. And you'll see a Message Box saying "Greetz 2 all brazilian crackers!!! :)".
  27. Ok, that's nice :) click "Ok" to return to the Main Window and then click on the MenuItem "File"
  28. again, hey the first Sub Item is ungrayed (Enabled) Ah nice... ;P
  29. Click on it, and you'll see that a button and 2 Edit Boxes come up, ah finally something to
  30. Register with ;)
  31. Ok, enter anything you want in the Edit Boxes, i've used:
  32.  
  33. Name:        CoDe_InSiDe
  34. Serial:        1234567890
  35.  
  36. Now click on the button "Check it!" and a Message Box pops up saying:
  37.  
  38. "No no no! :( Try again!"
  39.  
  40. Remember this line :)
  41. Now close the CrackMe and disassemble it in W32Dasm.
  42. Ok, click on the button "Strn Ref" (String Data References) and search for the line:
  43.  
  44. "No no no! :( Try again!"
  45.  
  46. Double click on it and you should see this:
  47.  
  48. -------------------------------------------------------------------------------------------------------------------------------------------
  49.  
  50. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  51. |:0042D522(C)
  52. |
  53. :0042D556 8D55F8                  lea edx, dword ptr [ebp-08]
  54. :0042D559 8B86E0010000            mov eax, dword ptr [esi+000001E0]
  55. :0042D55F E8FCC8FEFF              call 00419E60
  56. :0042D564 8B45F8                  mov eax, dword ptr [ebp-08]        <--- Maybe our Serial or the Good Serial ?
  57. :0042D567 8B55FC                  mov edx, dword ptr [ebp-04]        <--- Maybe our Serial or the Good Serial ?
  58. :0042D56A E86163FDFF              call 004038D0                <--- Here it Compares those 2
  59. :0042D56F 750C                    jne 0042D57D                <--- If not equal jump to the Bad String, else continue
  60.  
  61. * Possible StringData Ref from Code Obj ->"Congratz cracker! hehehe"
  62.                                   |
  63. :0042D571 B8ECD54200              mov eax, 0042D5EC            <--- Here's the Good String
  64. :0042D576 E87DFBFFFF              call 0042D0F8
  65. :0042D57B EB0A                    jmp 0042D587
  66.  
  67. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  68. |:0042D56F(C)
  69. |
  70.  
  71. * Possible StringData Ref from Code Obj ->"No no no! :( Try again!"
  72.                                   |
  73. :0042D57D B810D64200              mov eax, 0042D610            <--- Here's the Bad String
  74. :0042D582 E871FBFFFF              call 0042D0F8
  75.  
  76. * Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
  77. |:0042D4F6(U), :0042D57B(U)
  78. |
  79. :0042D587 33C0                    xor eax, eax
  80. :0042D589 5A                      pop edx
  81. :0042D58A 59                      pop ecx
  82. :0042D58B 59                      pop ecx
  83.  
  84. -------------------------------------------------------------------------------------------------------------------------------------------
  85.  
  86. Ok, well remember that "jne 0042D57D" for Patching ;)
  87. Now just scroll a bit up because we need to find the Algo :)
  88. So scroll up till you see something like this:
  89.  
  90. -------------------------------------------------------------------------------------------------------------------------------------------
  91.  
  92. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  93. |:0042D4EA(C)
  94. |
  95. :0042D4FB BB01000000              mov ebx, 00000001            <--- Move 00000001 in EBX
  96.  
  97. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  98. |:0042D491(C)
  99. |
  100. :0042D500 8D55F8                  lea edx, dword ptr [ebp-08]
  101.  
  102. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  103. |:0042D4A0(C)
  104. |
  105. :0042D503 8B86DC010000            mov eax, dword ptr [esi+000001DC]
  106. :0042D509 E852C9FEFF              call 00419E60
  107. :0042D50E 8B45F8                  mov eax, dword ptr [ebp-08]        <--- Point EAX to your Name (Probably)
  108. :0042D511 E8AA62FDFF              call 004037C0                <--- If you check here, it takes the length of your Name (Probably)
  109. :0042D516 8BF8                    mov edi, eax                <--- Move EAX in EDI
  110. :0042D518 8D45FC                  lea eax, dword ptr [ebp-04]
  111. :0042D51B E82460FDFF              call 00403544
  112. :0042D520 3BFB                    cmp edi, ebx                <--- Compare EBX (00000001) with EDI (Length of Name (Probably))
  113. :0042D522 7C32                    jl 0042D556                <--- If lower jump and fail, else continue
  114.  
  115. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  116. |:0042D554(C)
  117. |
  118. :0042D524 8D55F8                  lea edx, dword ptr [ebp-08]
  119. :0042D527 8B86DC010000            mov eax, dword ptr [esi+000001DC]
  120. :0042D52D E82EC9FEFF              call 00419E60
  121. :0042D532 8B45F8                  mov eax, dword ptr [ebp-08]        <--- Move the Offset to our Name in EAX (Probably)
  122. :0042D535 33D2                    xor edx, edx                <--- XOR EDX which is now 00
  123. :0042D537 8A5418FF                mov dl, byte ptr [eax+ebx-01]        <--- Move first Char in DL
  124. :0042D53B 83C205                  add edx, 00000005            <--- ADD 00000005 to DL
  125. :0042D53E 8D45F0                  lea eax, dword ptr [ebp-10]
  126. :0042D541 E8A261FDFF              call 004036E8                <--- In here it places DL to some place
  127. :0042D546 8B55F0                  mov edx, dword ptr [ebp-10]
  128. :0042D549 8D45FC                  lea eax, dword ptr [ebp-04]
  129. :0042D54C E87762FDFF              call 004037C8
  130. :0042D551 43                      inc ebx                <--- EBX +1
  131. :0042D552 3BFB                    cmp edi, ebx                <--- Compare EBX with EDI
  132. :0042D554 7DCE                    jge 0042D524                <--- If equal or greater repeat loop, else continue
  133.  
  134. -------------------------------------------------------------------------------------------------------------------------------------------
  135.  
  136. Well first of all you may think "Hey that guy knows exactly what all the stuff does???" ;)
  137. About all these instruction, yes that's not so hard, "But what about the calls???"...
  138. I know that because i allready cracked a lot of Delphi programs and they all work the same :P
  139. If you don't believe me then check it with SoftICE (Believe me i haven't looked in it with SoftICE) :)
  140. Well anyway as you can see the Algo is very small :)
  141. It takes a Char of your Name and ADD's 00000005 to it, then places it somewhere and then takes the next Char and so on...
  142. So for my Name it does this:
  143.  
  144. Ascii        C  o  D  e  _  I  n  S  i  D  e
  145. Hex        43 6F 44 65 5F 49 6E 53 69 44 65
  146.         --------------------------------    ADD 00000005
  147. Result        48 74 49 6A 64 4E 73 58 6E 49 6A
  148. Ascii        H  t  I  j  d  N  s  X  n  I  j
  149.  
  150. That's it, try it with your Name, my final result:
  151.  
  152. Name:        CoDe_InSiDe
  153. Serial:        HtIjdNsXnIj
  154.  
  155. And if you try it, it works :P
  156. CrackMe cracked, now to the Patching ;)
  157.  
  158.  
  159. --->    Let's Begin...        *** Patching ***
  160.  
  161. Ok, remember the place where i said "Ok, well remember that "jne 0042D57D" for Patching ;)".
  162. Go there and click on the line "jne 0042D57D" then write down the Offset you see below in W32Dasm, it's "0002C96F".
  163. Now if you look a bit up you'll see the instruction "mov edx, dword ptr [ebp-04]" remember those Opcodes (or write it down) it's "8B55FC".
  164. Why ???
  165. Because if you've looked closely to the Algo and surrounding Code (and because of the Compare call and jne) you'll see that it probably
  166. leads to the Good Serial, (the instruction in front of it leads probably to our "Fake" Serial).
  167. I want to use that instruction to show the Good Serial everytime in the Message Box :P
  168. BUT !!!
  169. As you maybe notice for the Good String (Congratz cracker! hehehe) it's located in EAX and our code leads to EDX :(
  170. To fix this look at the Opcodes from the instruction "mov eax, dword ptr [ebp-08], the Opcodes are "8B45F8".
  171. But we need it from "[ebp-04]", just change the Opcodes to "8B45FC" :)
  172. Ok, now we got the Offsets now we can close W32Dasm and open the file in a Hex-Editor, do it.
  173. Go to the Offset "0002C96F" for the "jne 0042D57D".
  174. Just NOP it away :)
  175. Then take a look at the bytes after it change it into this (remember those Opcodes from above?):
  176.  
  177. B8ECD54200
  178.  
  179. into
  180.  
  181. 8B45FC9090        (9090 to make it run smooth ;)
  182.  
  183. Save the file and run it.
  184. It work's :P now it shows for any Name the real Serial ! ;)
  185. That's all...
  186.  
  187.  
  188. --->    Greetings...
  189.  
  190. To be honest i'm getting a bit sick of these greetings everytime ;P
  191. So i'll just say:
  192.  
  193. Greetings to everyone i know, and to everyone who knows me, and You... ;P
  194.  
  195.  
  196.             Don't trust the Outside, trust the InSiDe !!!
  197.  
  198.                       Cya...
  199.  
  200.                     CoDe_InSiDe
  201.  
  202.  
  203. Email:    code.inside@home.nl