home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / virus / identify.txt < prev    next >
Text File  |  1994-03-07  |  21KB  |  340 lines

  1.     The following document is copyrighted, 1989, by Tim Sankary -
  2. all rights reserved.  It may be copied and distributed freely as long
  3. as no changes are made and as long as this copyright notice remains
  4. with the document
  5.     
  6.     I want to preface this document with a personal statement.  I
  7. am aware that Jim Goodwin has published a partial list of his virus
  8. disassemblies and I can imagine the controversy that will result.  I
  9. do not have an inside track to the "truth" of this Distribute/Don't
  10. Distribute issue, and I can frankly see both sides of the argument.  I
  11. find it hard, however, to censure a colleague who has performed such
  12. excellent and dedicated work as Jim has, and I have to admire his
  13. courage in taking such a controversial step.  For those of you who
  14. anticipate writing or designing Identification and Removal programs
  15. (CVIA Class III programs) for viruses, I hope you will find something
  16. of value in the following study that will be useful.  If you have
  17. access to disassemblies, this document may provide some insights into
  18. designing your own disinfectant.
  19.     I would like to thank "Doc" John McAfee for his guidance and
  20. help in developing this paper, and the Computer Virus Industry
  21. Association for the outstanding visual aids that they contributed.
  22. These figures have been referenced in the paper but I have been unable
  23. to create ASCII representations of them for BBS distribution.  If you
  24. obtained this document from an electronic source and would like a copy
  25. of the figures, they can be obtained by sending a stamped, self
  26. addressed envelope to the CVIA, 4423 Cheeney Street, Santa Clara, CA.
  27. 95054.  - Tim Sankary
  28.         From the Homebase BBS
  29.         408 988 4004
  30.  
  31.  
  32.  
  33.     DEVELOPING VIRUS IDENTIFICATION PRODUCTS
  34.     
  35.  
  36.     In January of 1986, the world's first computer virus was
  37. unleashed upon an unsuspecting and largely defenseless population of
  38. global IBM personal computers users.  The virus originated in Lahore,
  39. Pakistan, and spread rapidly from country to country through Europe
  40. and across to the North American Continent.  In less than twelve
  41. months it had infected nearly a half-million computers and was causing
  42. minor havoc in hundreds of universities, corporations and government
  43. agencies.
  44.     This virus, later dubbed the "Pakistani Brain", caught the
  45. user community unawares and the problems resulting from its many
  46. infections demonstrated how unprepared we were for this phenomenon.
  47. The computer systems targeted by the virus contained no specific
  48. hardware or software elements that could prevent or even slow its
  49. spread, and few utilities could even detect its presence after an
  50. infection occurrence.  Fortunately, the virus was not destructive, and
  51. it limited its infections to floppy diskettes; avoiding hard disks
  52. entirely.
  53.     The first defensive procedure developed to counteract this
  54. virus involved a simple visual inspection of a suspected diskette's
  55. volume serial label.  The virus erased every infected diskette's
  56. volume label and replaced it with the character string - "@BRAIN".
  57. Thus, any inspection of the volume label, such as performing a simple
  58. DIRECTORY command, would indicate the presence or absence of the
  59. virus.  An infected diskette could then be reformatted, or the virus
  60. could be removed by replacing the boot sector.  This manual procedure
  61. is a typical, if somewhat rudimentary, example of the type of
  62. functions performed by a class of antiviral utilities commonly called
  63. Infection Identification products.
  64.     Infection identification products generally employ "passive"
  65. techniques for virus detection.  That is; they work by examining the
  66. virus in its inert state.  This contrasts with active detection
  67. products which look for specific actions employed by a virus.  For
  68. example, looking for a Format instruction within a segment of code on
  69. a disk would be a passive method of detecting a potentially
  70. destructive program.  If we detected the Format attempt during program
  71. execution, however, we would be performing an active detection.
  72. Passive methods concern themselves with the static attributes of
  73. viruses, active methods concern themselves with the results of virus
  74. execution.
  75.     Example active indicators are: the attempted erasure of
  76. critical files, destruction of the FAT table, re-direction of system
  77. interrupt vectors, general slowdown of the system, or an attempt to
  78. modify an executable program.  These indicators are generic; that is,
  79. they are common to a large class of viruses.  Because so many viruses
  80. perform these common activities, however, they are of little use in
  81. identifying individual virus strains.  It is the passive virus
  82. indicators that prove most useful to a positive identification: The
  83. characteristic text imbedded within the virus, specific flags,
  84. singular filenames or a distinctive sequence of instructions that are
  85. unique to the virus.  These and other similar indicators can best be
  86. ascertained by scanning system storage and examining the program files
  87. and other inert data.
  88.     
  89. History
  90.     Virus identification products have their genesis in the
  91. utility programs first developed in 1982 and 1983 to check public
  92. domain software for bombs or trojans before they were executed.  These
  93. utility programs initially checked for questionable instructions in
  94. the suspect program's object code.  Direct input/output instructions,
  95. interrupt calls, format sequences and like instructions, if found,
  96. were flagged and the user was notified.  Later versions included tests
  97. for imbedded data strings that were typically used by trojan
  98. designers.  Suspect programs were scanned for profanity, for keywords
  99. like "gotcha" or "sucker", and for data strings that had been found in
  100. specific trojan programs.  Some programs looked also for specific
  101. names of files that were frequently used by trojans and bombs.
  102.     These products, however, were seldom able to identify a
  103. specific bomb or trojan.  Rather, they indicated that the suspect
  104. program contained instructions or messages of a questionable nature -
  105. implying that the program might be a generic trojan.  This, however,
  106. is not sufficient for dealing with viruses.
  107.     Viruses create entirely different problems than bombs or
  108. trojans.  Viruses replicate, and can infect hundreds or even thousands
  109. of programs within an installation.  They remain invisible for long
  110. periods of time before they activate and cause damage.  And, they are
  111. difficult to remove because they imbed themselves within critical
  112. segments of the system.  It is not sufficient to know that a virus is
  113. present, it is necessary to know which virus is present.  We must know
  114. how it infects, what actions it takes, and, most importantly, what
  115. must be done to de-activate and remove the virus.
  116.     Thus, when the first virus identification products emerged in
  117. 1986 they didn't just look for generic code or messages, they looked
  118. for specific indications that could identify the individual virus
  119. strain.  This allowed the user to verify a specific infection
  120. occurrence and take appropriate action.  Later versions of these
  121. products went a step further.  They actually removed the virus when an
  122. infection was identified.
  123.       
  124. Techniques
  125.     Before we discuss the techniques used by identification
  126. products, we need to look briefly at how viruses insert themselves
  127. into programs.  As shown in Figure 1, viruses actually modify the
  128. structure of the programs that they infect.  Generally, the virus
  129. replaces the program's start-up segment with a routine that passes
  130. control to the main body of the virus.  This main body code may be
  131. inserted within the program in a buffer area, or it may be added to
  132. the beginning or the end of the program.  After execution of the
  133. virus, the program's original start-up sequence is replaced and
  134. control is passed to the program.
  135.     When removing a virus from an infected program, it is crucial
  136. to determine exactly how the virus modified the program.  Each virus
  137. differs from other viruses in size, segmentation and technique.  Each
  138. virus chooses a different area for infection, stores the start-up
  139. sequence in a different location. and return control in a different
  140. manner.  We must know exactly what the virus did during the infection
  141. process in order to reverse the steps for removal.
  142.     Thus, it should be clear that in order to develop an antidote
  143. for a specific virus, we must first obtain a copy of the virus for
  144. analysis.  A thorough analysis of the structure and design of the
  145. virus will provide the answers to all of the above questions.
  146.     When a virus has been disassembled and analyzed, we in theory
  147. know all there is to know about the virus.  We are then able to create
  148. an "attribute file" for the virus.  This file contains all of
  149. characteristics of the virus that can be uniquely assigned to the
  150. virus.  For example, we may find imbedded data within the virus that
  151. we would not reasonably expect to find in any other program or data
  152. file.  Or we may find an instruction sequence that is sufficiently
  153. unusual that we would not expect any other program to use the exact
  154. same sequence.  Figure 2 shows two virus examples that contain unique
  155. imbedded data.     In the Pakistani Brain example, it is clear that we
  156. would not expect to find the exact same name, address and telephone
  157. number in any other program.
  158.     In addition to "identification" attributes, the attribute file
  159. contains all information necessary to reverse the virus infection
  160. process.  Common elements of an attribute file might be:
  161.         - Executable code signatures
  162.         - Volume label flags
  163.         - Hidden file names
  164.         - Absolute sector address contents
  165.         - Key data at specific file offsets
  166.         - Specific interrupt vector modifications
  167.         - ASCII data content
  168.         - Specific increases in bad sector counts
  169.     When the attribute file has been created, it is inputted into
  170. a program that scans all of the appropriate areas of system storage
  171. looking for combinations of the attributes.  As more attributes are
  172. discovered, the degree of assurance that the virus is present
  173. increases.  For example, the character string "sUMsDOS" is common to
  174. all versions of the Israeli virus.  It is conceivable, however, that
  175. the same string could appear randomly in any text file.  Therefore,
  176. the identification program will look for verification attributes, such
  177. as the file offset where the character string was located, or a
  178. sequence of instructions following the data.
  179.     When the virus has been identified, the removal phase begins.
  180. Since the infection attributes of the virus are known, the removal
  181. process is fairly straightforward.  Usually it involves locating the
  182. main body of the virus and all segments of the original program that
  183. had been re-located by the virus.  The virus is erased, and the
  184. program is then re-constructed.
  185.     Clearly, multiple attribute files can be used by a single
  186. program.  Thus, single identification products are able to identify
  187. multiple strains of viruses (see Figure 3).
  188.  
  189. Product Advantages
  190.     Infection identification products have a major advantage over
  191. other types of virus protection products: They are able to determine
  192. whether or not a system is already infected.  This is a serious
  193. concern in many organizations.  Other classes of virus protection
  194. products must assume that a given system is uninfected at the time the
  195. products are installed.  They log the state of the system at the time
  196. they are installed and periodically compare the current state to the
  197. original state.  If a virus has infected the system in the interim,
  198. the change will be detected.  If a virus has already infected the
  199. system before such products are installed, however, the virus will be
  200. logged as part of the original system, and no change will be detected.
  201.     Infection identification products, on the other hand, are
  202. specifically designed to look for and identify pre-existing
  203. infections.  This ability to identify an existing infection is in many
  204. cases crucial to the success of implementing antiviral measures.
  205. Since a virus may remain dormant for months or even years before it
  206. activates and damages the system, pre-existing infections could cause
  207. widespread destruction in spite of our best efforts at implementing
  208. protection programs.
  209.     Automatic removal is the second advantage of identification
  210. products.  Virus infections can sometimes involve hundreds or
  211. thousands of programs within an organization.  When the virus is
  212. discovered, the task of tracking down and disinfecting all of the
  213. infected programs can become monumental.  In many cases, multiple
  214. versions of a single program may be infected, or the original source
  215. diskettes may have been lost or misplaced.  In some cases, infected
  216. programs may be overlooked or incorrectly replaced, so that re-
  217. infection becomes a problem.  These and other issues invariably cause
  218. problems.  The identification products, however, automatically find,
  219. identify and remove the infection, normally at a rate of a few seconds
  220. per infected program.  The time savings alone can be enormous.
  221.     A third advantage to identification programs is that they
  222. cannot be circumvented by a known virus.  Other types of products that
  223. use active methods for infection prevention or detection can be
  224. specifically targeted by viruses.  The virus can seek out and destroy
  225. or disable the active element of such products.  For example, if the
  226. product is a filter type product that monitors all system I/O, the
  227. virus can steal the interrupts from the monitor and thus bypass the
  228. program's checking function.  Likewise, if a protection program uses a
  229. checksum or other method to look for change within a program, the
  230. virus can modify the program's checksum routine so that the change
  231. caused by an infection will not be detected.  These and other
  232. techniques have been used by many viruses to avoid interference by
  233. antiviral programs that use active detection methods.
  234.     Identification products, on the other hand, cannot be so
  235. easily circumvented.  Since these products use passive techniques, the
  236. virus has no control over the products' functions.  Keep in mind that
  237. the virus and its resultant system modifications are merely a sequence
  238. of inert bits as far as the identification product is concerned.  Also
  239. the virus is not active at the time the product is being used (all
  240. such products come with their own boot diskettes, and they run
  241. stand-alone).  Thus, the virus can in no way affect the product's
  242. operation, or even be aware of its presence.
  243.     
  244. Problem areas
  245.     There are some drawbacks to identification products however.
  246. The first problem is that these products only work for known viruses.
  247. That is, a virus that has been around long enough to be noticed,
  248. isolated, sampled, disassembled and analyzed.  This may take a
  249. considerable time if the virus is unobtrusive and slow to activate.
  250. When the virus has been discovered and analyzed, the identification
  251. product must be designed, implemented, packaged, marketed and
  252. distributed - a process that could take considerably more time.  Thus
  253. identification utilities will lag new virus developments by months, or
  254. in some cases, even years.  This time lag implies that there will
  255. always be new viruses, and thus new dangers, against which no
  256. identification utility will be effective.
  257.     The second problem with these products is more thorny, and
  258. requires a high level of product sophistication in order to resolve.  At
  259. issue is a phenomenon that might be called the Uncertainty Factor, and
  260. it is caused by the increasing tendency of hackers to collect existing
  261. viruses, modify them and return them to the public domain.  These
  262. modifications sometimes cause viruses to react differently from the ways
  263. in which they were originally designed, yet they may leave key
  264. identification attributes unchanged.
  265.     For example, the Jerusalem virus was originally designed to slow
  266. down the infected machine's processor one-half hour after an infected
  267. program was executed.  This slowdown was a nuisance to the user of the
  268. infected machine, but it severely limited the spread of the virus,
  269. because the virus made itself known early in the infection process and
  270. had limited time to replicate before being removed.  In the summer of
  271. 1988, an unknown hacker modified the virus by changing just one
  272. instruction (see Figure 4).  This modification disabled the routine that
  273. caused the system to slowdown, and as a result, the virus became many
  274. times more infectious.
  275.     Modifications like this, and other more substantial
  276. modifications, are made almost daily to existing viruses.  The danger
  277. that these modifications pose to identification products is substantial.
  278. If an identification product is attempting to remove a virus that has
  279. infected a program differently than the way in which the product
  280. expects, then the results of the disinfection will be unpredictable.
  281. Damage to the system may result, the program may be destroyed or, in the
  282. worst case, the virus will still be active even though the product
  283. thinks it has removed it.
  284.     In order to minimize the risks posed by this problem,
  285. identification products must be designed to cross reference as many
  286. virus attributes as possible prior to attempting removal.  If any one of
  287. the expected attributes has been changed, or is missing, the product
  288. should notify the user of the potential problem and manual intervention
  289. will be required.
  290.  
  291. Future Prospects
  292.     Identification products clearly must play a major role in the
  293. battle against computer viruses.  As viruses become more widespread and
  294. as infections become more common, the need for utilities able to
  295. identify and help remove viruses will become apparent.  It is probable
  296. that these products will become the dominant form of virus protection in
  297. the future.  A few technical advances, however would greatly aid their
  298. general acceptance.
  299.     One of the problems facing identification products is the time
  300. required to fully scan attached storage devices when searching for a
  301. virus.  For example, as many as ten or more minutes can be required to
  302. fully scan a 40 megabyte drive while looking for just one virus.
  303. Multiple virus checks require more time.  Because of this, it is
  304. impractical to perform frequent scans of the system.  This is
  305. unfortunate because it would be advantageous to perform a complete
  306. identification check of a system each time the system was booted.  This
  307. would provide a high degree of system security, assuming that the
  308. identification product was kept up to date.  More sophisticated
  309. algorithms for searching attached storage and creative techniques for
  310. multiple virus scans could alleviate the time scan problem.
  311.     A second desirable advance in the technology of these products
  312. would be the development of techniques that could identify variations of
  313. known viruses and still provide the capability to remove the modified
  314. virus.  This advance would remove a major limitation of the current
  315. products and would greatly increase their reliability.  Techniques for
  316. removing variations have already been developed for a few root viruses,
  317. but there currently exists no generic technique that is effective for a
  318. large class of viruses.  I anticipate that this hurdle will be overcome
  319. within a year or two.
  320.     A final enhancement would be the ability to fully or partially
  321. re- structure data that has been corrupted by a virus after it has
  322. activated.  Currently, infection identification products are only useful
  323. if they are used before a virus begins its destructive phase.  When the
  324. destructive phase begins, the virus may destroy critical control tables,
  325. data files, programs or even itself.  At this point all current virus
  326. products have limited usefulness.
  327.     It is possible in some cases, however, to reverse much of the
  328. destruction caused by a virus provided: 1) We know the details of the
  329. destruction process, and 2) The destructive phase has not gone on too
  330. long.  For example, one of the common PC viruses scrambles the File
  331. Allocation Table by reversing a number of the entries.  Since we know
  332. the exact way in which the virus scrambles the information, we can
  333. easily unscramble it.  However, after a few days of data scrambling, the
  334. virus initiates a low level format of the hard disk.  At this point, no
  335. recovery is possible.
  336.     I anticipate that future products will incorporate recovery
  337. capabilities for a large number of virus destructive acts.  This
  338. capability, and others described above, should provide the best virus
  339. protection that we can hope to achieve.
  340.