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

  1. Flu[X]'s cracking tutor #6 - Dealing wit a packed EXE
  2.                              Getting past Disassembler Protection
  3.  
  4. Tools
  5. -Softice 3.2+
  6. -Live Image v1.29D Build 52
  7. -Hackersview 5.65+
  8. -Brain
  9.  
  10.  
  11. Ok ... recently programmers are using techniques or programs to "pack"
  12. their EXEcutables or DLL's in an attempt to add additional copyright
  13. protection. A popular one is shrinker. If your a cracker.. believe me you
  14. know about it :)  Ok enough lets get started..
  15.  
  16. Ok lets examine our target, Live Image v1.29D Build 52, it asks for a name/serial.
  17. So we begin tracing (hmemcpy). Eventually we come to these lines of code:
  18.  
  19.  
  20.  
  21. mov eax,[ebp-20]
  22. mov ecx,[ebp-0C]
  23. mov esp, ebp
  24. Ret
  25.  
  26. ----- After return is executed -----
  27.  
  28. cmp eax,0
  29. je BAD_Cracker
  30.  
  31.  
  32.  
  33. OK, what it does is move a value into EAX, and if that value is 0
  34. it means you failed the serial check... Now.. if we could make it
  35. always pass the test... we would have a full regged copy (because
  36. the programmer always uses the above routine to check his serials).
  37. OK, i also notice that ebp-20 is 0 unless it is right serial..
  38. but wait.. EBP is always non zero.. so if we moved ebp into eax
  39. it will always pass the test.
  40.  
  41. so the above code would become:
  42.  
  43. mov eax,[ebp]      ; line changed...
  44. mov ecx,[ebp-0C]
  45. mov esp, ebp
  46. Ret
  47.  
  48.  
  49. Ok we think this is going to be some simple patch... So we opan up
  50. W32Dasm to find the file offset (we did write down the address
  51. from SoftIce didnt we?). Ok we disassemble the file.. and what?!?!
  52. what is this crap? i cant find that code anywhere!
  53.  
  54. This EXE is packed..ARGHHH...So after a bit of analyzing we notice
  55. that it is packed by shrinker.. so we must De-pack it. I used
  56. Unshrinker v1.2 (on my web page http://tuts98.cjb.net).
  57.  
  58. Ok we now have an unshrinked EXE file :) Things should be good right?
  59. No, wrong. Lets disassemble the unpacked EXE with W32Dasm, what it wont
  60. work? It seems as if the author not only used Shrinker, but also added
  61. a bit of his own protection! ok.. now what do we do here? wait a sec,
  62. remember what the code we are looking for is?  Maybe if we used our
  63. heads a bit (a very little bit) we would recall taht Hiew allows
  64. for Hex Searches :)
  65.  
  66. mov eax,[ebp-20]
  67. mov ecx,[ebp-0C]
  68. mov esp, ebp
  69.  
  70. This translates to:  8B45E08B4DF48BE5
  71.  
  72. so if we open the file in Hiew we can do a search for 8B45E08B4DF48BE5.
  73. Hit the F7 key in Hiew and type it in the hex string area.. and find it.
  74. Hey.. it worked.. we found our code..
  75.  
  76. so change it from:
  77.  8B45E0
  78.  8B4DF4
  79.  8BE5
  80.  
  81. to:
  82.  8B4500        ;note the 00.
  83.  8B4DF4
  84.  8BE5
  85.  
  86. save the file and run.. Hey look its registered.. crack done!
  87.  
  88. Also about a patch.. a patch for this program would be virtually
  89. seeing as it is improbable to modify a packed file.
  90.  
  91.  
  92.  
  93. I hope to see you again in Flu[X] tutor #7
  94. As always if you like a program buy it!  Thi essay is for
  95. educational purposes ONLY! Software authors deserve your support!
  96.  
  97. Flu[X]/PC98
  98. http://tuts98.cjb.net