home *** CD-ROM | disk | FTP | other *** search
/ Hacks & Cracks / Hacks_and_Cracks.iso / hackersguides-&-software / 40hex-10.zip / 40HEX-10.007 < prev    next >
Text File  |  1993-03-13  |  6KB  |  84 lines

  1. 40Hex Issue 10 Volume 3 Number 1                                      File 007
  2.  
  3. A Case Against Simple Encryption And For Polymorphism
  4. ~ ~~~~ ~~~~~~~ ~~~~~~ ~~~~~~~~~~ ~~~ ~~~ ~~~~~~~~~~~~
  5.  
  6.      In a well-crafted virus, every line of code should serve a definite
  7. purpose.  No byte should be wasted.  Is encryption, long used by virus
  8. programmers, still a viable method of eluding scanners and, if not, is
  9. encryption any longer a necessary part of a virus?
  10.      The type of encryption found in the typical virus is a simple XOR loop or
  11. another similar type of operation, i.e. rotate, add, etc.  The idea behind
  12. encryption was to change the virus during each iteration so that scanners would
  13. not be able to detect it.  However, such simple encryption hardly serves this
  14. job, as most scanners simply scan for a pattern found in the encryption.  Only
  15. a handful delve deeper than the decryption routine.  So the sole purpose of
  16. simple encryption such as that seen in most viruses nowadays seems to be to
  17. hide text strings from archaic text searching programs (remember those virus
  18. books that touted CHK4BOMB as the best thing since rotten Jello?).  But is it
  19. worth including encryption solely for this purpose?  I think not.  Few people
  20. search files for unusual text strings and the extra code needed to encrypt a
  21. file for this purpose may hardly be justified to overcome this obstacle.
  22.      As mentioned previously, waste should be frowned upon in viruses.
  23. Unquestionably, the ultimate goal of a virus is to avoid detection while
  24. spreading to the greatest number of hosts.  It has been established that simple
  25. decryption patterns do not aid a virus in avoiding detection from scanners.
  26. And encryption is certainly not a vital part of the replication process.  Thus
  27. simple attempts at encryption do not add anything of value to the virus.
  28.      Yet these weak encryption routines _are occasionally_ necessary, but only
  29. as stepping stones for fledgling virus programmers entering the realm of
  30. polymorphism.  Without a few simple encryption routines and knowledge of their
  31. use under his belt, a virus programmer would be hard-pressed to create a truly
  32. polymorphic virus.  Therefore, it should be noted that simple encryption should
  33. be used only as part of the learning process.  However, remember also that such
  34. encryption pales in the face of modern virus scanners and polymorphism is a far
  35. better alternative.
  36.      Polymorphism is perhaps the best technique modern viruses use to avoid
  37. scanners.  The other alternative, stealth techniques, is limited in utility and
  38. is rendered helpless in the face of simple memory scans.  A combination of the
  39. two is desirable, yet it is not always possible to implement both in a virus of
  40. limited size.  So let us examine polymorphism.
  41.      Polymorphism, in its simplest form, merely consists of a fixed-length
  42. decryptor with a few bytes which may be altered during each infection.  This is
  43. merely a small step up from the simple encryption routine.  A few extra XOR
  44. statements in the code are all that is necessary for implementing such a
  45. routine.  However, this is, once again, only a small step up; most such fixed-
  46. length decryptors may be detected by a couple scan strings with wildcards.
  47. More powerful polymorphism is necessary for evasion of scanners.
  48.      The MtE and the recently introduced TPE are both powerful products which
  49. allow every virus to include polymorphism.  However, it is important to note
  50. that viruses utilising such products may be detected by existing scanners.
  51. Therefore, it is desirable to write a new polymorphic routine from scratch.
  52. This will allow for longer survival of the virus.
  53.      The chief problem with good polymorphism is that the virus should be able
  54. to detect existing infections of itself in files.  Otherwise, the virus could
  55. grow beyond limit and much disk space would be taken up in redundant
  56. infections.  Two methods are commonly used; the infection marker byte and the
  57. time stamp.  However, such a check is inherently limiting as the virus scanner
  58. is then able to use said check to its advantage; it need not check files, for
  59. example, save those which have the seconds field set to eight.  Then again, a
  60. scanner which functions in this manner would be helpless in detecting another
  61. virus utilising the identical polymorphic routine but with a different
  62. infection stamp.
  63.      The second major difficulty with good polymorphic routines is simply the
  64. size.  MtE, for example, adds over 2,000 bytes of code.  A working, albeit
  65. limited, polymorphic routine is possible in half this size, yet it would still
  66. be 1,000 bytes, a size larger than most viruses.  Increased size, of course,
  67. increases the disk access time.  While generally irrelevant in a harddisk-based
  68. environment, this increased infection time becomes crucial when infecting files
  69. on floppy diskettes.  There are precious few ways of alleviating this problem;
  70. the only real solution is to decrease the functionality of the polymorphic
  71. routine and thereby compromise its worth.
  72.      Taken as a whole, the advantages in utilising polymorphic routines should
  73. outweigh the disadvantages.  The increased difficulty of scanning may allow the
  74. virus to slip through the cracks even after a virus scanner claims to detect it
  75. reliably.  Take, for example, MtE.  To this day, many virus scanners fail to
  76. accurately report MtE infections; some still trigger false positives.  To
  77. reiterate a previous point - simple decryption routines are worthless, as they
  78. fail to serve their main purpose of aiding in the evasion of scanners.  Even
  79. simple polymorphic routines are easily defeated by scanners; true polymorphism
  80. or no encryption at all are only alternatives.
  81.  
  82.                                         Dark Angel
  83.                                         Phalcon/Skism 1993
  84.