home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / riscs-brute-tute.txt < prev    next >
Encoding:
Text File  |  1999-06-18  |  9.9 KB  |  215 lines

  1. D4CrackMe.exe, how not to crack it...
  2.  
  3. Tutorial by : R!SC -- risc@notme.com
  4. Date : 18th june 1999
  5.  
  6.  
  7. finding the serial check routine was simple enough.. but god damn, is it hard to understand..
  8.  
  9. :00401228 6A09                    push 00000009 <-- maximum length of serial(-1) 
  10. :0040122A 6814554000              push 00405514 <-- buffer to place entered code
  11.  
  12. * Possible Reference to Dialog: DialogID_0065, CONTROL_ID:03E8, ""
  13.                                   |
  14. :0040122F 68E8030000              push 000003E8 <-- identifier of control (window with the serial in)
  15. :00401234 56                      push esi      <-- handle of the dialog box..
  16.  
  17. * Reference To: USER32.GetDlgItemTextA, Ord:0104h
  18.                                   |
  19. :00401235 FF15A0404000            Call dword ptr [004040A0] <-- getdlgitemtexta
  20. :0040123B E894FEFFFF              call 004010D4 <-- real dodgy serial verification routine
  21. :00401240 85C0                    test eax, eax <-- eax==1 if the correct serial
  22. :00401242 7418                    je 0040125C   <-- jump to bad boy
  23.  
  24.  
  25. is that what (Level:9) means?? is this the difficulty rating?? heh, who gives a f**k.. i doubt
  26. it is reversable, but i had a naughty idea (well, two naughty ideas..)
  27.  
  28. rip the code at 4010D4, and use it in a brute forcer, passing every possible combination of
  29. serials to it and seeing what it throws back, But, hmm, the code is a bit complicated.. and
  30. from this idea, sprung another one.. just write the bruteforce code inside of the crackme,
  31. inside of its own code, and call the serial verification routine.. heehee.. i am real naughty..
  32. this is not a cracking, this is just a simple waiting game..
  33.  
  34. bpx getdlgitemtexta, F5, enter a number, click on try, F11 to reach the line after the
  35. api call, then search memory for a nice place to code a simple brute forcer...
  36.  
  37. Break due to BPX USER32!GetDlgItemTextA  (ET=2.21 seconds)
  38. Break due to G (ET=346.92 microseconds)
  39. :bd*
  40. :d 405514       <-- reveals the 8 digit code :)
  41.  
  42. hmm, after scrolling through the data window, i found a lot of space at address 405B00
  43. si i decided to code a brute force algo here..
  44.  
  45.  
  46. :a 405b00
  47. 015F:00405B00 call 4010d4                   <-- call the serial verification routine
  48. 015F:00405B05 test eax,eax
  49. 015F:00405B07 jne 405d00                    <-- if eax is not-equal, we have the right number
  50. 015F:00405B0D inc byte ptr [405514]
  51. 015F:00405B13 cmp byte ptr [405514], 3a     <-- compare current value, after the inc, with 3a 
  52. 015F:00405B1A jl 405b00                       - 39h=9 ascii, 3ah=too far
  53. 015F:00405B1C mov byte ptr [405514],30        - so reset it to 0 ascii
  54. 015F:00405B23 inc byte ptr [405515]           - and increase the next digit
  55. 015F:00405B29 cmp byte ptr [405515],3a      <-- if this one has gone past ascii 9
  56. 015F:00405B30 jl 405b00
  57. 015F:00405B32 mov byte ptr [405515],30        - do the bloody same..
  58. 015F:00405B39 inc byte ptr [405516]
  59. 015F:00405B3F cmp byte ptr [405516],3a
  60. 015F:00405B46 jl 405b00
  61. 015F:00405B48 mov byte ptr [405516],30
  62. 015F:00405B4F inc byte ptr [405517]
  63. 015F:00405B55 cmp byte ptr [405517],3a
  64. 015F:00405B5C jl 405b00
  65. 015F:00405B5E mov byte ptr [405517],30
  66. 015F:00405B65 inc byte ptr [405518]
  67. 015F:00405B6B cmp byte ptr [405518],3a
  68. 015F:00405B72 jl 405b00
  69. 015F:00405B74 mov byte ptr [405518],30
  70. 015F:00405B7B inc byte ptr [405519]
  71. 015F:00405B81 cmp byte ptr [405519],3a
  72. 015F:00405B88 jl 405b00
  73. 015F:00405B8E mov byte ptr [405519],30
  74. 015F:00405B95 inc byte ptr [40551a]
  75. 015F:00405B9B cmp byte ptr [40551a],3a
  76. 015F:00405BA2 jl 405b00
  77. 015F:00405BA8 mov byte ptr [40551a],30
  78. 015F:00405BAF inc byte ptr [40551b]
  79. 015F:00405BB5 cmp byte ptr [40551b],3a
  80. 015F:00405BBC jl 405b00
  81. 015F:00405BC2 int 03                    <-- friendly int 03, if this is reached, all 
  82. 015F:00405BC3                             - number combinations have been tried
  83.  
  84. :a 405d00
  85. 015F:00405D00 int 03                    <-- another friendly int 03, this one means we have the
  86. 015F:00405D01                             - right number
  87. :d 405514           <-- erm, dump the serial, so i can manually set it to '00000000'
  88.  
  89.  
  90. hoe hoe, what fun, theres 10 minutes coding off the top of my head :)
  91.  
  92. bpint 3 in softice or i3here on...
  93.  
  94. well, alls left to do now, is point the eip to my code, and wait.. r eip=405b00, F5...
  95. this lame code will cycle through every possible combination of decimal values, thats er, quite
  96. a lot of values, 99,999,999, nearly 100 million, but the code verification routine is very fast,
  97. would be nicer if it was a bit faster, but, anyway, 10 minutes later, and 100 million numbers
  98. crunched, hmm!!! no damn result.. :(
  99.  
  100. perhaps its a hexadecimal serial, quick hack to change the brute force code to include letters
  101. A..F
  102.  
  103. :d eip      <-- i just search for the '3A' and change it to '47' :)
  104. :?'F'
  105. 00000046  0000000070  "F"
  106. :u eip l 100
  107. 015F:00405B00  E8CFB5FFFF          CALL    004010D4
  108. 015F:00405B05  85C0                TEST    EAX,EAX
  109. 015F:00405B07  0F85F3010000        JNZ     00405D00
  110. 015F:00405B0D  FE0514554000        INC     BYTE PTR [00405514]
  111. 015F:00405B13  803D1455400047      CMP     BYTE PTR [00405514],47   <-- ascii G, means gone too far
  112. 015F:00405B1A  7CE4                JL      00405B00
  113. 015F:00405B1C  C6051455400030      MOV     BYTE PTR [00405514],30   <-- reset it to ascii 0
  114. 015F:00405B23  FE0515554000        INC     BYTE PTR [00405515]
  115. 015F:00405B29  803D1555400047      CMP     BYTE PTR [00405515],47
  116. 015F:00405B30  7CCE                JL      00405B00
  117. 015F:00405B32  C6051555400030      MOV     BYTE PTR [00405515],30
  118. 015F:00405B39  FE0516554000        INC     BYTE PTR [00405516]
  119. 015F:00405B3F  803D1655400047      CMP     BYTE PTR [00405516],47
  120. 015F:00405B46  7CB8                JL      00405B00
  121. 015F:00405B48  C6051655400030      MOV     BYTE PTR [00405516],30
  122. 015F:00405B4F  FE0517554000        INC     BYTE PTR [00405517]
  123. 015F:00405B55  803D1755400047      CMP     BYTE PTR [00405517],47
  124. 015F:00405B5C  7CA2                JL      00405B00
  125. 015F:00405B5E  C6051755400030      MOV     BYTE PTR [00405517],30
  126. 015F:00405B65  FE0518554000        INC     BYTE PTR [00405518]
  127. 015F:00405B6B  803D1855400047      CMP     BYTE PTR [00405518],47
  128. 015F:00405B72  7C8C                JL      00405B00
  129. 015F:00405B74  C6051855400030      MOV     BYTE PTR [00405518],30
  130. 015F:00405B7B  FE0519554000        INC     BYTE PTR [00405519]
  131. 015F:00405B81  803D1955400047      CMP     BYTE PTR [00405519],47
  132. 015F:00405B88  0F8C72FFFFFF        JL      00405B00
  133. 015F:00405B8E  C6051955400030      MOV     BYTE PTR [00405519],30
  134. 015F:00405B95  FE051A554000        INC     BYTE PTR [0040551A]
  135. 015F:00405B9B  803D1A55400047      CMP     BYTE PTR [0040551A],47
  136. 015F:00405BA2  0F8C58FFFFFF        JL      00405B00
  137. 015F:00405BA8  C6051A55400030      MOV     BYTE PTR [0040551A],30
  138. 015F:00405BAF  FE051B554000        INC     BYTE PTR [0040551B]
  139. 015F:00405BB5  803D1B55400047      CMP     BYTE PTR [0040551B],47
  140. 015F:00405BBC  0F8C3EFFFFFF        JL      00405B00
  141. 015F:00405BC2  CC                  INT     3
  142.  
  143. :d 405514       <-- reset it to '00000000' again..
  144.  
  145.  
  146. well, i go ahead and try this new brute algo, but, not much luck, its not very good code, and
  147. trys the ascii between 3A--40 ':;<=>?@', 7 extra characters, which really slow it down..
  148.  
  149. hmm, decide to code one in a proper language, and just copy & paste the code into the the exe..
  150. see hmm.asm, i compiled it, then copy&paste the code into D4CrackMe.exe, where i located some
  151. free space..(see new_d4crackme.exe, file offset 3b60)
  152.  
  153. run the new crackme, with superduper bruteforcer(tm) coded inside of it..
  154.  
  155. bpx getdlgitemtexta, enter fake code and hit try...
  156.  
  157. Break due to BPX USER32!GetDlgItemTextA  (ET=1.68 seconds)
  158. Break due to G (ET=180.81 microseconds) <-- here after hitting F11...
  159. :s 0 l ffffffff 'sometext'              <-- search for the new code ('sometext' is at the start of it)
  160. Pattern found at 0030:00403B60 (00403B60)   <-- found it :)
  161. :r eip=403b60                           <-- point the eip to it..
  162. :.                                      <-- '.' updates the code window
  163. :r eip=403b70                           <-- whoops, wrong place, skip past 'sometext',90,90,90,90....
  164. :e 405514 '00000000'                    <-- 'e' = edit memory, address, new contents (change serial to 00000000)
  165. :a 403B7C
  166. 015F:00403B7C call 4010d4               <-- where the nop's are, place our call..
  167. 015F:00403B81
  168. :bl
  169. 00)   BPX USER32!GetDlgItemTextA
  170. 01) * BPX USER32!GetWindowTextA
  171. 02) * BPX USER32!MessageBoxA
  172. 03) * BPX USER32!DialogBoxParamA
  173. 04) * BPINT 03
  174. :be 04              <-- enable my bpint 03
  175. :bd 00              <-- disable the bpx getdlgitemtexta
  176. :x
  177.  
  178.  
  179. and just wait... almost every time you 'ctrl-d' to enter soft-ice, you should be in d4crackme
  180. code, and you can check memory, d 405514, to see what serial your on...
  181.  
  182. one problem though, instead of cycling through 100 million numbers
  183. 10^8=10*10*10*10*10*10*10*10=100,000,000
  184. it has to do 
  185. 16^8=16*16*16*16*16*16*16*16=4,294,967,296 (4.2 billion....)
  186.  
  187. okay, 4.2 billion / 100 million = 42...42*10(10 minutes per 100 million)=420 minutes
  188. 420/60=7.1582788... hours...
  189.  
  190. heh, and its a total waste of time..either something wrong with my approach, or the serial is
  191. a 8 letter word, instead of a 8 letter number, DnNuke, the crack lies in your hands now, i have
  192. tried, and i have failed..
  193.  
  194. well, the first tutorial on how not to crack a crackme, hopefully will save anyone trying 
  195. wasting there time :)  but i wanna be shown the light, show me how to reverse the code, tell me
  196. the answer..  and i pray it is not a hexadecimal serial....
  197.  
  198.  
  199.  
  200. R!SC -- risc@notme.com -- http://csir.cjb.net  :~~(
  201.  
  202. greets to uncrackable crackme coders, especially Duelist & d4eMoN (maybe one day...)
  203. also to : Eternal Bliss, ACiD BuRN, DnNuke, Wizzkid, ChoJin, Magic Mike, Dead-Mike :P
  204.  
  205. etc...
  206.  
  207. remember, in the real world, we would be allowed to patch, and if that failed aswell, please
  208. say hello to Mr. Credit Card, who can crack faster & more reliably than anyone..
  209.  
  210.  
  211.  
  212.  
  213.  
  214. all my love, R!SC ?
  215.