home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / +Sandman / ttfp-tute.txt < prev    next >
Text File  |  2000-05-25  |  9KB  |  244 lines

  1.  
  2.  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3.  ::::::::::::::::::::::::::::: CRACKiNG TUTORiAL ::::::::::::::::::::::::::::
  4.  :::::::::::::::::::::::::::::     by Vizion     ::::::::::::::::::::::::::::
  5.  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6.  
  7.  :::: TARGET
  8.  
  9.  TTFPlus 3.3 32-bit demo (url : www.wmsoftware.com)
  10.  
  11.  :::: TOOLS 
  12.  
  13.  W32Dasm 8.9, SoftIce for NT 3.01, UltraEdit-32 4.40b
  14.  
  15.  :::: PROTECTiON
  16.  
  17.  Internal counter. 
  18.  The demo counts the number of times you select a font you like to see.
  19.  
  20.  :::: REMARK(s)
  21.  
  22.  Like usual, I assume you're able to use the tools mentioned above, and have
  23.  some knwoledge about ASM.
  24.  
  25.  I think, this is the first time I crack a target that hasn't been done
  26.  before. *CHEER*
  27.  
  28.  You will need to change winice.dat for this crack. Open winice.dat in your
  29.  favorite text editor and add the next line,
  30.  
  31.  EXP=<drive>:\<directory>\msvbvm50.dll
  32.  
  33.  Save the file and restart your computer if SoftIce is loaded.
  34.  
  35.  :::: FiND THE COUNTER
  36.  
  37.  Like always, start with loading the target in W32Dasm. The first thing I
  38.  noticed was that there were no String References. Pretty annoying if you
  39.  ask me. If you take a look at the list of .dll files that are used you'll
  40.  see only one :
  41.  
  42.   MSVBVM50.DLL aka. Microsoft Visual Basic Virtual Machine 5.0 (I think)
  43.  
  44.  Ok, this is quite new, and I haven't seen any tutorials on a VB5 program.
  45.  Due to the lack of String References and the usage of only one .dll file
  46.  we need a "new" approach to crack this baby, I suggest you sit down and
  47.  start thinking about the way to crack this target...
  48.  
  49.  Well I came up with the following idea.
  50.  
  51.  Start the target and select several times a font, after 10x clicking you'll
  52.  get the nag screen telling you... well read it :). The problem is that you
  53.  need to restart the target if you want to use it some more.
  54.  
  55.  Back in W32Dasm, take a look at the imported functions from the .dll,
  56.  
  57.  ...
  58.  
  59.  Addr:0F0D3109 hint(0000) Name: __vbaStrBool
  60.  Addr:0F01A5AE hint(0000) Name: __vbaExitProc
  61.  Addr:0F0239B1 hint(0000) Name: __vbaFileCloseAll
  62.  Addr:0F023FA0 hint(0000) Name: __vbaOnError
  63.  Addr:0F04F618 hint(0000) Name: __vbaObjSet
  64.  Addr:0F0CF404 hint(0253) Name: rtcMsgBox                    <--- interesting
  65.  Addr:0F0E326C hint(0000) Name: _adj_fdiv_m16i
  66.  Addr:0F023EA8 hint(0000) Name: __vbaObjSetAddref
  67.  Addr:0F0E336C hint(0000) Name: _adj_fdivr_m16i
  68.  Addr:0F0391DB hint(0256) Name: rtcDoEvents
  69.  Addr:0F0450B1 hint(0000) Name: __vbaBoolVar
  70.  Addr:0F0FDBB6 hint(0000) Name: __vbaBoolVarNull
  71.  
  72.  ...
  73.  
  74.  
  75.  Because I didn't had any other clues what to look for, I started the target
  76.  again and I fired SoftIce (SI) and I suggest you do that too. In SI (ctrl-d
  77.  to enter SI) set a breakpoint on rtcMsgBox,
  78.  
  79.  type (in SI) : bpx rtcMsgBox
  80.  
  81.  If SI reports "Symbol not defined (rtcMsgBox)", read the REMARK(s) part
  82.  again. Ok, exit SI (ctrl-d again), select 10x a font. You should be back in
  83.  SI, press F11 to get in the code of the target. Write down the address (for
  84.  me it was xxxx:0046A2F6).
  85.  
  86.  :::: Intermezzo :
  87.  :::: Make sure that the target is running, before you set your breakpoints.
  88.  :::: I noticed that SI will work properly only when the target is loaded, I
  89.  :::: guess that's because MSVBVM50.DLL needs to be loaded when you activate
  90.  :::: any breakpoints. Another thing, clear and create your breakpoints every
  91.  :::: time you start the target, else SI won't work like it should.
  92.  
  93.  Ok, disable the breakpoint and exit SI.
  94.  Get back in W32Dasm and goto the code location with the address you wrote
  95.  down. You should see the following code,
  96.  
  97.  ...
  98.  
  99.  * Reference To: MSVBVM50.rtcMsgBox, Ord:0253h
  100.                                   |
  101.  :0046A2F1 E8A28AF9FF              Call 00402D98
  102.  :0046A2F6 8D45A8                  lea eax, dword ptr [ebp-58]
  103.  :0046A2F9 50                      push eax
  104.  :0046A2FA 8D45B8                  lea eax, dword ptr [ebp-48]
  105.  :0046A2FD 50                      push eax
  106.  :0046A2FE 8D45C8                  lea eax, dword ptr [ebp-38]
  107.  :0046A301 50                      push eax
  108.  :0046A302 6A03                    push 00000003
  109.  
  110.  This event happens after we selected a font for the 10th time. So what we
  111.  do now? What do we look for? Sit down and start thinking (again ;).
  112.  
  113.  No ideas?
  114.  Well, check out any manual on the "8086 General Purpose Registers".
  115.  I read the following in two manuals I got,
  116.  
  117.  (1) "The ax register (Accumulator) is where most arithmetic and logical
  118.       computations take place. Although you can do ..."
  119.  
  120.  (2) "AH/AL AX (EAX) or Accumulator..."
  121.  
  122.  :::: Intermezzo :
  123.  :::: A very good and free book can be found on the internet.
  124.  :::: <http://webster.ucr.edu/page_asm/artofassembly/artofasm.html>
  125.  
  126.  We need to look for some code that manipulates the counter of our target,
  127.  probably using the ax register (this is just a feeling I had after reading
  128.  some parts of the manual I refered to).
  129.  
  130.  Ok, so start scrolling up the code in W32Dasm, until I arrived at a first
  131.  jump reference,
  132.  
  133.  ...
  134.  
  135.  :0046A1FC E82D8CF9FF              Call 00402E2E
  136.  
  137.  * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  138.  |:0046A1EE(C)
  139.  |
  140.  :0046A201 83A570FFFFFF00          and dword ptr [ebp+FFFFFF70], 00000000
  141.  :0046A208 83EC10                  sub esp, 00000010
  142.  :0046A20B C78568FFFFFF0B000000    mov dword ptr [ebp+FFFFFF68], 0000000B
  143.  
  144.  ...
  145.  
  146.  Use Goto|Goto Code Location from the menu with 0046A1EE. Continue to scroll
  147.  up till the next jump reference, goto that code location... Repeat this 6
  148.  times untill you get at the next code,
  149.  
  150.  ...
  151.  
  152.  * Reference To: MSVBVM50.__vbaObjSet, Ord:0000h
  153.                                   |
  154.  :0046A099 E8368DF9FF              Call 00402DD4
  155.  :0046A09E 8BF0                    mov esi, eax
  156.  :0046A0A0 8B06                    mov eax, dword ptr [esi]
  157.  :0046A0A2 6811000080              push 80000011
  158.  :0046A0A7 56                      push esi
  159.  :0046A0A8 FF5064                  call [eax+64]
  160.  :0046A0AB 85C0                    test eax, eax
  161.  :0046A0AD 7D0E                    jge 0046A0BD       <--- you should be here
  162.  :0046A0AF 6A64                    push 00000064
  163.  :0046A0B1 6878E34000              push 0040E378
  164.  :0046A0B6 56                      push esi
  165.  :0046A0B7 50                      push eax
  166.  
  167.  ...
  168.  
  169.  Remember we need to find some code that manipulates the counter aka. ax
  170.  register. So start scrolling up again, until you reach the following code,
  171.  
  172.  :00469F1E 89B568FFFFFF            mov dword ptr [ebp+FFFFFF68], esi
  173.  :00469F24 89B558FFFFFF            mov dword ptr [ebp+FFFFFF58], esi
  174.  :00469F2A 0F85DE030000            jne 0046A30E
  175.  :00469F30 66393556904700          cmp word ptr [00479056], si
  176.  :00469F37 0F8524060000            jne 0046A561
  177.  :00469F3D 66A158904700            mov ax, word ptr [00479058]       (1)
  178.  :00469F43 6640                    inc ax                            (2)
  179.  :00469F45 0F801F060000            jo 0046A56A                 
  180.  :00469F4B 663D0A00                cmp ax, 000A                      (3)
  181.  :00469F4F 66A358904700            mov word ptr [00479058], ax       (4)
  182.  :00469F55 0F8CB3030000            jl 0046A30E                       (5)
  183.  :00469F5B 8B8314030000            mov eax, dword ptr [ebx+00000314]
  184.  
  185.  
  186.  After everything I told you till now this should give you that real good
  187.  warm feeling. We're getting very close to the solution. Let me explain the
  188.  code above,
  189.  
  190.   (1) load something in ax from memory
  191.   (2) increase ax by 1
  192.   (3) compare ax with 10
  193.   (4) store new value of ax back in memory
  194.   (5) jump if ax is smaller then 10
  195.  
  196.  That could be it! To check if we found the right place, load the target and
  197.  get back in SI, set a breakpoint on 00479058
  198.  
  199.  type (in SI) : bpm 479058
  200.  
  201.  Get out of SI and select a font in TTFPlus, you should be back in SI right
  202.  at line (2), press F10. Get out of SI and repeat this several times you'll
  203.  notice that it's here where the counter is kept and updated.
  204.  
  205.  :::: THE CRACK
  206.  
  207.  Well, I think there are several solutions here. Let me show you some, you
  208.  could change line (1) into mov ax, 0 -OR- replace line (2) with 2 NOP (90h)
  209.  instructions -OR-  change line (5) into jmp 0046A30E.
  210.  
  211.  All three solutions will do the job. To go on with this tutorial I will
  212.  use the 2nd solution. Go back to W32Dasm and get the offset of line (2).
  213.  Now load the target (make a back-up copy) in UltraEdit or any hex-editor
  214.  and goto the offset you wrote down (for me it was : 0006:9343).
  215.  
  216.  Now you should see the following line,
  217.  
  218.  00069340h: 90 47 66 40 0F 80 1F 06 00 00 66 3D 0A 00 66
  219.                   ^^ ^^
  220.  
  221.  change this to
  222.  
  223.  00069340h: 90 47 90 90 0F 80 1F 06 00 00 66 3D 0A 00 66
  224.                   ^^ ^^
  225.  
  226.  This should do it. Now the counter will never reach 10, so the demo will
  227.  never "expire". Save the file, exit, and enjoy...
  228.  
  229.  Voila, another target cracked.
  230.  
  231.  You could ask yourself, why this way? Call it ZeN (I refer to the tutorials
  232.  of the famous +ORC, for the meaning of this). Call it anything you want, it
  233.  was just a feeling I had. Maybe this isn't the shortest, best or easiest
  234.  way. This is just the method I used to solve this problem. I just started
  235.  cracking some 3 months ago, so if any of you "veterans" find a better way to
  236.  crack this target, or any VB5 programs, let me know.
  237.  
  238.  
  239.  So that's all folks, I hoped you enjoyed and learned something.
  240.  
  241.  Vizion, 09/97.
  242.  
  243. .EOF.
  244.