home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / VIRUS / PCV4RPT.ZIP / FLIP.RPT < prev    next >
Encoding:
Text File  |  1991-05-28  |  15.0 KB  |  270 lines

  1.  
  2.              *********************************************
  3.              ***   Reports collected and collated by   ***
  4.              ***            PC-Virus Index             ***
  5.              ***      with full acknowledgements       ***
  6.              ***            to the authors             ***
  7.              *********************************************
  8.  
  9.  
  10.   Report from Jim Bates - The Virus Information Service - August 1990
  11.  
  12.   === FLIP Virus ===
  13.  
  14.   PC viruses are generally categorised into two main types - Boot
  15.   Sector viruses (which include those that modify the Master Boot
  16.   Record) and Parasitic viruses which are far more common and spread
  17.   by infecting program files.  It has long been expected that a
  18.   composite of these types would eventually appear and the FLIP virus
  19.   is the first one of these that I have actually seen and had the
  20.   opportunity to examine in detail.  The code seems to have been
  21.   written by an experienced programmer and obviously took quite some
  22.   time to develop.  The trigger routine affects only systems with EGA
  23.   or VGA monitor facilities and produces a mirror image effect in
  24.   screen modes 2 and 3, flipping the display horizontally and showing
  25.   a modified font which reverses each character.  Some disturbing new
  26.   trends are also evident within this code, particularly a number of
  27.   routines which attempt to avoid the attentions of resident
  28.   monitoring software or pervert the actions of a particular virus
  29.   detection program.  The code appended to files has a simple
  30.   encryption algorithm but that written to the MBR and elsewhere on
  31.   the disk is not encrypted and is therefore easy to recognise. Apart
  32.   from the one instance mentioned above, this virus makes no attempt
  33.   to protect itself from detection although the randomisation of the
  34.   position of the decryption routine does prevent the extraction of a
  35.   recognition "signature" for the parasitic code.  Simple file
  36.   checking programs however, will be able to recognise the file
  37.   changes introduced by infection even if the system is infected while
  38.   the checking is in progress.
  39.  
  40.   There are three main paths by which this code can be executed,
  41.   infected COM type files, infected EXE type files and the Boot code.
  42.   The virus does NOT check file names so renamed COM or EXE files are
  43.   still processed correctly according to their type.  Subsequent
  44.   references here to COM or EXE files should therefore be considered
  45.   as COM (or EXE) TYPE files. Parasitic infection is invoked via an
  46.   interrupt handling routine which intercepts the LOAD and EXECUTE
  47.   function request.  This means that files with other extension names
  48.   (BIN, OVL etc.) could become infected although overlays are
  49.   specifically excluded.  COM type files are only infected if they are
  50.   less than 62856 bytes in length, and once infected they take no
  51.   further part in the virus operation or replication processes.  Thus
  52.   when an infected COM file is run, the virus code is decrypted and
  53.   the first few instructions are executed to repair the file header.
  54.   However, processing then returns directly to the host program
  55.   regardless of whether the virus has been installed or not.  This
  56.   infection of COM files with totally ineffective code appears to be
  57.   deliberate and may indicate an intention to add "improvements" at a
  58.   later date.
  59.  
  60.   When an infected EXE file is executed, a special "are you there?"
  61.   call is issued to determine whether the virus code is resident and
  62.   active in memory.  If the virus code responds, program execution is
  63.   transferred to the host program and no further virus code is
  64.   executed.  The special call consists of placing 0FE01H into the AX
  65.   register and issuing an INT 21H request.  If the virus is resident,
  66.   the AX register will contain 01EFH when the interrupt returns.  If
  67.   the virus is not resident, a check is made to ensure that enough
  68.   memory is available for the virus to be installed and then the BIOS
  69.   top of memory pointer is modified before the virus code is installed
  70.   into high memory.  This method therefore avoids using any of the
  71.   system TSR services.  Once the code is relocated, the MBR of the
  72.   first physical fixed disk is checked to see if it is infected.  This
  73.   check consists of examining the word at offset 28H in the MBR (Track
  74.   0, Head 0, Sector 1) for a value of 01FEH.  If the MBR is NOT
  75.   infected, the partition table is searched for the first partition of
  76.   type 1,4 or 6 - these are standard partition types and on most
  77.   machines the first (possibly only) partition will be type 4 (DOS -
  78.   16 bit FAT).  Once found, the settings of this partition are checked
  79.   to ensure that infection is possible and then modified to allow
  80.   hidden storage of the virus code.  Most boot sector viruses hide
  81.   their additional code in available sectors on the hard disk and then
  82.   mark them as "bad" so that DOS will not use them.  This virus adopts
  83.   a different technique - within the partition table there are
  84.   pointers to the physical limits of each partition.  These indicate
  85.   the absolute track, head and sector addresses of the start and end
  86.   of each partition.  This virus subtracts 6 from the value of the
  87.   sector address which points to the end of the partition.  This
  88.   effectively reduces the size of that logical drive by 6 sectors
  89.   (around 3 Kilobytes) and leaves 6 sectors "in limbo" beyond the end
  90.   of drive.  The first of these sectors is used to contain an
  91.   uninfected copy of the MBR (but still with the modified partition
  92.   table) and the remaining five will contain the virus code. The
  93.   original MBR is then infected and written back to the disk.  The
  94.   final stage of this section is to hook the virus's own INT 21H
  95.   handler into the system and then processing returns to the host
  96.   program.  A system infected by execution of an EXE file will not
  97.   display the trigger effect even if the appropriate video adapter is
  98.   available and the date and time are right.  This is because an
  99.   inhibit flag is set which can only be cleared when the machine is
  100.   booted on the correct date.
  101.  
  102.   The boot sequence on a machine with an infected hard disk proceeds
  103.   as follows :- After the normal initialisation of the Stack Segment
  104.   and Stack Pointer registers, the BIOS top of memory pointer is
  105.   modified to allow 3 Kilobytes of space above available memory.  The
  106.   virus code is then read from the disk by reference to the partition
  107.   end address and using the BIOS INT 13H service.  Processing then
  108.   transfers into the Hi-Mem copy of the code and continues by loading
  109.   the "clean" copy of the MBR into the boot area at 7C00H.  The
  110.   attached video facilities are then checked using BIOS INT 10H and if
  111.   EGA/VGA capabilities are found the system date is checked to find
  112.   the day number.  If the date is the second of any month, then the
  113.   inhibit flag is cleared and a further 4 Kilobytes of high memory are
  114.   allocated.  This area is then filled with a bit-reversion copy of
  115.   the EGA character set and the appropriate access pointers are
  116.   prepared.  If the video adapter or the date fail the checks then
  117.   these routines are not executed and the inhibit flag is set before
  118.   processing jumps to the final installation stage.  This involves
  119.   hooking in interrupt handling routines for INT 1CH, INT 21H and INT
  120.   9FH.  The INT 21H vector is uninitialised at cold boot time but the
  121.   intention at this stage is to insert the virus's handler address and
  122.   collect the existing contents for comparison within the INT 1CH
  123.   (Clock Tick) handler.  The INT 9FH vector is a user defined
  124.   interrupt and the handler is not used by the virus code, this will
  125.   be discussed later.  Boot processing is then transferred to the
  126.   "clean" MBR at 7C00H.  All of the boot sector viruses that I have
  127.   examined so far gain processing time by hooking their own handler
  128.   into the BIOS services (usually INT 13H - disk access) since DOS
  129.   services.  This virus hooks into DOS services even though they do
  130.   not exist at boot time. It uses the INT 1CH service to gain initial
  131.   processing time and thereafter swaps its attentions once the system
  132.   INT 21H service is detected as having been installed.
  133.  
  134.   One of the most worrying aspects of this virus is its use of an
  135.   interrupt "strip" mechanism which can examine the relevant chain of
  136.   vectors and select out all those installed after the system has
  137.   loaded.  This stripping process makes use of the DOS single step
  138.   interrupt facility whereby execution of the routine pointed to by
  139.   the INT 01 vector is forced by the hardware after EVERY program
  140.   instruction if a particular flag (the TRAP flag) is set.  Thus
  141.   throughout the chain of probably several thousand instructions
  142.   within an interrupt service, the single step handling routine can
  143.   examine the state of the processor registers (particularly the code
  144.   segment register via the return address on the stack) on a
  145.   continuous basis.  This facility is used to telling effect in this
  146.   case by allowing the virus code to use unmonitored services and
  147.   thereby gain access to the system "underneath" any resident
  148.   anti-virus software.  The extreme reduction in speed that would
  149.   result from the execution of all these extra system calls is avoided
  150.   by having the single step routine turn itself off once the original
  151.   system service vector has been located.  It is not difficult to
  152.   produce resident anti-virus software which is immune to this sort of
  153.   subversion but I suspect that there are few, if any, packages which
  154.   currently do this.
  155.  
  156.   Another disturbing feature of this particular virus is its targeting
  157.   of a specific section of the COMMAND.COM file in the following
  158.   manner :-
  159.  
  160.   During the boot infection process a flag is set and then cleared to
  161.   indicate the correct completion of the virus write routine.  If this
  162.   flag is not cleared, the virus still continues to function but now
  163.   includes an extra routine which checks the contents of the target
  164.   file for a highly individual pattern.  If this pattern is found, at
  165.   the point in the file where it occurs, two bytes are inserted which
  166.   will become an INT 9FH instruction when the file code is executed.
  167.   INT 9FH is one of the interrupt vectors provided by DOS for user
  168.   definition and in this case the virus will already have installed
  169.   and activated such a routine.  The insertion of these two bytes is
  170.   in addition to the subsequent execution of the normal parasitic
  171.   infection routine.  The INT 9FH routine, executed when the affected
  172.   file runs, accesses the program's code and data areas by looking
  173.   back along the stack.  Various changes are made including the
  174.   testing of a data item for the value 1FH - which happens to be the
  175.   file time infection marker used by this virus.  Other data is
  176.   modified by having the length of the virus subtracted from it.  This
  177.   effectively causes DOS (via COMMAND.COM) to report the wrong file
  178.   length whenever an infected file is accessed.
  179.  
  180.   The search routine is as follows:-
  181.  
  182.   SEARCH:  CMP WORD PTR [DI],168BH JNE NOTFOUND CMP WORD PTR [DI +
  183.   4],1689H JNE NOTFOUND CMP WORD PTR [DI + 8],168BH JNE NOTFOUND CMP
  184.   WORD PTR [DI + 0CH],1689H JNE NOTFOUND ........  ........  ........
  185.   ........  NOTFOUND:  INC DI CMP DI,SI JB SEARCH
  186.  
  187.   This is started after the program has been loaded into a buffer and
  188.   with SI containing the full length of the program and DI containing
  189.   zero.  This pattern is consistent with a program listing as follows
  190.   :-
  191.  
  192.          MOV       DX,[Dat1]
  193.          MOV       BX,[BX + DI]
  194.          DB        ?,?
  195.          MOV       DX,[Dat2]
  196.          MOV       BX,[BX + DI]
  197.  
  198.   where the two memory locations Dat1 and Dat2 are unknown and the two
  199.   bytes noted with question marks are also unknown.
  200.  
  201.   Summing up the various properties of this virus: both COM and EXE
  202.   files are infected.  Running an infected EXE file will install the
  203.   virus into memory and attempt to write the MBR (boot) infection to
  204.   the first hard disk.  No trigger will occur even if the date and
  205.   time are correct, since the system date is only checked during the
  206.   infected boot process.  Thus only machines with a battery clock (as
  207.   well as EGA/VGA facilities) will be able to display the trigger
  208.   effect.  The installed virus however IS capable of infecting other
  209.   files.
  210.  
  211.   Booting a machine with an infected fixed disk will install the virus
  212.   and will display the trigger effect between 16:00 and 16:59 on the
  213.   2nd of every month.  The virus code installed via the boot routine
  214.   is exactly the same as that introduced by EXE parasitic action and
  215.   the boot infection only infects the first hard drive.  This means
  216.   that although this virus has composite features, it can only spread
  217.   from machine to machine via infected files.  The infected MBR
  218.   contains the first 66 bytes of the virus code in unencrypted form
  219.   and the following sequence of bytes at offset 2EH into the Master
  220.   Boot Record will identify an infected drive :-
  221.  
  222.    33 DB 33 FF 8E C3 26 29 06 13 04 CD 12 B1 06 D3
  223.  
  224.   The infective length of this virus is 2,343 bytes for both EXE and
  225.   COM files and infected files are marked by having the time field of
  226.   their directory entry set at 1FH (= 62 seconds).
  227.  
  228.   This code represents the first of a new level of viruses which have
  229.   multiple facets of their operation and can target existing
  230.   anti-virus software.  Fortunately it is no more difficult to detect
  231.   than most other viruses and slight modification to resident virus
  232.   monitoring programs will make them immune to the "interrupt
  233.   stripping" technique.
  234.  
  235.   The amount of wasted time which has gone into writing this virus is
  236.   quite phenomenal and the programmer displays considerable experience
  237.   in certain sections of the code.  After disassembling virus code I
  238.   am always tempted to speculate about the author and in this case I
  239.   particularly I wonder if some large organisation has underworked
  240.   programmers who are using company time to write these criminal
  241.   programs.  I also wonder how many large organisations actually check
  242.   just what their programmers are up to. If I discovered ANY
  243.   professional programmer developing virus code I would do my utmost
  244.   to ensure that he never worked on computers again.  This sort of
  245.   irresponsibility MUST be stamped out before irreparable damage is
  246.   done to our industry.
  247.  
  248.   VIS Classification - BfmCcEARKSd2343A
  249.  
  250.   The information contained in this report is the direct result of
  251.   disassembling and analysing a specimen of the virus code.  I take
  252.   great pains to ensure the accuracy of these analyses but I cannot
  253.   accept responsibility for any loss or damage suffered as a result of
  254.   any errors or omissions.  If any errors of fact are noted, please
  255.   let me know at :-
  256.  
  257.     The Virus Information Service,
  258.     Treble Clef House,
  259.     64, Welford Road,
  260.     WIGSTON MAGNA,
  261.     Leicester  LE8 1SL
  262.  
  263.   or call +44 (0)533 883490
  264.  
  265.   Jim Bates
  266.  
  267.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  268.   ++++++++++++++++++++++++++ end of reports ++++++++++++++++++++++++
  269.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  270.