home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / VIRUS / PCV4RPT.ZIP / NUMBER.RPT < prev    next >
Encoding:
Text File  |  1991-05-28  |  23.7 KB  |  415 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.   Vesselin Bontchev reported in May 1990
  11.  
  12.   The Number of the Beast.
  13.   ========================
  14.  
  15.   - Three new versions of this virus have appeared. None of them
  16.   contains the "666" string any more. I have difficulties to tell the
  17.   exact order in which these versions were created.  In all of them
  18.   the virus writer has tried to stick more code - but the place is
  19.   *really* too small. In one of them he abandoned the DOS version
  20.   check; in another there is no error checking.  I call these versions
  21.   V512-B, V512-C and V512-D respectively.  The bad news is that John
  22.   McAfee's program SCAN in no longer able to find them.  I do not
  23.   think that this effect is achieved intentionally, maybe John just
  24.   picked a bad search string.
  25.  
  26.   - In these mutations some of the earlier design bugs in the virus
  27.   were improved. For instance, all of them are able to extract
  28.   correctly the name of the command interpreter on boot time - even if
  29.   it is not in the root directory. Also, the infected program don't
  30.   always exit at DOS prompt when run on a clear system.  The virus
  31.   saves the first one (or two, this depends of the concrete mutation)
  32.   byte of the original file in its own body.  Then, when the infected
  33.   file is executed, the virus reads the first byte after the end of
  34.   file and compares it with the saved one.  If these bytes match, the
  35.   virus tries read the original 512 bytes and to execute the file.  If
  36.   they don't, the file is considered as damaged and the virus
  37.   terminates the program (and exits at DOS prompt).
  38.  
  39.   - This virus contains a bug I didn't mentioned in my description.
  40.   This is a design bug, not a programmer's one.  The problem is that
  41.   the virus is not always able to check successfully if it is already
  42.   present in memory. It compares the program, which has intercepted
  43.   the INT 21h vector with its own body.  However it does not try to be
  44.   the first program on this vector - like the Dark Avenger virus does.
  45.   Now suppose that your COMMAND.COM is infected and that you have a
  46.   lot of TSR programs in your AUTOEXEC.BAT file, all of which
  47.   intercept INT 21h.  Of course, each of them will become infected.
  48.   However each of them will cause a new copy of the virus to be loaded
  49.   also - since the first program has intercepted INT 21h and the virus
  50.   in the next program will not be able to find that it is already
  51.   present in memory.  Since every copy of the virus will occupy a DOS
  52.   I/O buffer, the operating system will run out of buffers soon.  This
  53.   will lead to bad performance and system crashes.
  54.  
  55.  
  56. ======= Computer Virus Catalog 1.2: "512" Virus (5-June-1990) ========
  57. Entry...............: "512" Virus
  58. Alias(es)...........: ---
  59. Virus Strain........: ---
  60. Virus detected when.: January 1990
  61.               where.: Bulgaria
  62. Classification......: COM overwriting/extending/resident.
  63. Length of Virus.....: 512 bytes
  64. -------------------- Preconditions -----------------------------------
  65. Operating System(s).: PC/MS-DOS
  66. Version/Release.....:
  67. Computer model(s)...: IBM PC/XT/AT/PS and compatibles
  68. -------------------- Attributes --------------------------------------
  69. Easy Identification.: "666" at offset 509.
  70. Type of infection...: Executable file infection:
  71.                       Overwriting/extending; resident; first 512 bytes
  72.                       placed at free space on last cluster of file,
  73.                       and replaced with the virus code.
  74.  
  75.                       System infection: RAM-Resident, uses disk buffer
  76.                       space for code in order not to take-up memory.
  77.  
  78. Infection Trigger...: Any close file (INT 21, Service 3e) or Execute
  79.                       (INT 21, Service 4b) on a .COM file.
  80. Storage media affected: Any Drive
  81. Interrupts hooked...: Int 21 DOS-services
  82.                       Int 13 and Int 24 while infecting.
  83. Damage..............: ---
  84. Damage Trigger......: ---
  85. Particularities.....: If virus is in memory, files are read as unin-
  86.                       fected. Directory never shows size increase,
  87.                       even if the virus is not in memory.  Under DOS
  88.                       3.3, software write protections are bypassed.
  89.  
  90. Similarities........: ---
  91. -------------------- Agents ------------------------------------------
  92. Countermeasures.....: Monitoring the INT 21 vector.
  93. Countermeasures successful: ---
  94. Standard means......: A Do-it-yourself way: Infect system by running
  95.                       an infected file, ARC/ZIP/LHARC/ZOO all infected
  96.                       COM and EXE files, boot from uninfected floppy,
  97.                       and UNARC/UNZIP/LHARC E etc.  all files.  Pay
  98.                       special attention to disinfection of
  99.                       COMMAND.COM.
  100.  
  101. -------------------- Acknowledgement ---------------------------------
  102. Location............: Weizmann Institute Of Science, Rehovot, Israel
  103. Classification by...: Ori Berger
  104. Documentation by....: Yuval Tal (NYYUVAL@WEIZMANN.BITNET), Ori Berger
  105. Date................: 6-March-1990
  106. Information Source..: ---
  107.  
  108.               +++++++ more ++++++
  109.  
  110.  
  111.   Report from Jim Bates - The Virus Information Service - April 1990
  112.  
  113.   === The 666 Virus (aka Number of the Beast) ===
  114.  
  115.   The '666' virus (also known as 'V512' & 'Number of the Beast') is
  116.   one of the so-called 'Bulgarian 50' group of viruses and although it
  117.   has no trigger routine there are several interesting features which
  118.   make the code worthy of study and analysis.  A trigger routine would
  119.   be somewhat complicated to add to the code because of the size
  120.   limitations and this leads me to suspect that this virus is an
  121.   attempt to prove how clever the programmer is rather than a serious
  122.   attempt at malignant code.  The virus is a parasitic type which
  123.   becomes resident in the system when the code is executed. It infects
  124.   only files which have the letters 'CO' as the first two letters of
  125.   the file extension.  This is obviously targeting .COM files but it
  126.   may also include COBOL source files which conventionally have an
  127.   extension of .COB as well as other files with names matching this
  128.   specification.  The other criteria for infection are that the file
  129.   must have a length between 512 bytes and 65,023 bytes (inclusive)
  130.   and, most important of all, the file length must be such that there
  131.   is at least one free sector of space between the end of the file and
  132.   the end of the last allocated cluster.
  133.  
  134.   This last requirement highlights one of the weak areas in the MS-DOS
  135.   file storage system which virus researchers have long been aware of.
  136.   The disk space allocation system within MS-DOS works by allocating
  137.   space in predetermined chunks called 'clusters'.  The size of a
  138.   cluster is set when the drive is first formatted and on most systems
  139.   with more than around 10Mbytes of overall disk space the cluster
  140.   size is set to 4 sectors (or 2048 bytes). Since file sizes are
  141.   rarely an exact multiple of clusters in length, there will usually
  142.   be a certain amount of unused space beyond the end of the file but
  143.   still allocated to it.  For example: the COMMAND.COM file on my DOS
  144.   3.30 system is 25,307 bytes long.  This represents slightly over 12
  145.   clusters of disk space so DOS will have allocated 13 clusters.
  146.   Therefore, the allocated space equals 26,624 bytes (13 x 2048) while
  147.   the space actually used by the file is 25,307 bytes.  The difference
  148.   in this case is 1,314 bytes which represents something over 2
  149.   sectors and therefore this particular COMMAND.COM could be infected
  150.   by the 666 virus.   There are some problems associated with using
  151.   this space which I'll come to later but the big advantages are that
  152.   : a) DOS will not overwrite it and :  b) it is considered 'lost' to
  153.   all DOS operations unless special provision is made to access it.
  154.   It is thus an ideal place to 'hide' virus code so that scanning
  155.   programs cannot find it.  Of course, some method must still be used
  156.   to ensure that such code is loaded and presented to the processor
  157.   for execution.  Although there are several ways of doing this, the
  158.   V512 virus uses one of the more interesting ones which also attempts
  159.   to fool both resident and scanning software into 'thinking' that
  160.   nothing is amiss with the host file.  It should go without saying
  161.   that there will be some files which do not have sufficient unused
  162.   space within the final cluster.  However, this virus does check for
  163.   that eventuality and will not attempt to infect such files.
  164.  
  165.   The virus is 509 bytes long and appears to have been padded with a
  166.   three byte 'signature' consisting of the characters '666' (giving
  167.   rise to its alternative names) to bring the size up to 512 bytes
  168.   (exactly one sector).  It is positioned on the disk to overwrite the
  169.   first sector of the host file.  The original contents of that first
  170.   sector are written beyond the end of the file in the free space just
  171.   discussed.  So, taking events in their proper sequence, I will start
  172.   by describing the actual installation of the virus code when it is
  173.   first executed.
  174.  
  175.   INSTALLATION
  176.   The code starts by determining the DOS version of the current
  177.   operating system and then collects the INT13H vector from page zero
  178.   of memory.  The DOS version is then checked and if the minor part
  179.   (after the decimal point) of the version number is .30 then a little
  180.   known (and undocumented) DOS function is called which swaps out the
  181.   original (ie: pre-system load) INT13H entry point (this usually
  182.   points to the ROM INT13H routine).  The swapped out address is
  183.   pushed onto the stack and the function is called again to swap the
  184.   vectors back again.  This restores normal system operation at that
  185.   point but leaves the required address on the stack.  This address is
  186.   popped from the stack to take the place of the INT13H vector
  187.   collected from page zero.  If the minor DOS version is NOT .30 then
  188.   the swapping function is not used and processing continues with the
  189.   page zero DOS INT13H vector.  The importance of the swapping process
  190.   can be appreciated since it recovers an entry point into the disk
  191.   I/O services which is not usually monitored by anti-virus software.
  192.   It should be noted however, that it IS possible to hook monitoring
  193.   software into this function and it is also possible to monitor the
  194.   swap function itself and thus intercept this particular virus
  195.   installation routine.  Installation then continues by storing the
  196.   relevant INT13H vector within the virus' code segment and then
  197.   collecting the INT21H vector - again by direct access to page zero
  198.   of RAM.  The offset portion of the INT21H vector is checked for a
  199.   value of 121H and if this is found, the indicated segment is checked
  200.   for the presence of the virus.  Obviously if the virus is already
  201.   resident, processing branches to the portion of the code which is
  202.   processed AFTER the virus has been made resident.  If the virus code
  203.   is NOT resident, the code locates the address of the first Disk I/O
  204.   buffer which DOS uses.  These buffers are exactly 512 bytes long and
  205.   usually have around 16 bytes as a header so there is more than
  206.   enough space for this virus code to be installed in one.  Once the
  207.   whole virus has been moved into the buffer, its address is removed
  208.   from the Disk I/O chain and the INT21H vector is modified to point
  209.   to the interception routine within the newly re-located virus code.
  210.   The code then overwrites a small section of the transient portion of
  211.   the command interpreter.  This is to ensure that when the program
  212.   terminates, COMMAND.COM will be reloaded and, as will be seen,
  213.   infected.  In this way, this virus actually attempts to infect
  214.   COMMAND.COM the very first time it is executed.  The code then goes
  215.   on to check whether the current program is a command process (ie:
  216.   COMMAND.COM itself) or is running as a child of DOS.  If it IS a
  217.   command process, then processing terminates back to DOS and since
  218.   the virus code is now resident, the reloading of COMMAND.COM will
  219.   ensure that it is infected as we shall see later.  An interesting
  220.   point here is that when an infected program is run for the first
  221.   time on a clean system (ie:  COMMAND.COM is NOT infected), the host
  222.   program itself will NOT be executed - but run it a second time, and
  223.   it will be!  The second and subsequent times that the program is
  224.   executed, after the 'parent/child' check, the data that was in the
  225.   original first sector is loaded into the appropriate area
  226.   (overwriting the recently loaded copy of the virus) and execution
  227.   then continues with the original program quite normally.  The method
  228.   of accessing beyond the end of the file is another one of the
  229.   interesting parts of this virus since it is achieved by direct
  230.   manipulation of the DOS System File Table (SFT).  This technique is
  231.   used in several places throughout the code and it allows the virus
  232.   to open a file for READ access (thus NOT alarming any resident
  233.   anti-virus monitoring software) and then to change the SFT to allow
  234.   WRITE access. At the same time, the file length and date/time fields
  235.   can also be modified as required.  However, during the execution
  236.   phase of an infected program, only the file length field is
  237.   adjusted; by adding 512 so that the original data can be read from
  238.   the disk.
  239.  
  240.   INTERRUPT INTERCEPTION
  241.   As mentioned, only the INT21H vector is hooked during installation
  242.   and the virus code which intercepts this call allows all function
  243.   requests through except for 3FH (READ), 3EH (CLOSE) and 4B00H (LOAD
  244.   & EXECUTE).
  245.  
  246.   READ FUNCTION
  247.   The READ intercept provides yet another interesting aspect of the
  248.   code in that it attempts to 'hide' the presence of the virus code in
  249.   a way that is reminiscent of the technique used in the BRAIN virus.
  250.   When a READ request is received, the current position of the file
  251.   access pointer is first noted and then the READ is performed
  252.   correctly.  Next the file access pointer is checked to see if the
  253.   read request was for a portion of the file within the first sector.
  254.   If it wasn't, processing is returned to the caller, but if it was,
  255.   the file time stamp field is checked for the existence of 1FH (31
  256.   decimal) in the seconds bits.  This is equivalent to a setting of 62
  257.   seconds and is one of the markers used by the virus to indicate an
  258.   infected file (the other being the presence of the virus code
  259.   itself).  If the file is marked as infected in this way, then the
  260.   SFT is accessed again to modify the file size field and the original
  261.   first sector is read from the last cluster. Then the file size field
  262.   is restored to its former value before processing returns to the
  263.   caller.  Thus the virus has effectively covered its existence by
  264.   supplying the caller with the correct data rather than the virus
  265.   code. This means that simple scanning programs will NOT detect the
  266.   virus code ON AN INFECTED SYSTEM!  This is further evidence of the
  267.   absolute necessity of ensuring that the system is 'clean' before
  268.   starting any tests for the presence of virus code on the disk.
  269.  
  270.   LOAD & EXECUTE and CLOSE FUNCTIONS
  271.   The intercept routine for these two functions is substantially the
  272.   same except that when closing a file, the file handle is first
  273.   duplicated and subsequent operations are carried out on the
  274.   duplicate handle.  Loading a file for execution results in the file
  275.   being opened (in READ mode) for virus operations.  In both cases the
  276.   file handle being used is closed before the original request is
  277.   allowed to continue normally (using the original file handle).  The
  278.   purpose of the interception is to check the file for existing
  279.   infection and if it is not infected, to check its suitability for
  280.   infection by determining how much unused file space there is in the
  281.   final cluster.
  282.  
  283.   INFECTION
  284.   After the routine opens (or duplicates) a file handle for the
  285.   target, the file position pointer is set to zero (Beginning of File)
  286.   and the SFT access privilege field is changed to allow WRITE access.
  287.   Then the vector for INT13H is changed to that collected during the
  288.   Installation phase.  Remember that the virus code will usually have
  289.   collected this vector during the initialisation of the system (ie:
  290.   via an infected COMMAND.COM) or from the undocumented vector swap
  291.   interrupt.  Thus it is unlikely that this vector will be monitored
  292.   by anti-virus software.  The virus does not use INT13H directly but
  293.   INT21H functions associated with file I/O use it and could thereby
  294.   alarm monitoring software.  The infection check routine also
  295.   revectors INT24H (Fatal Error Handler) to point to an IRET
  296.   instruction within the code.  This effectively disables error
  297.   reporting for the duration of this section of the code.  Once these
  298.   two interrupt vectors have been modified, the code continues by
  299.   checking the time stamp field for the 62 second marker.  If this
  300.   marker is not found the file extension is tested to see if it begins
  301.   with 'CO', otherwise the extension check is by-passed.  There seems
  302.   no valid reason for this alternative checking, maybe the programmer
  303.   had other options in mind and simply forgot this sloppy piece of
  304.   coding as the virus developed.  Whatever the reason, the assumption
  305.   is that a file with the 62 second marker set will be a .CO?  file.
  306.   From this point on, if a check fails, the handle is closed and
  307.   processing is return to continue the original INT21H function call.
  308.   The next check ensures that the target file is between 512 and
  309.   65,023 bytes long.  A further test looks at the SYSTEM attribute
  310.   setting of the target file and rejects it if it is set.  The final
  311.   check before examining the file for existing infection involves
  312.   testing the file length against the number of sectors per cluster
  313.   and using this to calculate how much unused space is available in
  314.   the final cluster.  Once the target file has passed all these
  315.   checks, the first 512 bytes of the file are read into a buffer.  The
  316.   virus uses the high part of the Interrupt Vector Table as a buffer,
  317.   thus overwriting all Interrupt vectors above 7FH.  This is the most
  318.   serious mistake within the virus since an increasing number of
  319.   machines, most network software and several high-level languages use
  320.   these interrupts for various purposes and the destruction of the
  321.   vectors will cause system failure and give immediate alarm signals
  322.   that something is amiss.
  323.  
  324.   Once the start of the file has been read, it is checked against the
  325.   existing virus code to see if it is already infected.  If infection
  326.   IS discovered, the time stamp field is set with the 62 second marker
  327.   and the file is closed.  If the file is NOT infected, the contents
  328.   of the buffer are appended to the end of the file and a copy of the
  329.   virus is written to the first sector.  The file size field is
  330.   actually modified during this process but restored afterwards to
  331.   leave the appended code outside the size setting.  The date/time
  332.   field remains substantially unaltered (except for the 62 seconds) as
  333.   a result of direct access to the flags field of the SFT.  These
  334.   actions ensure that the visible directory entry for the file remains
  335.   the same as it was before infection.  Within the infection routine
  336.   there are two calls to Function 40H of Interrupt 21H.  These are
  337.   immediately obvious to monitoring software and can therefore provide
  338.   a useful detection point.
  339.  
  340.   The use of the LOAD & EXECUTE function as a vehicle for file
  341.   infection has become fairly standard amongst virus authors but the
  342.   use of the CLOSE function is of much more concern.  The Dark Avenger
  343.   virus also subverts this function and causes similar concern.  The
  344.   problem centres around the more simple scanning programs because in
  345.   order to examine a file they must open it using the DOS file I/O
  346.   functions.  Once scanning has been completed the file is closed and
  347.   - if a virus of this type is present - becomes infected.  Thus the
  348.   scanning program becomes the agent for infecting every suitable file
  349.   on the disk at one go!  The answer is to restrict the use of
  350.   scanners to a known clean system, ie:  keep the scanning program on
  351.   a write protected system floppy disk and ONLY use it from there.
  352.   The only scanners which should be used on an automatic basis
  353.   (invoked by AUTOEXEC.BAT) are those which collect file information
  354.   on an absolute sector basis and thereby do not use the DOS file I/O
  355.   facilities.  If the method used by the scanner is not known, assume
  356.   that it DOES use DOS file I/O and take appropriate precautions.
  357.  
  358.   Virus programmers are, almost by definition, immature and inadequate
  359.   individuals indulging in the electronic equivalent of graffiti and
  360.   it can be interesting to speculate on the personalities who waste
  361.   their time in such childish activities.  My impressions on
  362.   disassembling this virus are of someone who considers himself a cut
  363.   above other virus writers.  The code makes use of some undocumented
  364.   and obscure features of DOS in a way which almost shouts "See how
  365.   clever I am" and yet ignores such obvious giveaways as the
  366.   overwriting of the Interrupt Vector Table and the plain use of the
  367.   WRITE function 40H of Interrupt 21H.  Other problem areas include
  368.   the method of checking for the virus existence in memory.  This will
  369.   cause multiple installation of the virus code if any subsequent
  370.   program re-vectors INT21H.  There are also difficulties if an
  371.   infected program is copied on an uninfected system.  In this case,
  372.   since most COPY routines work on a byte by byte basis (and not
  373.   cluster by cluster) the infected file will lose the contents of the
  374.   unused space at the end of the file and while the copied file will
  375.   still contain the virus, it will no longer perform its original
  376.   function.  Assuming that a virus should NOT announce its presence by
  377.   destroying its host, this is another serious weakness in the code.
  378.   The final flaw in this type of virus, and the one of most interest
  379.   to technicians wishing to protect their systems, is that the spread
  380.   of infection can be stopped quite simply by ensuring that all files
  381.   occupy an exact number of clusters.  Thus no free space is left and
  382.   the virus will be unable to replicate.
  383.  
  384.   There is a suggestion that this code was developed as a 'LAB' virus,
  385.   intended to test and assist in the development of more effective
  386.   anti-virus software.  This may well be the case but the fact remains
  387.   that it is easily disassembled and contains dangerous techniques
  388.   which could be modified by malicious people to further exacerbate
  389.   the virus threat.  There are enough genuine viruses around without
  390.   irresponsible people developing and distributing new ones.
  391.  
  392.   VIS Classification - CcARSd512A
  393.  
  394.   The information contained in this report is the direct result of
  395.   disassembling and analysing a specimen of the virus code.  I take
  396.   great pains to ensure the accuracy of these analyses but I cannot
  397.   accept responsibility for any loss or damage suffered as a result of
  398.   any errors or omissions.  If any errors of fact are noted, please
  399.   let me know at :-
  400.  
  401.                     The Virus Information Service,
  402.                     Treble Clef House,
  403.                     64, Welford Road,
  404.                     WIGSTON MAGNA,
  405.                     Leicester LE8 1SL
  406.  
  407.   or call +44 (0)533 883490
  408.  
  409.   Jim Bates
  410.  
  411.  
  412.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  413.   ++++++++++++++++++++++++++ end of reports ++++++++++++++++++++++++
  414.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  415.