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

  1. *****************************************************************************************************************************
  2.                     Keyfile
  3. *****************************************************************************************************************************
  4.  
  5. Author:        n0p3x
  6. Protection:    Keyfile
  7. URL:        http://www.phrozencrew.co.uk/crackmek.zip
  8. Tools:        SoftICE 4.05
  9.         Hex-Editor
  10.  
  11.  
  12. --->    Intro...
  13.  
  14. Welcome to my next Tutorial !!!
  15. This time a Keyfile protection, very easy :)
  16.  
  17.  
  18. --->    Let's Begin...
  19.  
  20. Open the CrackMe and you'll see a Message Box saying:
  21.  
  22. "This program is unregistered. Please register this software"
  23.  
  24. Now press "Ok" and we're at the main window.
  25. Now the first thing we need to know is the Keyfile name.
  26. The best way to do this is (i think) to get into SoftICE (CTRL+D) and type "bpx CreateFileA",
  27. followed by "enter" and then out of SoftICE (CTRL+D) and now press the button "Re-Check" and
  28. SoftICE should popup.
  29. Type "BC *" to disable the breakpoint and now don't press (F11) or (F12) but trace a bit
  30. till you're on this instruction:
  31.  
  32. "mov edi, [esp+14]"
  33.  
  34. Then type "d edi" and you'll see a Keyfile name, it's:    n0p3x.key
  35. (this can be done everytime your dealing with a Keyfile protection, which uses CreateFileA).
  36. So press (CTRL+D) to get out of SoftICE and make the Keyfile with your Hex-Editor or something.
  37. Then put some text in it like "Hello" :)
  38. Save the file and open the CrackMe again (Be sure to put the Keyfile in the same directory).
  39. Now when your at the main window again get into SoftICE (CTRL+D) and type "bpx CreateFileA",
  40. followed by "enter" and out of SoftICE (CTRL+D) and press "Re-Check" and SoftICE should popup.
  41. Now press (F12) 1 time and you'll see this:
  42.  
  43. -----------------------------------------------------------------------------------------------------------------------------
  44.  
  45. :004010B4 A300204000              mov dword ptr [00402000], eax        <--- HERE WE LAND AFTER THE BREAK !!!
  46. :004010B9 833D00204000FF          cmp dword ptr [00402000], FFFFFFFF    <--- Compare the value with FFFFFFFF (no file found?)
  47. :004010C0 0F8492000000            je 00401158                <--- If equal Jump to bad Message Box, else continue
  48. :004010C6 6A00                    push 00000000
  49. :004010C8 6807214000              push 00402107
  50. :004010CD 6A0A                    push 0000000A
  51. :004010CF 68F3204000              push 004020F3                <--- Here it puts the first 10 Chars from the Keyfile
  52. :004010D4 FF3500204000            push dword ptr [00402000]
  53.  
  54. * Reference To: KERNEL32.ReadFile, Ord:0000h
  55.                                   |
  56. :004010DA E8C5000000              Call 004011A4                <--- Read the Keyfile
  57. :004010DF 85C0                    test eax, eax                <--- Test if EAX is 00 (Couldn't read File?)
  58. :004010E1 7475                    je 00401158                <--- If equal Jump to bad Message Box, else continue
  59. :004010E3 6A00                    push 00000000
  60. :004010E5 6807214000              push 00402107
  61. :004010EA 6A0A                    push 0000000A
  62. :004010EC 68FD204000              push 004020FD                <--- Here it puts the next 10 Chars from the Keyfile
  63. :004010F1 FF3500204000            push dword ptr [00402000]
  64.  
  65. * Reference To: KERNEL32.ReadFile, Ord:0000h
  66.                                   |
  67. :004010F7 E8A8000000              Call 004011A4                <--- Read the Keyfile
  68. :004010FC 85C0                    test eax, eax                <--- Test if EAX is 00 (Couldn't read File?)
  69. :004010FE 7458                    je 00401158                <--- If equal Jump to bad Message Box, else continue
  70. :00401100 FF3500204000            push dword ptr [00402000]
  71.  
  72. * Reference To: KERNEL32.CloseHandle, Ord:0000h
  73.                                   |
  74. :00401106 E893000000              Call 0040119E
  75. :0040110B 33C0                    xor eax, eax                <--- XOR EAX which is now 00
  76. :0040110D EB04                    jmp 00401113                <--- Jump and skip the next 2 instructions
  77. :0040110F C9                      leave
  78. :00401110 C21000                  ret 0010
  79.  
  80. -----------------------------------------------------------------------------------------------------------------------------
  81.  
  82. Ok, this is easy to understand i think let's see what's next:
  83.  
  84. -----------------------------------------------------------------------------------------------------------------------------
  85.  
  86. :00401113 80B0F320400043          xor byte ptr [eax+004020F3], 43    <--- XOR the first Char with 43 (of the first 10 Chars)
  87. :0040111A 40                      inc eax                <--- EAX +1
  88. :0040111B 80B8F320400000          cmp byte ptr [eax+004020F3], 00    <--- Compare the next Char with 00
  89. :00401122 75EF                    jne 00401113                <--- If not equal we jump and repeat the loop, else continue
  90. :00401124 68F3204000              push 004020F3                <--- Push the Offset to the first 10 Chars
  91. :00401129 68FD204000              push 004020FD                <--- Push the Offset to the next 10 Chars
  92.  
  93. * Reference To: KERNEL32.lstrcmpA, Ord:0000h
  94.                                   |
  95. :0040112E E877000000              Call 004011AA                <--- Compare those 2
  96. :00401133 83F800                  cmp eax, 00000000            <--- Compare EAX with 00000000
  97. :00401136 7406                    je 0040113E                <--- If equal we Jump to the Good Message Box, else continue
  98. :00401138 EB1E                    jmp 00401158                <--- Jump to the Bad Message Box
  99.  
  100. -----------------------------------------------------------------------------------------------------------------------------
  101.  
  102. Ok, this is very simple to solve ;)
  103. As you'll see it takes two times 10 Chars and puts it in 2 different places.
  104. Then it "only" takes the first 10 Chars and XOR's them with 43.
  105. After this it Compares the first 10 Chars (XOR'ed with 43) with the next 10 Chars.
  106. Ok, well if you'll put into your Keyfile just one "43" you'll be victorious ;P
  107. Why?
  108. Because it XOR's the Char with "43" (which becomes 00 then) and the next 10 Chars is nothing (00).
  109. So their equal and the program will Jump to the Good Message Box at "cmp eax, 00000000" :)
  110. That's all.
  111.  
  112.  
  113. --->    Greetings...
  114.  
  115. Everyone from TrickSoft            (www.TrickSoft.net)
  116. Everyone from Cracking4Newbies        (www.Cracking4Newbies.com)
  117. Everyone from Keygenning4Newbies    (Keygenning4Newbies.cjb.net)
  118. And You...
  119.  
  120.             Don't trust the Outside, trust the InSiDe !!!
  121.  
  122.                       Cya...
  123.  
  124.                     CoDe_InSiDe
  125.  
  126. Email:    code.inside@home.nl