home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / E_bliss / stx_crackme4.txt < prev    next >
Text File  |  2000-05-25  |  6KB  |  134 lines

  1. Hiya!
  2.  
  3.  First I want to thank all those good guys who are writing Crackme's and tests so that we can
  4. learn and improve our knowledge. Greetings this time especially to tC who coded the target
  5. we're dealing with now and to Eternal Bliss for doing a great work with his CrackMe(s)-site.
  6.  
  7. This time tC just asks us to enter a valid unlock-code that is splitted into six parts. If we're
  8. dealing with this kind of protection scheme it's most likely that our entered password is
  9. compared with a hardcoded serial. So let's check what we have here...
  10.  
  11.  Again we will use Numega's powerful SoftICE. Start Stx_cm and type in any code you want.
  12. 'Ctrl-D' to go to SoftICE and set a breakpoint on hmemcpy ('bpx hmemcpy'). F5 to go back to the
  13. Crackme and press the OK-button.
  14.  SoftICE pops up; disable the breakpoint ('bd0') and press F11 ('go to') once and then F12
  15. ('Return from the procedure call') until we reach the Stx_cm-code (watch the line between
  16. the Code window and the Command window). You can go on by pressing F10 ('step over') or -
  17. faster - by using some more F12's to pass some obvious ret's until...
  18.  
  19.  
  20.  
  21. ...we finally arrive here:
  22.  
  23.  
  24. :0043D9DE E89D2EFEFF              call 00420880
  25. :0043D9E3 8B45F4                  mov eax, dword ptr [ebp-0C]
  26. :0043D9E6 8D55FC                  lea edx, dword ptr [ebp-04]
  27. ---
  28.  
  29. ---
  30. So if we trace the code we'll find part one here:
  31.  
  32. :0043DA38 E8DF5FFCFF              call 00403A1C
  33. :0043DA3D 83C040                  add eax, 00000040        
  34. :0043DA40 3BF0                    cmp esi, eax        
  35. :0043DA42 740A                    je 0043DA4E
  36.  
  37. Add 40h to eax to get the real code and compare it then with the fake code (esi). Both are hex
  38. values so to get the decimal values just type '? eax' and '? esi'. If we have entered a wrong
  39. code - what we accidently could have done - we don't jump but soon afterwards we go the bad way
  40. to the unregistered status ('jmp 0043DB10').
  41.  
  42.  
  43.  
  44. :0043DA57 E8242EFEFF              call 00420880
  45. :0043DA5C 8B45F4                  mov eax, dword ptr [ebp-0C]
  46. :0043DA5F BA44DB4300              mov edx, 0043DB44
  47. :0043DA64 E8C360FCFF              call 00403B2C
  48. :0043DA69 740A                    je 0043DA75
  49.  
  50. This is part two. Our fake code is copied to eax and the real code is copied from 0043DB44 to edx.
  51. You can check this by typing 'd eax' and 'd edx' in SoftICE. If the codes are equal then jump and
  52. go on with the calculation routine; if not we will reach our bad jump soon ('jmp 0043DB10').
  53.  
  54.  
  55.  
  56. :0043DA75 897DF0                  mov dword ptr [ebp-10], edi
  57. :0043DA78 DB45F0                  fild dword ptr [ebp-10]
  58. :0043DA7B D8354CDB4300            fdiv dword ptr [0043DB4C]
  59. :0043DA81 D81D50DB4300            fcomp dword ptr [0043DB50]
  60. :0043DA87 DFE0                    fstsw ax
  61. :0043DA89 9E                      sahf
  62. :0043DA8A 7407                    je 0043DA93
  63.  
  64. Ahh part three is probably not so easy to understand and to explain this could be a little chapter
  65. by itself. So here are just some short descriptions of this FPU mnemonics:
  66. fild - load integer; fdiv - divide; fcomp - compare real; fstsw - store status word;
  67. The results of this calculation: after passing 0043DA75 look at your register window and you will
  68. see something like 'SS:0067F3E4=000000XX' where SS is the Stack Segment and XX is the hex value of
  69. the code you entered ('? XX').
  70.  After passing the fdiv instruction another look at the register window shows us
  71. 'DS:0043DB50=42F60000' where DS is the Data Segment and F6 is our real code as a hex value.
  72.  The sahf instruction is used to copy the floating point status register flags into the 80x86's
  73. flag register. What does this mean for us here? If we entered a wrong code the Zero flag is not
  74. set and we don't jump at location 0043DA8A which is bad because we'll see our old friend
  75. 'jmp 0043DB10' then. So the Zero flag must be set to go on with the code calculation.
  76.  
  77.  
  78.  
  79. :0043DA9E E8ED9AFCFF              call 00407590
  80. :0043DAA3 8B45EC                  mov eax, dword ptr [ebp-14]
  81. :0043DAA6 BA5CDB4300              mov edx, 0043DB5C
  82. :0043DAAB E87C60FCFF              call 00403B2C
  83. :0043DAB0 7407                    je 0043DAB9
  84.  
  85.  Part four: Our fake code is copied to eax and the real code is copied to edx; both as hex values.
  86. At location 0043DAAB we find the 'comparison call' for these two values. Equal? Yes then jump and
  87. go on. Remember that you have to enter the decimal value as your unlock-code.
  88.  
  89.  
  90.  
  91. :0043DAC2 E8B92DFEFF              call 00420880
  92. :0043DAC7 8B45F4                  mov eax, dword ptr [ebp-0C]
  93. :0043DACA BA68DB4300              mov edx, 0043DB68
  94. :0043DACF E85860FCFF              call 00403B2C
  95. :0043DAD4 7407                    je 0043DADD
  96.  
  97.  Part five works the same way as part two. Our fake code is copied to eax and the real code is
  98. copied from 0043DB68 to edx. You can check this by typing 'd eax' and 'd edx' in SoftICE. If the
  99. codes are equal then jump and go on with the calculation routine; if not we will reach our bad
  100. jump soon ('jmp 0043DB10').
  101.  
  102.  
  103.  
  104. :0043DAE6 E8952DFEFF              call 00420880
  105. :0043DAEB 8B45F4                  mov eax, dword ptr [ebp-0C]
  106. :0043DAEE BA78DB4300              mov edx, 0043DB78
  107. :0043DAF3 E83460FCFF              call 00403B2C
  108. :0043DAF8 7407                    je 0043DB01
  109. :0043DAFA E885FEFFFF              call 0043D984
  110. :0043DAFF EB0F                    jmp 0043DB10
  111.  
  112.  Again! Fake code to eax, real code to edx. Jump if good or go to the bad jump if you entered a
  113. wrong code. This was the final comparison and if you typed in all six parts correctly you will
  114. finally reach the 'registered status'.
  115.  
  116.  
  117.  If you look back to our entry point at location 0043D9E3 trace the code and watch the registers;
  118. you will see then that some of the real codes are getting 'prepared' for the following comparisons
  119. there.
  120.  I haven't shown the real code here by numbers and chars because I think you can easily find it out
  121. by yourself now.
  122.  
  123.  
  124. Done!
  125.  
  126.  
  127. Greetings to all those helpful guys at the forums.
  128.  
  129.  
  130. Good luck!
  131.  
  132.  
  133. cheers     tnwo_
  134.