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

  1.                            --Softice Tutorial--- 
  2.  
  3. Written by Shany
  4. Email: shanytc@yahoo.com
  5. Date written: 12.5.2001
  6.  
  7. Program Details:
  8. Name: Acid_Burn CrackerWorld CrackMe #2
  9. Author: BenGALY
  10.  
  11. Tools Used:
  12. Softice
  13. Hview
  14.  
  15. Level:
  16. easy [x] medium [ ] hard [ ]
  17.  
  18. ok.. another CrackMe on the hands..this time Triple Protections: 
  19. 1.nag
  20. 2.serial
  21. 3.serial/name
  22.  
  23. ok..first let's deal with the nag.
  24.  
  25. [v] 1.              -----NAG------
  26.  
  27. When we openning the crackme there is a little MessageBoxA appears,
  28. A Nag as we say in cracking tearms.
  29.  
  30. "Hello you have to kill me!" <= this is what the nag say.
  31.  
  32. ok..let's kill him ;D
  33.  
  34. To do this the easiest way to kick the nag is bpx bfore the nag is appeared,
  35. That way we can see which call called this nag and kick the instruction ;D
  36.  
  37. so Open Soft-Ice..set a sweet bpx on api "MessageBoxA" :
  38.  
  39.       bpx MessageBoxA
  40.        'press Enter'
  41.  
  42. breakpint is set..now exit sIce (x/f5/ctrl+d).
  43. Click the crackme2.exe..Sice poped up now Press F12 or F11, that will take,
  44. Us to the caller of the nag (messageboxa api).
  45. we will be out of Ice automatically anf u will see the nag screen appear.
  46. Press OK button and Sice will pop up again.
  47.  
  48. u will see this:
  49.  
  50. EAX=00000001   EBX=00C42EAC   ECX=80007638 EDX=80007390<FONT   ESI=0042F7BC       
  51. EDI=0042F7A0   EBP=0071FCB8   ESP=0071FC94 EIP=0042A1AE        o d I Sz a p c    
  52. CS=0177   DS=017F   SS=017F   ES=017F   FS=33CF   GS=0000   SS:0071FCB4=01C435F0
  53. -------------------------------------------------------------------------PROT32-
  54. 0177:0042A1A9  CALL      USER32!MessageBoxA    <= Write that Adress (0042A1A9) call of nagScreen.                          
  55. 0177:0042A1AE  MOV       [EBP-04],EAX          ; eax move to ebp-04                                       
  56. 0177:0042A1B1  XOR       EAX,EAX               ; eax = 0             
  57. 0177:0042A1B3  POP       EDX                   ; load edx                       
  58. 0177:0042A1B4  POP       ECX                   ; load ecx                       
  59. 0177:0042A1B5  POP       ECX                   ; load ecx again                                 
  60. 0177:0042A1B6  MOV       FS:[EAX],EDX          ; edx move to eax locatino                                 
  61. 0177:0042A1B9  PUSH      0042A1D7              ; click OK ?                             
  62. 0177:0042A1BE  MOV       EAX,[EBP-0C]          ; ebp-0c move to eax                              
  63. 0177:0042A1C1  CALL      00424250              ; call to program?       
  64. --------------------------------------------------------------------------------
  65. WINICE: Load32  Obj=0002 Add=017F:7D652000 Len=00001000 Mod=INDICDLL            
  66. WINICE: Load32  Obj=0003 Add=017F:7D653000 Len=00001000 Mod=INDICDLL            
  67. WINICE: Load32  Obj=0004 Add=017F:7D654000 Len=00001000 Mod=INDICDLL           
  68. WINICE: Load32  Obj=0005 Add=017F:7D655000 Len=00001000 Mod=INDICDLL            
  69. Break due to BPX USER32!MessageBoxA  (ET=1.48 seconds)                          
  70.  
  71. so..we have found the switch that calls our little NagScreen: 0042A1A9 (in hex)
  72. so what we goona do is to goo to hex editor and loop for : 0042A1A9.
  73.  
  74.                     ----Patching-Nag-Screen---:
  75.  
  76. Open Hview..load the crackme.
  77. press F4..select DECODE mode..press F5 enter the adress .0042A1A9 (with .)..we will be here:
  78.  
  79. ....snip...snip...
  80. .0042A1A9 E8FAB5FDFF    CALL 00405718    <= this is what need to patch
  81. .....snip snip....
  82.  
  83. lets devide this to bytes:
  84. E8FAB5FDFF -> E8 FA B5 FD FF (5 bytes)
  85.                1  2  3  4  5
  86.     
  87. now alittle Nop (90) instruction could help us kick the MessageBoxA
  88. beacouse it's a byte long we will need to put 90 on any instruction like this
  89.  
  90. now press F3 in Hview and do this:
  91.  
  92. E8FAB5FDFF
  93.  
  94. to
  95.  
  96. 9090909090
  97.  
  98. F9 to save the file, F10 to exit...run the program..NO MORE NAG SCREEN ;D
  99.  
  100. ------------------------Nag Screen Kicked-----------------------
  101.  
  102.  
  103. Ok now that the nag screen is kicked, we can continue with our crackme.
  104.  
  105.  
  106. [v] 2.        ---------------SERIAL------------------
  107.  
  108. open the crackme..there are to options..1.serial 2.serial/name
  109. Chose Serial only button.
  110.  
  111. ok enter a fake serial.
  112. serial: 1234567890
  113.  
  114. but before press "check it baby" let's open Sice and set a bpx on HMEMCPY.
  115.  
  116. now i will teach u a little trick i found..
  117. mostly 90% of hmemcpy serial/name protections breakpoints i can press f12 with only see
  118. the code and even not understand it, most of times u will only press F12 (12 times).
  119. in our cases it 12 f12 aswell.
  120. here:
  121. bpx hmemcpy
  122. f5
  123. "check it baby"'
  124.  
  125. we will land here: (after pressed "check it baby")
  126.  
  127.  
  128. first breakPoint (without pressing f12 yet):
  129.  
  130. -----KERNEL!LOGERROR+0123------------------------------------------------PROT16-
  131. 0157:9EA3  RETF      0008                                                      
  132. KERNEL!HMEMCPY                                                                 
  133. 0157:9EA6  PUSH      BP                                                         
  134. 0157:9EA7  MOV       BP,SP                                                      
  135. 0157:9EA9  PUSH      DS                                                         
  136. 0157:9EAA  PUSH      EDI                                                       
  137. 0157:9EAC  PUSH      ESI                                                        
  138. 0157:9EAE  CLD                                                                 
  139. 0157:9EAF  MOV       ECX,[BP+06]                                            
  140. 0157:9EB3  JECXZ     9F2D                                                 
  141. ------------------------------------KERNEL(01)-<----dll..not the crack me code yet
  142.  
  143. pressing 1 time f12 will bring us this:
  144. ...........................................................
  145. 177F:0CA6  CALL      KERNEL!HMEMCPY                                           
  146. 177F:0CAB  PUSH      WORD PTR [DI]                                           
  147. 177F:0CAD  CALL      KERNEL!LOCALUNLOCK                                         
  148. 177F:0CB2  MOV       AX,SI                                                      
  149. 177F:0CB4  POP       SI                                                         
  150. 177F:0CB5  POP       DI                                                         
  151. 177F:0CB6  LEAVE                                                                
  152. 177F:0CB7  RET       000A                                                       
  153. 177F:0CBA  ENTER     0006,00                                                  
  154. 177F:0CBE  PUSH      SI                                                   
  155. ────────────────────────────────────USER(0A)─────────────────────────────────
  156.  
  157. nope still no effect.
  158.  
  159. pressing 6 more times more will bring u the same result, only in diffrent dll.
  160. but, in the 7'th (f12) we will see this:
  161.  
  162. EAX=0000000A   EBX=0071F860   ECX=00000014   EDX=0041CD2D   ESI=00C49440        
  163. EDI=0071F8A0   EBP=0071F870   ESP=0071F820   EIP=0042C4C2   o d I s z a P c     
  164. CS=0177   DS=017F   SS=017F   ES=017F   FS=316F   GS=0000                       
  165. ─────────────────────────────────────────────────────────────────────────PROT32─
  166. 0177:0042C4BD  CALL      0041CC8C                                             
  167. 0177:0042C4C2  POP       ESI              ; not matter                                      
  168. 0177:0042C4C3  POP       EBX              ; not matter                                       
  169. 0177:0042C4C4  RET                        ; return                                      
  170. 0177:0042C4C5  LEA       EAX,[EAX+00]     ; not matter                                       
  171. 0177:0042C4C8  PUSH      ESI              ; not matter                                       
  172. 0177:0042C4C9  MOV       ESI,EAX          ; not matter                                       
  173. 0177:0042C4CB  MOV       EAX,ESI          ; not matter                                       
  174. 0177:0042C4CD  MOV       ECX,[EAX]        ; not matter                                      
  175. 0177:0042C4CF  CALL      [ECX-10]         ; not matter                                 
  176. ────────────────────────────────────────────────────────────────────────────────
  177.    
  178.                                                       Crackme2  <= we see the crackme name.
  179.  
  180. well this is much better cuz we see the crackme code at last.
  181. ok here is is the trick..in knowing where the hell is the right place that the serial
  182. might generate..so in 90+% of casses if u wil press f12 (5 more time) from the 7th f12..u will 
  183. surely be at the exact place the serial is.
  184.  
  185. 12'th f12 pressed we land here:
  186.  
  187. ─────────────────────────────────────────────────────────────────────────PROT32─
  188. 0177:0042F4C5  CALL      0041AA58            ; call input TextA field                                           
  189. 0177:0042F4CA  MOV       EAX,[EBP-10]        ; ebp-10 move to eax                                  
  190. 0177:0042F4CD  MOV       EDX,[EBP-0C]        ; ebp-0c move to edx                                   
  191. 0177:0042F4D0  CALL      004039FC            ; call compare (trace into with f8)                                  
  192. 0177:0042F4D5  JNZ       0042F4F1            ; bad serial??..jump to bad boy message                                   
  193. 0177:0042F4D7  PUSH      00                  ; call api?                                   
  194. 0177:0042F4D9  MOV       ECX,0042F564        ; cant reach here unless serial is correct ;D                                   
  195. 0177:0042F4DE  MOV       EDX,0042F570        ; cant reach here unless serial is correct ;D                                   
  196. 0177:0042F4E3  MOV       EAX,[00430A48]      ; cant reach here unless serial is correct ;D                                  
  197. 0177:0042F4E8  MOV       EAX,[EAX]           ; cant reach here unless serial is correct ;D                              
  198. ────────────────────────────────────────────────────────────────────────────────
  199.                                                
  200.                                                         Crackme2 <= make sure u see this
  201.  
  202.  
  203. so..this is the main part of the crackme (serial) checking routine.
  204. so we see a little Call and a JMP after it..that's good becouse:
  205.  
  206. 1.we can be suspicious that if there is a call and then a jmp so there might be a compare
  207. 2.or call algo..and then jump if not correct (serial)
  208.  
  209. ok..we have a Call..trace into the Call with F8 (while tracer on that instruction).
  210. we are here:
  211.  
  212. ................................................................................
  213. 0177:004039F9  LEA       EAX,[EAX+00]                                          
  214. 0177:004039FC  PUSH      EBX                ; Save EBX                                            
  215. 0177:004039FD  PUSH      ESI                ; Save ESI                                     
  216. 0177:004039FE  PUSH      EDI                ; Savr EDI                                    
  217. 0177:004039FF  MOV       ESI,EAX            ; Fake  move to esi (eax/esi = fake serial)                                    
  218. 0177:00403A01  MOV       EDI,EDX            ; real serial move to edi (edx/edi = serial)                                    
  219. 0177:00403A03  CMP       EAX,EDX            ; Comapre EDX & EAX                                    
  220. 0177:00403A05  JZ        00403A9A           ; GOOD BOY ;d                                    
  221. 0177:00403A0B  TEST      ESI,ESI            ; ESI = 0?                                 
  222. 0177:00403A0D  JZ        00403A77           ; JUMP                               
  223. ────────────────────────────────────────────────────────────────────────────────
  224.  
  225. Wow you say, it's so easy u say..well it is ;D
  226. just do this folowing:
  227.  
  228. At Adress: 004039FF
  229. :D EAX 
  230. 017F:00C4A4D0 32 31 33 34 35 36 37 38-39 30 00 00 52 07 00 00  2134567890..R... ;fake no ;D
  231. 017F:00C4A4E0 80 87 C4 00 00 00 00 00-0F 00 00 80 00 00 00 00  ................
  232.  
  233. At Adress: 00403A03
  234. :D EDX
  235. 017F:00C4A4B8 48 65 6C 6C 6F 20 44 75-64 65 21 00 1A 00 00 00  Hello Dude!..... ; good serial ;D
  236. 017F:00C4A4C8 01 00 00 00 0A 00 00 00-32 31 33 34 35 36 37 38  ........21345678 ; fake serial
  237.  
  238. serial:  Hello Dude!
  239.  
  240. "GOD JUB DUDE" lol a spelling mistake..
  241.  
  242. hahaha u can see that this was a little compare to our serial no??..yeah ;D
  243.  
  244. serial protection cracked.
  245.  
  246. ------------------------First Serial Protection Cracked-----------------------
  247.  
  248. onto the third serial/name protection ;D
  249.  
  250.  
  251. [v] 3.  --------------Serial/Name Protection-------------
  252.  
  253.  
  254. ok..this method is also the same as described above..but we only need to break on the 
  255. second textA field of our serial.
  256.  
  257. do the folowing:
  258.  
  259. name: bengaly
  260. serial: 1234567890
  261.  
  262. load Sice..bpx hmemcpy
  263. f5
  264. click "check it baby"
  265. sIce breakes..now press F5 to read the SERIAL textA field.
  266. *remember what i have said erlier on hmemcpy..that if u will press F12 12 times it will
  267. 90+% take u to the right place of our serial comparation/calculation/generation.
  268. so it.
  269. did it??
  270. if so we are here:
  271.  
  272. ─────────────────────────────────────────────────────────────────────────PROT32─
  273. 0177:0042F9E3  CALL      0041AA58                                                
  274. 0177:0042F9E8  MOV       EAX,[EBP-10]           <= we land here                                   
  275. 0177:0042F9EB  MOVZX     EAX,BYTE PTR [EAX]     ; move 1 byte od                                 
  276. 0177:0042F9EE  MOV       ESI,EAX                ; eax move to esi                               
  277. 0177:0042F9F0  SHL       ESI,03                 ; shift left 03 om esi                                
  278. 0177:0042F9F3  SUB       ESI,EAX                ; esi-eax                               
  279. 0177:0042F9F5  LEA       EDX,[EBP-14]           ; move                                
  280. 0177:0042F9F8  MOV       EAX,[EBX+000001DC]     ; move                                
  281. 0177:0042F9FE  CALL      0041AA58               ; call ??                               
  282. 0177:0042FA03  MOV       EAX,[EBP-14]           ; move                          
  283. ────────────────────────────────────────────────────────────────────────────────
  284.  
  285. but..wait where is the call and the jmp ..what is going on here???
  286. hahah didn't figure??..ok..so s i said, WE NEED TO LOOK FOR A CALL->ANY JMP
  287. where we land a call and a jump after it is not there, so therefore we need to
  288. trace with F10 alittle.
  289. first clear breakpoints BC* (So we wont jump to adresses).
  290. after a short tracing we are here:
  291.  
  292. ─────────────────────────────────────────────────────────────────────────PROT32─
  293. 0177:0042FA36  CALL      0041AA58                                              
  294. 0177:0042FA3B  MOV       EAX,[EBP-14]                                          
  295. 0177:0042FA3E  MOVZX     EAX,BYTE PTR [EAX+02]                                  
  296. 0177:0042FA42  IMUL      EAX,EAX,0E                                             
  297. 0177:0042FA45  ADD       ESI,EAX                                                
  298. 0177:0042FA47  MOV       [00431758],ESI                                         
  299. 0177:0042FA4D  MOV       EAX,[0043176C]                                         
  300. 0177:0042FA52  CALL      00406930          ; Call Compare routine  -| trace into this call                                          
  301. 0177:0042FA57  CMP       EAX,04                                     |            
  302. 0177:0042FA5A  JGE       0042FA79          ; A jump             <= -| never mind the jump       
  303. ────────────────────────────────────────────────────────────────────────────────
  304.  
  305.  
  306. after we traced the call with f8 u will see this:
  307.  
  308. ─────────────────────────────────────────────────────────────────────────PROT32─
  309. 0177:0040692E  CMP       AL,[EAX]                                              
  310. 0177:00406930  MOV       EDX,EDI           <- we land here                                         
  311. 0177:00406932  MOV       EDI,EAX           ; WHAT IS THIS??                                     
  312. 0177:00406934  MOV       ECX,FFFFFFFF                                           
  313. 0177:00406939  XOR       AL,AL                                                  
  314. 0177:0040693B  REPNZ SCASB                                                      
  315. 0177:0040693D  MOV       EAX,FFFFFFFE                                           
  316. 0177:00406942  SUB       EAX,ECX                                                
  317. 0177:00406944  MOV       EDI,EDX                                              
  318. 0177:00406946  RET                                                         
  319. ────────────────────────────────────────────────────────────────────────────────
  320.  
  321. *Somtimes dont expect see a CMP instruction..that dont mean the serial isn't there ;D
  322.  
  323. go over adress : 00406932
  324.  
  325. D EAX
  326. 017F:00C4A54C 07 00 00 00 62 65 6E 67-61 6C 79 00 16 00 00 00  ....bengaly..... 
  327. 017F:00C4A55C 01 00 00 00 07 00 00 00-62 65 6E 67 61 6C 79 00  ........bengaly. ; name
  328. 017F:00C4A56C 0F 00 00 80 00 00 00 00-00 00 00 00 43 57 2D 38  ............CW-8 ; good serial
  329. 017F:00C4A57C 30 33 36 2D 43 52 41 43-4B 45 44 00 84 53 C4 00  036-CRACKED..S.. ; good serial
  330. 017F:00C4A58C 84 53 C4 00 38 00 00 00-31 32 33 34 35 36 37 38  .S..8...12345678 ;fake serial
  331. 017F:00C4A59C 39 30 30 00 A0 A5 C4 00-A0 A5 C4 00 20 00 00 00  900......... ... 
  332. 017F:00C4A5AC 26 43 68 65 63 6B 20 69-74 20 42 61 62 79 20 21  &Check it Baby ! 
  333.  
  334. name: bengaly
  335. serial: CW-8036-CRACKED
  336.  
  337. we will get "GOOD JUB DUDE!"
  338.  
  339. ---------------------------------Serial/Name Cracked-----------------------------
  340.  
  341. have fun ;D
  342.  
  343.                   My thanks and gratitude goes to:
  344.  
  345.                    ---ANALYST(ACiD-BUrN)--- ; for helping in cracking
  346.                       ----CODE_INSIDE----- ;for helping in cracking
  347.                      -----BLAcKgH0sT------ ;for being good friend :)
  348.                        -------FusS------   ;asm / keygenning helper
  349.  
  350.            All the writers of Cracks tutorials and CrackMes