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

  1. *******************************************************************************************************************************************************
  2.                     Win32Asm CrackMe 1
  3. *******************************************************************************************************************************************************
  4.  
  5. Author:        Acid_Cool_178's
  6. Protection:    NAG
  7. URL:        http://www.mesa-sys.com/~eternal/a-d/ac178-cm1.zip
  8. Tools:        W32Dasm v8.93
  9.         Hex-Editor
  10.         ProcDump v1.6.2
  11.  
  12.  
  13. --->    Intro...
  14.  
  15. Welcome to my next Tutorial !!!
  16. A very simple CrackMe, just remove 1 NAG ;)
  17.  
  18.  
  19. --->    Let's Begin...
  20.  
  21. Ok, well first we're going to just open the CrackMe to see what's going on :)
  22. So open it, and you'll see a Message Box saying:
  23.  
  24.  
  25. "Acid_Cool_178's"
  26. "Win32Asm CrackMe 1"
  27.  
  28.  
  29. Press "Ok" and we see another Message Box saying:
  30.  
  31.  
  32. "Greetings goes too all my friends.."
  33. "Hellforge, tCA, FHCF, DQF, and the rest..."
  34.  
  35.  
  36. Press "Ok" again and we'll get another Message Box saying:
  37.  
  38.  
  39. "Remove Me!"
  40. "NAG NAG"
  41.  
  42.  
  43. Ah, that looks nice ;)
  44. So now we know that we need the 3rd Message Box.
  45. Click "Ok" 1 more time and the CrackMe exits.
  46. Now open the CrackMe in W32Dasm and click on "Strn Ref" (String Data References).
  47. Well not so much text here, but you'll notice the "Remove Me!" ;)
  48. Double click on it and you'll see this:
  49.  
  50. -------------------------------------------------------------------------------------------------------------------------------------------------------
  51.  
  52. :0040101F 6A00                    push 00000000
  53.  
  54. * Reference To: USER32.MessageBoxA, Ord:01BBh
  55.                                   |
  56. :00401021 E81A000000              Call 00401040
  57. :00401026 6A00                    push 00000000
  58.  
  59. * Possible StringData Ref from Data Obj ->"Remove Me!"        <--- Here's the text :)
  60.                                   |
  61. :00401028 6871304000              push 00403071
  62.  
  63. * Possible StringData Ref from Data Obj ->"NAG NAG"
  64.                                   |
  65. :0040102D 687C304000              push 0040307C
  66. :00401032 6A00                    push 00000000
  67.  
  68. * Reference To: USER32.MessageBoxA, Ord:01BBh
  69.                                   |
  70. :00401034 E807000000              Call 00401040
  71. :00401039 6A00                    push 00000000
  72.  
  73. * Reference To: KERNEL32.ExitProcess, Ord:0075h
  74.                                   |
  75. :0040103B E806000000              Call 00401046
  76.  
  77. -------------------------------------------------------------------------------------------------------------------------------------------------------
  78.  
  79. Ok, how can we solve this? :)
  80. There are several ways:
  81.  
  82. 1.    Notice the "push 00000000" at offset "00401026" we can let it jump to "ExitProcess" and
  83.     then the CrackMe quits :)
  84.  
  85. 2.    We can NOP the call at offset "00401034".
  86.  
  87. 3.    We can make the call at offset "00401034" jump to the "ExitProcess" instead of the
  88.     "MessageBoxA".
  89.  
  90. 4.    We can Inline Patch this "either with patch 1, 2 or 3" in the beginning of the CrackMe.
  91.  
  92.  
  93. You know what?, i'm gonna try them all ;)
  94. So first we're gonna do Method 1.
  95.  
  96.  
  97.                        *** Method 1 ***
  98.  
  99. ok, we need the "push 00000000" at offset "00401026", double click on that instruction to see the
  100. "Raw Address" it's "00000426".
  101. Now open your Hex-Editor and close W32Dasm (Otherwise we can't save the File ;) and go to
  102. location "00000426".
  103. There you'll see this:
  104.  
  105. -------------------------------------------------------------------------------------------------------------------------------------------------------
  106.                       Call MessageBoxA     Call ExitProcess
  107.                       |               |
  108. 6A 00 68 71 30 40 00 68 7C 30 40 00 6A 00 E8 07 00 00 00 6A 00 E8 06 00 00 00
  109.  
  110. -------------------------------------------------------------------------------------------------------------------------------------------------------
  111.  
  112. We're going to replace the first "6A 00" with a Jump "EB 00" but now we need to count how much
  113. bytes we need to Jump :)
  114. So how are we going to do this?
  115. To count from some place to another place, always start counting behind the Instruction till you
  116. reach the beginning of the other Instruction where you want it to Jump to :)
  117. And don't forget to count in "Hexadecimal" format, that is:
  118.  
  119. 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 ...
  120.  
  121. Let me show you (I hope you'll understand ;) :
  122.  
  123. -------------------------------------------------------------------------------------------------------------------------------------------------------
  124.       Count from here                                    To here (This is the beginning of ExitProcess)
  125.       |                             |
  126. 6A 00 68 71 30 40 00 68 7C 30 40 00 6A 00 E8 07 00 00 00 6A 00 E8 06 00 00 00
  127.  
  128.       0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  10 11
  129.       |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
  130. EB 00 68 71 30 40 00 68 7C 30 40 00 6A 00 E8 07 00 00 00 6A 00 E8 06 00 00 00
  131. |                             |
  132. Our Replaced Jump                     Till we reach this place so "11" is our value
  133.  
  134. -------------------------------------------------------------------------------------------------------------------------------------------------------
  135.  
  136. Well, it looks harder then it is :)
  137. So our final line to make it Jump from the beginning of the last Message Box to the ExitProcess looks like this:
  138.  
  139. -------------------------------------------------------------------------------------------------------------------------------------------------------
  140.  
  141. EB 11 68 71 30 40 00 68 7C 30 40 00 6A 00 E8 07 00 00 00 6A 00 E8 06 00 00 00
  142.  
  143. -------------------------------------------------------------------------------------------------------------------------------------------------------
  144.  
  145. Ok, so replace the "6A00" with "EB11" at offset "00401026" and save the File and run it.
  146. It works ;)
  147. Now method 2.
  148.  
  149.  
  150.                         *** Method 2 ***
  151.  
  152. We're going to replace the "call 00401040" with "NOP" :)
  153. In W32Dasm double click on the call 00401040" at offset "00401034" to get the "Raw Address" it's "00000434".
  154. So close W32Dasm and open the CrackMe in your HexEditor, then go to that Adress "00000434" and you'll see this:
  155.  
  156. -------------------------------------------------------------------------------------------------------------------------------------------------------
  157.  
  158. E8 07 00 00 00        <--- This is the Call to the Message Box.
  159.  
  160. -------------------------------------------------------------------------------------------------------------------------------------------------------
  161.  
  162. So just replace the E807000000" with "9090909090" and that's it :)
  163. Save the File and run it, it works ;)
  164. On to Method 3.
  165.  
  166.  
  167.                     *** Method 3 ***
  168.  
  169. Ok, look just above on how to get to the correct place for the Call and now i'll show you a bigger line ;) :
  170.  
  171. -------------------------------------------------------------------------------------------------------------------------------------------------------
  172. MessageBoxA          ExitProcess    MessageBoxA       ExitProcess
  173. |             |              |                 |
  174. E8 07 00 00 00 6A 00 E8 06 00 00 00 FF 25 08 20 40 00 FF 25 00 20 40 00
  175.  
  176. -------------------------------------------------------------------------------------------------------------------------------------------------------
  177.  
  178. We need to make the "E807000000" Jump to the ExitProcess (You can make it jump either to the first ExitProcess or the second, we'll take the second ;).
  179. So we're going to do this the same as with Method 1 :)
  180.  
  181. -------------------------------------------------------------------------------------------------------------------------------------------------------
  182.            From here                  To here (ExitProcess)
  183.                |                      |
  184. E8 07 00 00 00 6A 00 E8 06 00 00 00 FF 25 08 20 40 00 FF 25 00 20 40 00
  185.  
  186.                0  1  2  3  4  5  6  7  8  9  A  B  C  D
  187.                |  |  |  |  |  |  |  |  |  |  |  |  |  |
  188. E8 07 00 00 00 6A 00 E8 06 00 00 00 FF 25 08 20 40 00 FF 25 00 20 40 00
  189. |                              |
  190. The Call                          Till this place so we need value "0D"
  191.  
  192. -------------------------------------------------------------------------------------------------------------------------------------------------------
  193.  
  194. Ok, so replace the "E807000000" with "E80D000000" at offset "00000434" and save the File.
  195. Run it, it works ;P
  196. On to Method 4.
  197.  
  198.  
  199.                     *** Method 4 ***
  200.  
  201. Ok, now we're going to Inline Patch :)
  202. So we're going to make the Entry Point Jump to our Code and then Patch the program (we use Method 1) and then Jump back to the Real Entry Point :)
  203. Fire up ProcDump and check out the Entry Point (I assume you know how to do this).
  204. The Entry Point is "00001000".
  205. Now open the CrackMe in your HexEditor and look in the Code Section, because we need some empty space ;)
  206. Well there's plenty of it at offset "00000500" so we need to replace the Entry Point with "00000500" :)
  207. Ok, your still in ProcDump? good ;)
  208. Because now replace the Entry Point "00001000" with "00001100".
  209. Why "00001100" ???
  210. Because if you look in the Section you'll see that the "00001000" is the "Virtual Address" for "00000400" (The Raw Address).
  211. And we wanted our Code at "00000500" and so we need the "Virtual Address" "00001100" :)
  212. Ok, change it and close ProcDump and now we need to Code our own stuff ;) (do it in the way you want).
  213. We need to replace "6A00" with EB11" at offset "00401026" :)
  214. So i coded this at offset "00401100":
  215.  
  216. -------------------------------------------------------------------------------------------------------------------------------------------------------
  217.  
  218. mov word ptr [00401026], EB11
  219. push 00401000
  220. ret
  221.  
  222. -------------------------------------------------------------------------------------------------------------------------------------------------------
  223.  
  224. Ok, now the Code is there save the File and run it.... aarghhh !!! error ;)
  225. Hehe, i think i allready now what this is ;) the Size of the Section isn't large enough =)
  226. So open the CrackMe again in ProcDump and now look at the first Section, the "Raw Size" is "0000004C".
  227. That's too short change it to "00000200" and just in case change the Characteristics to "E0000040".
  228. That's it close ProcDump and run the File, now it works ;P
  229. That's All...
  230.  
  231.  
  232. --->    Greetings...
  233.  
  234. To be honest i'm getting a bit sick of these greetings everytime ;P
  235. So i'll just say:
  236.  
  237. Greetings to everyone i know, and to everyone who knows me, and You... ;P
  238.  
  239.  
  240.             Don't trust the Outside, trust the InSiDe !!!
  241.  
  242.                       Cya...
  243.  
  244.                     CoDe_InSiDe
  245.  
  246.  
  247. Email:    code.inside@home.nl
  248. Homepage: http://codeinside.cjb.net