home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Mendoza / xoanon-flags.txt < prev   
Text File  |  2000-05-25  |  10KB  |  208 lines

  1. The flags-faking approach
  2.  
  3.      Well, i decided to write this little essay for everyone (especially
  4.      newbies) who does not like to spend a lot of time trying to decypher
  5.      lines and lines of (meaningless?) code inside too many protection
  6.      schemes.
  7.  
  8.      For example, have u ever found a serial number protected program which
  9.      u were not able to crack? I bet you have! You change a lot of bytes,
  10.      and yet it still sayd "Unregistered" and the "only for registered
  11.      users" options were still disabled.
  12.  
  13.      On the other hand, did the following ever happen to you? A crippled
  14.      program with some options disabled and u DO NOT FIGURE how to enable
  15.      them? Well, go to the nearest tobacconist, buy a cool box of Marlboro
  16.      Lights (or the red ones, if you prefer), choose a rainy day (the best
  17.      for cracking purposes), sit in front of your PC and load this essay in
  18.      your favourite text-editor (i use old, good dos EDIT). By the way, i
  19.      hope you'll be able to read it, coz i dunno if the +HCU will really be
  20.      interested on this piece of text.... in fact it doesn't describe any
  21.      new protection scheme, it describes merely a different approach on
  22.      cracking a lot of programs.
  23.  
  24. Ok, let's start!
  25.  
  26.      I will take as example a program called "HyperCam" v1.19, sort of an
  27.      AVI recorder of what happens on your screen... really good, especially
  28.      if u want to create an animated "cracking essay" for your new brand
  29.      cool target :-)
  30.  
  31.      To get it go to www.hyperionics.com - HYPERCAM.ZIP - 251819 bytes (i'm
  32.      not really sure of the ZIP name, i found it on a CD. But I believe it
  33.      should be right)
  34.  
  35.      Well, it's nothing new from the point of view of the protection
  36.      scheme, as I said... the only thing to notice is that it uses a very
  37.      very nasty key creation algorithm, maybe not understandable by most
  38.      newbie-crackers. Also, it stores the registration infos in a file
  39.      called HYPERCAM.LIC, so it needs quite a lot of work to crack it.
  40.  
  41.      Ok, but this time we don't want to crack it with the usual "BMSG xxxx
  42.      WM_COMMAND" no?
  43.  
  44.      We want to try something new! Light your cigarettes, fire your SoftICE
  45.      and install a good disassembler (i use now WDasm 8 <- thanx a lot to
  46.      Frog's Print for cracking it! very good work!).
  47.  
  48.      The "protection" consist, basically, in the following scheme:
  49.  
  50.      1) It displays a nag screen at the beginning
  51.      2) It adds a boring "HyperCam Unregistered" to all your nice AVI
  52.      creations
  53.  
  54.      So, let's begin examining the "Unregistered Hypercam" add-on to the
  55.      AVIs, i.e. the nagstring:
  56.  
  57.      Since we want to crack it without really "registering" it, we have to
  58.      take care of the flags that the program controls in order to know if
  59.      it's registered or not.
  60.  
  61.      Usually, a program will store in a location a "00" if unregistered
  62.      (=FALSE) and a "01" if it's registered (=TRUE)... that's most of the
  63.      times NOT a protectionist choice, that's the overbloated programming
  64.      language doing it whithout ever letting them to know that this happens
  65.      :-)
  66.  
  67.      We have to find this "holy" location. How? In this way:
  68.  
  69.      1) Load up WDasm and disassemble HYPERCAM.EXE, save the *.alf. (be
  70.      sure to use the cracked one by FrogPrint!! If you use the demo one u
  71.      will not be able to examine the textfile at leisure inside your
  72.      wordprocessor!)
  73.      2) Search the nagstring it adds to all your AVIs: "Unregistered
  74.      Hypercam" YEAH!!!! FOUND IT! Examine this piece of code: (don't care
  75.      about my comments now, yu'll look at them after)
  76.  
  77.      * Referenced by a Jump at Address :00401464(C)
  78.      |
  79.      :0040151C A1C0A34300           mov eax, [0043A3C0]  *** < Now is "0"
  80.      :00401521 85C0                 test eax, eax            < If "0"
  81.      :00401523 740F                 je 00401534          *** < You suck!
  82.      :00401525 8B0D045E4300         mov ecx, [00435E04]      < Checks again
  83.      :0040152B A1C0504300           mov eax, [004350C0]      < with another flag
  84.      :00401530 3BC8                 cmp ecx, eax         *** < Final Check
  85.      :00401532 7418                 je 0040154C              < Equal? BRAVO=!!
  86.  
  87.      Here we see that if the TEXT EAX,EAX fails at :401521 it will jump to
  88.      401534 Hmmm..... maybe DS:43A3C0 is the holy location where our flag
  89.      is stored? YES!!!!
  90.  
  91.      * Referenced by a Jump at Address :00401523(C)
  92.      |
  93.      :00401534 8B1534A14300         mov edx, [0043A134]      < not equal ?
  94.      :0040153A 6A15                 push 00000015            < NISBA! (italian)
  95.  
  96.      * Possible StringData Ref from Data Obj ->"Unregistered HyperCam"
  97.                                        |
  98.      :0040153C 68D0504300         push 004350D0              < the Unregistered
  99.      :00401541 6A00               push 00000000              < string is added
  100.      :00401543 6A00               push 00000000              < to your AVIs
  101.      :00401545 52                 push edx
  102.  
  103.      (lines tagged with a "***" will be the targets of our crack)
  104.  
  105.      We found something interesting nah? Well, fire your ice (eh... i mean
  106.      Winice!), run the program and set a BPX which let us return the
  107.      debugger after doing something.... for example, i often use
  108.      KERNEL!HMEMCPY and choose an option in which i can enter some
  109.      strings.... but it's only an example, you could do it in a lot of
  110.      other ways.... Well,
  111.  
  112.      :BPX KERNEL!HMEMCPY
  113.  
  114.    * CTRL-D and select now an option in which you can enter some text (for
  115.      example, the "License" option). After entering, you will land in
  116.      Winice again
  117.  
  118.    * Now hit F12 (trace-back) until you reach the code of HYPERCAM Remember
  119.      to remove first the KERNEL!HMEMCPY breakpoint!
  120.  
  121.    * Reached? ok, search now in this segment the first bytes of our code
  122.      for me it is 22f, so :
  123.  
  124.      :S 22f:0 lffffffff A1 C0 A3 43 00 85 C0 74 0F 8B
  125.  
  126.      if you don't find it, it's simply bcoz maybe that piece of code isn't
  127.      loaded in memory yet, it is not yet "pinpointed". So, choose the "AVI
  128.      record" option and record something. Then retry and you'll find it.
  129.  
  130.    * Set a BPX now at address you found these bytes in (the beginning of
  131.      the code showed before). For me, it is 22f:1ef91c, so :
  132.  
  133.      :BPX 22F:1EF91C
  134.  
  135.    * Ok, now we have set the breakpoint, hoping the best when we reload it
  136.      and try to create an avi (or even when the program is restarted, we
  137.      don't know now if it will work or not) it should break inside
  138.      softice... TRY!
  139.  
  140.    * Now examine the comments in my code, and u should see that the flag
  141.      which control all is located at DS:43A3C0. Infact if the 2 checks
  142.      fails, the PUSH 004350D0 will save in stack the "Unregistered
  143.      Hypercam" string (you can see it by dumping memory D 4350D0 as soon as
  144.      you reach the push).
  145.  
  146.      Well, now we know where the flag is... can we suppose that it controls
  147.      the initial nagscreen as well? yes of course! :)
  148.  
  149.      Remove all the BPXs, set a new BPM DS:43A3C0 and restart the program!
  150.  
  151.      Now we can see what happens to that "flag" location since the
  152.      beginning... You will land in softice 2 times, and after the 2nd time
  153.      the nagscreen will appear. So, what does this mean? Easy: the first
  154.      time softice pops up inside a piece of code which resets the flags,
  155.      the second time (our target) when the programs checks it. But look:
  156.  
  157.      2nd popup:
  158.  
  159.      :00404958 8BCD               mov ecx, ebp
  160.      :0040495A E83C610200         call 0042AA9B
  161.      :0040495F 39BD48010000       cmp [ebp+00000148], edi < you will land here
  162.      :00404965 750D               jne 00404974            < if not equal jump
  163.      :00404967 6AFF               push FFFFFFFF           < if not.....
  164.      :00404969 57                 push edi                < after some calls
  165.      :0040496A 688B000000         push 0000008B           < the nag pops up!
  166.      :0040496F E886270200         call 004270FA
  167.  
  168.      as u have noticed, EBP+148 is our "flag" location : 43A3C0 !!!
  169.  
  170.      We are finished now!
  171.  
  172.      Change .CMP [EBP+148],EDI with .MOVE BYTE PTR [EBP+148],1  < move always 1
  173.             .JNE 404974             .JMP 404974                 < in our flag
  174.  
  175.      Back to 401530, change also the JE 40154C to JMP 40154C to fool
  176.      completely the protection scheme.
  177.  
  178.      Note that you have to change all of these, 'coz only removing the nag
  179.      or the string doesn't work. You can check this yourself examining the
  180.      code....
  181.  
  182.      Ah.... a little side effects of this kind of approach *MAY BE* that
  183.      the program still say it isn't registered... even if all the options
  184.      are now cracked and enabled and even if the nag screens has been
  185.      removed.
  186.  
  187.      This is what happens in HyperCam... but could happen in other programs
  188.      too ('bcoz obviously you don't register them normally, whit this
  189.      approach you don't enter any name/serial, you only fool the program to
  190.      *THINK* it's registered...). But who cares? The main thing is to have
  191.      a fully working version nah?
  192.  
  193.      Well, i hope this little piece of txt could help you... it is often
  194.      easier and faster to handle (read crack) the flags than trying to
  195.      bypass the "real" number check or whatever the protection scheme
  196.      does... also you can apply this approach to nearly every kind of
  197.      protection... the main steps you should follow are:
  198.  
  199.      1) Search references to the nag/unregistered/ecc. things in the code
  200.      2) Correctly identify the flags
  201.      3) BPM their locations and examine the code which refers to them.
  202.      4) Modify them to let the program think it's registered/deprotected.
  203.  
  204.      CIAO!
  205.  
  206.                                                 by [>Xoanon<]/PiNNACLE 1997
  207.  
  208.