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

  1. Target: CrackMe [id:12]
  2. Author: tC...
  3. Cracker: The AntiXryst [CrossOver]
  4. Rating: Not as easy as apple pie, but not hard at all. Better luck
  5.     next time, tC... !
  6. Used tools: WDASM 8.93, Hex Workshop
  7. Greetings to: Me, myself and I and everybody else I injured during my
  8.           sadomasochistic games ;-)
  9.  
  10.  
  11. Hi there!
  12.  
  13. Without explicit trying to be arrogant, I want to tell you that many
  14. people tried to crack this little nonsensical crackme and did fail. Now
  15. I want to show you that cracking Delphi programs is not that hard and
  16. complicated at all as you maybe have heard or experienced.
  17.  
  18. You should know how programs written in Delphi are organized and why
  19. they are so huge even if they do not consist of anything but a small
  20. window with "Hello world!". Maybe as you already know, the tradition of
  21. Borland is to break with Microsoft's concepts and traditions and to
  22. reach the "aim" by completely different methods. In the case of the
  23. most popular programming languages coming from Inprise/Borland - Delphi
  24. and C++Builder - that's the same dilemma. Common standards like the
  25. usage of MFC and program data including window design stored in the
  26. resource section of an executable are simply ignored. Other commonly
  27. used strategies, e.g. for window creation, are replaced by own routines
  28. being absolutely incompatible to Microsoft standards. And exactly these
  29. routines make your (and mine, too) Delphi programs being huge harddisk
  30. and memory wasters. So, what exactly does a Delphi-born little suckin'
  31. motherfucker consist of? Answer: The whole VCL (Visual Components
  32. Library, not to mix up with Virus Creation Lab) is linked into the poor
  33. executable becoming an overweight monster. It usually goes from the
  34. code start up to somewhere $0043xxxx, sometimes up to $0044xxxx. Form
  35. data is, as I experienced this weird shit, sometimes stored in the code
  36. section of the executable or completely incompatible to Microsoft
  37. standards in a separate resource section (.rsrc).
  38. Although this VCL enables you a more or less easy and totally object-
  39. oriented GUI handling, it sometimes lacks in performance and sometimes
  40. doesn't let you "play" with particular window settings without using
  41. plain Win32 API. Another thing is that the whole handling of window
  42. messages is also done by the VCL. That's why sometimes the search for
  43. a special routine in SoftICE leads to long debugging orgies and head
  44. ache. Sometimes SoftICE ignores message breakpoints to controls placed
  45. on the window, this appears even without special debugging-preventive
  46. measures and can also be found in this crackme. Please do not fear that
  47. you will have to trace through the whole VCL in order to find some
  48. relevant routines, I found a very easy way to find the entry point of
  49. handling functions (in Delphi known as event routines). For this you
  50. just need a simple hex editor like Hex Workshop. Depending on how the
  51. programmer of a particular application called his window, you will
  52. often find an ASCII string of someting like "TForm1". So have I in this
  53. little funny crackme. A couple of lines above this string you'll find
  54. the names of handler functions, in our case I recognized them by names
  55. "Register1Click" and "Exit2Click" - these routines are handlers for
  56. clicks on the menu bar entries. Now, before "Register1Click" you'll see
  57. 6 Bytes: 00 14 62 44 00 0E. What do they stand for? 00 14 62 44 is the
  58. Little Endian notation for $00446214 - THIS IS OUR ROUTINE!!!! Just
  59. read these numbers from right to left...
  60. The other 2 bytes, hmmm, I don't know what they do exactly stand for -
  61. the zero as a separator between the procedure entry and its name, $0E
  62. maybe for the length of the procedure name.
  63. If you think this search is a bit too complicated, well, I plan to code
  64. a small handy tool which will work same as EXE2DPR (in pity I just have
  65. a very old trial version that doesn't work with Delphi 4 written code).
  66.  
  67. After a disassembly in WDASM you should set a breakpoint to the address
  68. shown above. You may wonder why there is no cross reference to this
  69. address - my answer: because it is called via CALL [EAX]. If you launch
  70. the crackme from the integrated debugger, you should enter someting
  71. into the edit box, I entered "fuck Jesus"... If you now click on the
  72. menu item "Register", WDASM will stop at our breakpoint. Now, what did
  73. I say? This IS REALLY our routine! Now, the step of analyzing has to be
  74. done. I will NOT explain every single detail, I'll just show you what
  75. part of code does what in a syntactical mix of Pascal and ASM register
  76. calling...
  77.  
  78. Code snippet $0044623F-$00446244:
  79. ---------------------------------
  80. [$004488D4]:=Length(Key);
  81. if Length(Key)=0 then Exit;
  82.  
  83.  
  84.  
  85. Code snippet $00446258-$0044628E:
  86. ---------------------------------
  87. var index:Cardinal;
  88. for index:=1 to Length(Key) do [$00448874+index]:=Ord(Key[index]);
  89.  
  90.  
  91.  
  92. Procedure $004461F0 (called from $00446290):
  93. --------------------------------------------
  94. - performs a call to subroutine at $004461C0
  95. - both routines do mutilate our entered key string
  96. - what the functions together do:
  97.     var index:Cardinal;
  98.     for index:=1 to Length(Key) do
  99.          Key[index]:=Chr(((Ord(Key[index]) xor 3)*2)+8-index);
  100. In addition to that, a truncation is performed to 8 bit, if the value
  101. in Key[index] is greater than 256 (via MOVZX EBX, BL).
  102.  
  103.  
  104.  
  105. Code snippet $00446295-$004462C8:
  106. ---------------------------------
  107. If you look at the index counter (in EDI), you'll see that our string
  108. must be $12 (decimal 18) chars long. Now, continue the run with F9 and
  109. enter the next time someting 18 chars long, like "Marilyn Manson 123".
  110. The mutilated string is stored, as far as I remember, at $004488C0 in
  111. this way (again Little Endian):
  112.  
  113. D8 E7 CA A3 <--- 1st byte of manipulated string
  114. 46 DB F6 E1
  115. DC D7 C2 9B
  116. 5C 3F D4 D3
  117. 00 00 56 59
  118. <---------- read direction
  119.  
  120. This code snippet does move the byte pairs and then does swap the bytes
  121. in the pairs. It works like that (symbolical example):
  122.  
  123. A1 A2 | B1 B2        G2 G1 | I2 I1
  124. C1 C2 | D1 D2        E2 E1 | H2 H1
  125. E1 E2 | F1 F2  ------>    C2 C1 | F2 F1
  126. G1 G2 | H1 H2        A2 A1 | D2 D1
  127. 00 00 | I1 I2        00 00 | B2 B1
  128.  
  129. OK, you know now how it works. In $00C2D58 (look in $004488D8 what
  130. points to our string) you'll find the result of this byte shake:
  131.  
  132. 3F 5C 59 56
  133. D7 DC D3 D4
  134. DB 46 9B C2
  135. E7 D8 E1 F6
  136. 00 00 A3 CA
  137. <---------- read direction
  138.  
  139.  
  140.  
  141. Code snippet $004462CA-$004462D9:
  142. ---------------------------------
  143. A compare of our poor little twisted and horribly mutilated key with
  144. constant values in $00446338 is performed via built-in Delphi routines.
  145. OK - thus the 18 constant values in the same form as above must con-
  146. tain the "real" unlock code. These are the constant values:
  147.  
  148. C9 C4 D9 3A
  149. 7D DE BF BA
  150. D9 E2 CF 44
  151. DD D2 49 EA
  152. 00 00 8F DE
  153. <---------- read direction
  154.  
  155. Now it's up to you either to write a short decryption routine or to
  156. de-cipher these constants by the help of a calculator (calc.exe in
  157. scientific view is pretty good). OK OK OK, you're too lazy, me too,
  158. here's the unlock string: Good work Cracker!
  159. Just test it (do not forget the big "G" and the exclamation mark !!!).
  160. What does this crackme say? Yeah, I did it!
  161. -----------------------------------------------------------------------
  162.  
  163. I hope you have learned a little bit from this. Look out for my cracks:
  164. tutorials or source codes are included in most cases!
  165.  
  166. Sincerely yours,
  167.   The AntiXryst [CrossOver]
  168.  
  169. Visit the newcoming cracking group I am the CoLeader of:
  170. http://crossover.tsx.org