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

  1. *********************************************************************************************************************************************
  2.                 Official CFF CrackMe #3
  3. *********************************************************************************************************************************************
  4.  
  5. Author:        Acid Bytes
  6. Protection:    Name / Serial
  7. URL:        http://www.mesa-sys.com/~eternal/a-d/cffo-3.zip
  8. Tools:        SoftICE v4.05
  9.         ProcDump v1.6.2
  10.         Hex-Editor
  11.         W32Dasm v8.93
  12.  
  13.  
  14. --->    Intro...
  15.  
  16. Welcome to my next Tutorial !!!
  17. Ok, first i'm going to find the Name/Serial with SoftICE :)
  18. Then i'm going to Manually Unpack it (it's UPX, you can use the program UPX itself to Unpack but
  19. why should I ;P).
  20. And then i'll patch it in some ways.
  21.  
  22.  
  23. --->    Let's Begin...        *** SoftICE ***
  24.  
  25. Ok, open the CrackMe and it asks us for a Name and Serial, enter anything you want i've used:
  26.  
  27. Name:        CoDe_InSiDe
  28. Serial:        1234567890
  29.  
  30. Then get into SoftICE (CTRL+D) and type "bpx hmemcpy", then press (CTRL+D) to get out of SoftICE
  31. and now press the button "Register now !" and SoftICE should popup.
  32. Ok, now type "BC *" to clear the breakpoint and press (F12) 12 times and you'll see this:
  33.  
  34. ---------------------------------------------------------------------------------------------------------------------------------------------
  35.  
  36. :00440ED4 837DFC00                cmp dword ptr [ebp-04], 00000000    <--- Check if we entered a Name
  37. :00440ED8 7518                    jne 00440EF2                <--- Jump if we entered a Name, else show a Message Box
  38. :00440EDA 6A00                    push 00000000
  39.  
  40. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  41. |:00440E6B(C)
  42. |
  43. :00440EDC B9C80F4400              mov ecx, 00440FC8            <--- String: No Name entered
  44. :00440EE1 BAD80F4400              mov edx, 00440FD8            <--- String: Enter a Name!
  45. :00440EE6 A1442C4400              mov eax, dword ptr [00442C44]
  46. :00440EEB 8B00                    mov eax, dword ptr [eax]
  47. :00440EED E876C1FFFF              call 0043D068                <--- Call Message Box
  48.  
  49. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  50. |:00440ED8(C)
  51. |
  52. :00440EF2 8D55FC                  lea edx, dword ptr [ebp-04]
  53. :00440EF5 8B83C8020000            mov eax, dword ptr [ebx+000002C8]
  54. :00440EFB E820FFFDFF              call 00420E20                <--- Not important
  55.  
  56. ---------------------------------------------------------------------------------------------------------------------------------------------
  57.  
  58. In here it simply checks if we entered a Name, if so it jumps over the Message Box, let's see what's next:
  59.  
  60. ---------------------------------------------------------------------------------------------------------------------------------------------
  61.  
  62. :00440F00 837DFC00                cmp dword ptr [ebp-04], 00000000    <--- Check if we entered a Serial
  63. :00440F04 7518                    jne 00440F1E                <--- Jump if we entered a Serial, else show a Message Box
  64. :00440F06 6A00                    push 00000000
  65.  
  66. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  67. |:00440E99(C)
  68. |
  69. :00440F08 B9E80F4400              mov ecx, 00440FE8            <--- String: No Serial entered
  70. :00440F0D BAFC0F4400              mov edx, 00440FFC            <--- String: Enter a Serial!
  71. :00440F12 A1442C4400              mov eax, dword ptr [00442C44]
  72. :00440F17 8B00                    mov eax, dword ptr [eax]
  73. :00440F19 E84AC1FFFF              call 0043D068                <--- Call Message Box
  74.  
  75. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  76. |:00440F04(C)
  77. |
  78. :00440F1E 8D55FC                  lea edx, dword ptr [ebp-04]
  79. :00440F21 8B83C4020000            mov eax, dword ptr [ebx+000002C4]
  80. :00440F27 E8F4FEFDFF              call 00420E20                <--- Not important
  81.  
  82. ---------------------------------------------------------------------------------------------------------------------------------------------
  83.  
  84. And here it simply checks if we entered a Serial :), if so it jumps over the Message Box, let's see what's next:
  85.  
  86. ---------------------------------------------------------------------------------------------------------------------------------------------
  87.  
  88. :00440F2C 8B45FC                  mov eax, dword ptr [ebp-04]        <--- EAX now points to our Name
  89. :00440F2F BA14104400              mov edx, 00441014            <--- Hmmm.... the String: Registered User
  90. :00440F34 E8F32BFCFF              call 00403B2C                <--- Compare those 2
  91. :00440F39 7551                    jne 00440F8C                <--- If not equal jump to Bad Message Box, else continue
  92. :00440F3B 8D55FC                  lea edx, dword ptr [ebp-04]
  93. :00440F3E 8B83C8020000            mov eax, dword ptr [ebx+000002C8]
  94. :00440F44 E8D7FEFDFF              call 00420E20                <--- Not important
  95.  
  96. ---------------------------------------------------------------------------------------------------------------------------------------------
  97.  
  98. Hmm... you see that :) it Compares the String: Registered User with our Name, if not equal it jumps to the Bad Message Box.
  99. So instead of entering our Name in the first Edit Box we need to place there: Registered User :)
  100. Ok change your Name into: Registered User and get back to this place or when your on the "jne 00440F8C" type "r fl z" so
  101. we can continue to see what's next, so let's check what's next:
  102.  
  103. ---------------------------------------------------------------------------------------------------------------------------------------------
  104.  
  105. :00440F49 8B45FC                  mov eax, dword ptr [ebp-04]        <--- EAX now points to our "Fake" Serial
  106. :00440F4C BA2C104400              mov edx, 0044102C            <--- Hmmm.... the String: GFX-754-IER-954
  107. :00440F51 E8D62BFCFF              call 00403B2C                <--- Compare those 2
  108. :00440F56 751A                    jne 00440F72                <--- If not equal jump to Bad Message Box, else continue
  109. :00440F58 6A00                    push 00000000                                        <--+
  110. :00440F5A B93C104400              mov ecx, 0044103C            <--- String: CrackMe cracked successfully       |
  111. :00440F5F BA5C104400              mov edx, 0044105C            <--- String: Congrats! You cracked this CrackMe!   |
  112. :00440F64 A1442C4400              mov eax, dword ptr [00442C44]                                   | Good Message Box
  113. :00440F69 8B00                    mov eax, dword ptr [eax]                                   |
  114. :00440F6B E8F8C0FFFF              call 0043D068                                           |
  115. :00440F70 EB32                    jmp 00440FA4                                        <--+
  116.  
  117. * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  118. |:00440F56(C)
  119. |
  120. :00440F72 6A00                    push 00000000                                        <--+
  121. :00440F74 B980104400              mov ecx, 00441080            <--- String: Beggar off!               |
  122. :00440F79 BA8C104400              mov edx, 0044108C            <--- String: Wrong Serial,try again!           |
  123. :00440F7E A1442C4400              mov eax, dword ptr [00442C44]                                   | Bad Message Box
  124. :00440F83 8B00                    mov eax, dword ptr [eax]                                   |
  125. :00440F85 E8DEC0FFFF              call 0043D068                                           |
  126. :00440F8A EB18                    jmp 00440FA4                                        <--+
  127.  
  128. ---------------------------------------------------------------------------------------------------------------------------------------------
  129.  
  130. Hey you see that Serial ;P instead of entering some Serial we need to enter the String: GFX-754-IER-954 :) to make us Registered.
  131. Ok, now you can get out of SoftICE and enter those 2 Strings and your Registered :) but remember these Offsets for Patching purposes:
  132.  
  133. 00440ED8    Check if we entered a Name
  134. 00440F04    Check if we entered a Serial
  135. 00440F39    Compare 1 (Name:    Registered User)
  136. 00440F56    Compare 2 (Serial:    GFX-754-IER-954)
  137. 00440F5A    We're gonna replace this String with "Registered User"
  138. 00440F5F    We're gonna replace this String with "GFX-754-IER-954"
  139.  
  140. Also remember these two Offsets to Strings:
  141.  
  142. 00441014    the String: Registered User
  143. 0044102C    the String: GFX-754-IER-954
  144.  
  145. But now let's first Unpack this CrackMe :)
  146.  
  147.  
  148. --->    Let's Begin...        *** Manually Unpack ***
  149.  
  150. Ok, like i said above in the file you can Unpack UPX easily with it's own Program :) but i don't like that so i'm doing it Manually...
  151. Open ProcDump and click on the button "PE Editor" then select the CrackMe and click "Open".
  152. Now you'll see:
  153.  
  154. Entry Point:    00055BB0
  155.  
  156. This is the "Virtual Offset" and we need to find the "Raw Offset" so click on "Sections" and look at the "Virtual Offsets".
  157. As you can see this Entry Point belongs to the Middle Section called "UPX1" (Btw it's actually always the middle Section in UPX ;).
  158. So how are we going to figure out the "Raw Offset" ?
  159.  
  160. Entry Point = 00055BB0 - (00037000 - 00000400)
  161. Entry Point = 0001EFB0
  162.  
  163. So, open the CrackMe in your Hex-Editor and go to Offset "0001EFB0" now press one time "Page-Down" and you should see somewhere where the
  164. Code ends something like this:
  165.  
  166. 61E964B5FEFF
  167.  
  168. Replace "E9" with "CC" and save the File.
  169. Then get into SoftICE (CTRL+D) and type "bpint 3" get out of SoftICE (CTRL+D) and run the CrackMe, now SoftICE should break.
  170. And we're landing on a "jmp" to the OEP :)
  171. So press one time (F10) and we're at the OEP, write down the "Virtual Offset" it's "00441270" and now put the "EBFE" trick at the OEP.
  172. Then out of SoftICE and open ProcDump.
  173. Right click on the CrackMe and choose "DUMP (full)" then save it to anywhere you want.
  174. Now open the saved file in "PE Editor" (In ProcDump and change the Entry Point to "00041270" press "Ok" and we're done :)
  175. Now you can run and disassemble the file =)
  176. Now to the Patching part.
  177.  
  178.  
  179. --->    Let's Begin...        *** Patching ***
  180.  
  181. Ok, remembered the Patching points ? let me refresh your mind ;P (or just scroll up...):
  182.  
  183. 00440ED8    Check if we entered a Name
  184. 00440F04    Check if we entered a Serial
  185. 00440F39    Compare 1 (Name:    Registered User)
  186. 00440F56    Compare 2 (Serial:    GFX-754-IER-954)
  187. 00440F5A    We're gonna replace this String with "Registered User"
  188. 00440F5F    We're gonna replace this String with "GFX-754-IER-954"
  189.  
  190. Also remember these two Offsets to Strings:
  191.  
  192. 00441014    the String: Registered User
  193. 0044102C    the String: GFX-754-IER-954
  194.  
  195. Ok, open W32Dasm and Disassemble the saved File.
  196. Then get to the Offset "00440ED8" and write down the offset you see on the bottom of W32Dasm it's "000404D8".
  197. Then get to the Offset "00440F04" and write down the offset you see on the bottom of W32Dasm it's "00040504".
  198. Then get to the Offset "00440F39" and write down the offset you see on the bottom of W32Dasm it's "00040539".
  199. Then get to the Offset "00440F56" and write down the offset you see on the bottom of W32Dasm it's "00040556".
  200. Then get to the Offset "00440F5A" and write down the offset you see on the bottom of W32Dasm it's "0004055A".
  201. Then get to the Offset "00440F5F" and write down the offset you see on the bottom of W32Dasm it's "0004055F".
  202.  
  203. Ok, now close W32Dasm and open the Saved file in your Hex-Editor.
  204. Change the first 2 Offsets in "jmp" (EB) (I assume you know how to do that :).
  205. And you can NOP out the next 2 Offsets (90).
  206. or "inc eax, dec eax" something to that effect ;)
  207. As long as they don't jump.
  208. now go the Offset "0004055A" and change it into this:
  209.  
  210. :0004055A    B93C104400
  211.  
  212. into
  213.  
  214. :0004055A    B914104400        (String to Registered User)
  215.  
  216. And at Offset "0004055F" change it into this:
  217.  
  218. :0004055F    BA5C104400
  219.  
  220. into
  221.  
  222. :0004055F    BA2C104400        (String to GFX-754-IER-954)
  223.  
  224. Save the file and run it, now every Serial works and you'll get a Message Box popping up with the Correct Name and Serial ;P
  225. That's all...
  226.  
  227.  
  228. --->    Greetings...
  229.  
  230. To be honest i'm getting a bit sick of these greetings everytime ;P
  231. So i'll just say:
  232.  
  233. Greetings to everyone i know, and to everyone who knows me, and You... ;P
  234.  
  235.  
  236.             Don't trust the Outside, trust the InSiDe !!!
  237.  
  238.                       Cya...
  239.  
  240.                     CoDe_InSiDe
  241.  
  242.  
  243. Email:    code.inside@home.nl