home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / M.ZIP / MTE091B.ARJ / MTE091B.ZIP / MTE.DOC < prev    next >
Text File  |  1991-08-17  |  10KB  |  253 lines

  1.  
  2. MuTation Engine <tm>
  3.  
  4. Version 0.90ß (17-08-91)
  5. (C) 1991 CrazySoft, Inc.
  6. written by Mad Maniac.
  7.  
  8.  
  9. 1.  License
  10.  
  11. You are free to include this Engine in viruses.  Using it in another ways is
  12. prohibited.  You are free to give it to people that will only use it in this
  13. way.  MuTaion engine is free.
  14.  
  15.  
  16. 2.  How it works
  17.  
  18. Please read the whole document before trying to do something with the Engine.
  19. If you have never written a virus in Assembler, DON'T start with the Engine.
  20. First do this, then return back to the Engine.
  21.  
  22. MuTation Engine is an object module that could be linked to any virus.    It has
  23. been written in Assembler and assembled under Turbo Assembler 2.5.  We recommend
  24. that you use this assembler to compile the viruses that will carry the Engine.
  25. Linking it to an object file produced by other assemblers, or high-level
  26. languages compilers is theoretically possible, but we never tried and do not
  27. recommend it.  We decided NOT to give up the Engine's source code at this time.
  28.  
  29. The Engine will encrypt your code each time with a different encryption key.  It
  30. will also generate a routine to decrypt it, which will also differ each time.
  31. Both the decryption routine and the encrypted code will have variable lengths.
  32. Thus your virus will be hardly detectable.  The Engine's code is about 2KB; we
  33. believe this is not too big.
  34.  
  35.  
  36. 3.  How to use it
  37.  
  38. We assume that you will use Turbo Assembler 2.5 to compile your virus.    Put the
  39. following at the beginning of your source code:
  40.  
  41.     .model    tiny
  42.     .code
  43.  
  44.     extrn    mut_engine: near
  45.  
  46. Then you write your virus as usual.  When you need to encrypt the code, you just
  47. call the Engine.  Put the following instruction in your code:
  48.  
  49.     call    mut_engine
  50.  
  51. You also need to supply the parameters for the Engine.    They are passed in
  52. registers.  Results are also passed in registers.
  53.  
  54. Of course, you must link the MTE.OBJ module to your virus!
  55.  
  56. You can rely on the fact that the Engine will not modify itself while running,
  57. and will not need any data to be preserved between calls (except for RND_BUF,
  58. see below).
  59.  
  60.  
  61. 4. Input parameters
  62.  
  63. All parameters are mandatory.  Description follows:
  64.  
  65.    ES = Work segment
  66.  
  67. The Engine needs work space.  On entry, ES must point to a free segment.  It
  68. will use the first 2048 (MAX_LEN) bytes of it PLUS length of the code that will
  69. be encrypted.  If, for example, your virus will be 3KB in length (including the
  70. Engine!), the work segment must have at least 5120 bytes free.    The segment
  71. needs not to be initialized; it contents will be lost after calling the Engine.
  72.  
  73.    DS:DX => Code to encrypt
  74.  
  75. On entry, just set DS:DX to point to the code you want to be encrypted.
  76.  
  77.    CX = Length of code to encrypt
  78.  
  79. On entry, just set CX to the length of the code you want to be encrypted.
  80.  
  81.    BP = Offset where the decryption routine will be executed
  82.  
  83. The Engine needs to know what will be the value of IP when the decryption
  84. routine will take control.  For example, if your virus infects a COM file, and
  85. adds itself BEFORE it, you must set this value to 100h.
  86.  
  87.    DI = Offset of the code entry point
  88.  
  89. This is the offset where to pass control after the decryption routine has
  90. decrypted the encrypted code.  This is also the start offset for decrypting.
  91. The code before this offset will NOT be decrypted.  Usually, set this value to
  92. 0.
  93.  
  94.    SI = Offset from start address where the encrypted code will be
  95.  
  96. This is the offset where the encrypted code will be taken from (The decrypted
  97. code will be put immediately after the decryption routine).  If you set this
  98. value to 0, the encrypted code is assumed to be immediately after the decryption
  99. routine (this is the normal case).
  100.  
  101.    BL = Decryption routine size (1 = Tiny, 3 = Small, 7 = Medium, 15 = Big)
  102.  
  103. This affects the size and the speed of execution of the decryption routine.
  104. Only the above listed 4 values are allowed (other values will crash the Engine).
  105. Usually, set this to 0fh.
  106.  
  107.    AX = Bit field
  108.  
  109.       Bit 0 = Preserve AX \
  110.       Bit 1 = Preserve CX  \    Set each bit to 1 if you want the value of the
  111.       Bit 2 = Preserve DX   \    corresponding register to be preserved when the
  112.       Bit 3 = Preserve BX    \    decryption routine receives control.  Set it to
  113.       Bit 4 = Preserve SP    /    0 if you don't want it preserved.  Other
  114.       Bit 5 = Preserve BP   /    registers will be preserved in any case.
  115.       Bit 6 = Preserve SI  /
  116.       Bit 7 = Preserve DI /
  117.  
  118.       Bit 8 = Would probably run at different CPU
  119.  
  120. Set this bit to 1 if the decryption routine could run on another computer (this
  121. is the normal case).
  122.  
  123.       Bit 9 = Don't assume CS = DS on execution
  124.  
  125. Set this bit to 1 if you're not sure that DS will point to CS on entry to the
  126. decryption routine (this is the normal case for EXE files).  Otherwise, set it
  127. to 0.
  128.  
  129.       Bit 10 = Don't assume CS = SS on execution
  130.  
  131. Set this bit to 1 if you're not sure that SS will point to CS on entry to the
  132. decryption routine (This is the normal case for EXE files).  Otherwise, set it
  133. to 0.
  134.  
  135.       Bit 11 = Don't align encrypted code onto paragraph boundary
  136.  
  137. Set this bit to 1 if you don't care if the decrypted code is aligned on a
  138. paragraph boundary.  Otherwise, set it to 0.  Note that the value of IP will be
  139. unknown at the time when the decrypted code receives control.
  140.  
  141.  
  142. 5.  Results
  143.  
  144. The Engine returns the following values in registers (all others except for the
  145. listed below will be trashed):
  146.  
  147.    ES = Work segment
  148.  
  149. The ES value is preserved.
  150.  
  151.    DS:DX => Decryption routine + encrypted code
  152.  
  153. DS:DX now points to the decryption routine immediately followed by the encrypted
  154. code.  If SI was set to 0 on entry, the code is ready to be put in a file.  If
  155. not, you must treat separately the first DI and next CX-DI bytes (see below).
  156.  
  157.    CX = Length of the decryption routine + encrypted code
  158.  
  159. CX now has the summary length of both the decryption routine and encrypted code.
  160.  
  161.    AX = Length of the code that was encrypted
  162.  
  163. AX now has the length of the code that will be decrypted at the time when the
  164. decryption routine receives control.  This value may differ from the value that
  165. you passed in CX on entry; but it is not less than it in any case.  It might be
  166. greater with no more than 32 (MAX_ADD_LEN) bytes.  This is because of how the
  167. Engine works.
  168.  
  169.    DI = Offset of decryption routine end
  170.  
  171. This is the length of the decryption routine, and an offset where the encrypted
  172. code starts.  You might need this if SI was not set to 0 on entry.  This value
  173. is not greater than 512 (MAX_ADD) bytes.
  174.  
  175.    SI = Offset of loop start
  176.  
  177. This is an offset in the newly generated decryption routine where the decryption
  178. loop starts.  You might need it if SI was not set to 0 on entry.  If you don't,
  179. just ignore it.
  180.  
  181.  
  182. 6.  Stack usage
  183.  
  184. Before you call the Engine, make sure there is PLENTY of stack space free (256
  185. bytes appear to be enough).  For resident viruses, it is strongly recommended
  186. that you maintain your own stack.  Otherwise the chance is that you will blow
  187. the DOS stack.
  188.  
  189.  
  190. 7. Random numbers
  191.  
  192. Unfortunately, what was said above was NOT sufficient to include the Engine in
  193. your virus.  The reason is, that in order to generate random encryption keys,
  194. the Engine uses a pseudo-random number generator.  To achieve greater
  195. flexibility, we decided to include it in another object module.
  196.  
  197. You have two options:
  198.   1) To use the sample pseudo-random numbers generator, included with the Engine
  199.   2) To design your own random numbers generator
  200.  
  201.   7.1.    Using the sample generator
  202.  
  203. It is easier to choose this option.  In this case you need to link the RND.OBJ
  204. module to the virus.
  205.  
  206. Also put the following instruction at the beginning of your source code:
  207.  
  208.     extrn    rnd_buf: word
  209.  
  210. Where the virus FIRST receives control, put the following instruction:
  211.  
  212.     mov    cs:[rnd_buf],0
  213.  
  214. You also MUST ensure that the contents of RND_BUF (which is in _DATA segment)
  215. will be preserved between two calls of the Engine.
  216.  
  217. If you need pseudo-random numbers in your virus, you can use the RND_GET and
  218. RND_INIT procedures, if you declared them as externals (see below).  However,
  219. either RND_INIT or MUT_ENGINE should be called prior to calling RND_GET!
  220.  
  221.   7.2.    Designing your own generator
  222.  
  223. To do this, you need to write two procedures, RND_INIT and RND_GET.  They must
  224. be declared as publics either in your virus, or in a separate module.
  225.  
  226. RND_INIT must return a RANDOM number in AX.
  227. RND_GET must return a PSEUDO-RANDOM number in AX.
  228.  
  229. These procedures MUST preserve all registers except for AX.  If you don't
  230. understand it, don't do it.  The Engine works great with the sample generator.
  231.  
  232.  
  233. 8. Final Notes
  234.  
  235. Well, that's for now.  No time for more.  Look at the demo virus and other
  236. sample files included here to get an idea how can you use it.  After you include
  237. it in your virus, please check carefully if the Engine does what you expect it
  238. to do.    Feel free to experiment with it.  If you have problems using it, or have
  239. any comments or suggestions about it, write a message to Dark Avenger at the:
  240.  
  241. Virus eXchange BBS in Sofia
  242. Phone number: (+359)-2-20-4198
  243. Working hours: 20:00 - 06:00 GMT (in the winter)
  244.            19:00 - 05:00 GMT (in the summer)
  245.  
  246. The latest release of the Engine should also be available at that BBS.
  247.  
  248. Pass the Engine (all files together in an archive) to virus programmers only.
  249.  
  250. Greetings to all virus programmers
  251. CrazySoft, Inc.
  252. Bulgaria
  253.