home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / pc / virus / 12tricks.hac < prev    next >
Encoding:
Text File  |  2003-06-11  |  13.0 KB  |  262 lines

  1.           >>> following from USENET @ 17feb90am /pats. <<<
  2.  
  3. The "Twelve Tricks" trojan - alert and description
  4.  
  5. We have recently received and analysed a trojan that we believe
  6. warrants an urgent alert.  We are calling it the Twelve Tricks trojan,
  7. and it is very interesting, very nasty, and quite complex.  This
  8. message is not meant to be a complete description of the trojan - we
  9. feel that it is important to get a warning out quickly, rather than
  10. aim for completeness.  It is not a virus.
  11.  
  12. The trojan consists of a program (more about this aspect later) which
  13. you run;  running the program, as well as the obvious things that the
  14. program is expected to do, also replaces the partition record (also
  15. called the Master Boot Record, or MBR) on your hard disk with its own
  16. version.  This can easily be recognised by inspecting the hard disk at
  17. cylinder zero, head zero, sector one, which can be done with a disk
  18. sector editor such as Peeka.  If the partition has this trojan in
  19. place, it will contain the following text near the beginning:
  20. SOFTLoK+ V3.0 SOFTGUARD SYSTEMS INC
  21. 2840 St. Thomas Expwy,suite 201
  22. Santa Clara,CA 95051 (408)970-9420
  23.  
  24. At this point, let us state that we believe that the company mentioned
  25. above has nothing whatsoever to do with the trojan;  perhaps the
  26. trojan author has a grudge against them.
  27.  
  28. The trojan uses a far call to the hard disk Bios code in order to
  29. plant this partition.  To do this, it must know the location in memory
  30. of the entry point;  it tries five different ones, one of which is the
  31. one documented in the IBM PC-XT Technical reference manual, and the
  32. other four are presumably fairly common alternatives.
  33.  
  34. The purpose of planting the trojan with a far call is, we believe, to
  35. escape detection by Active Monitor programs that protect a computer by
  36. monitoring the interrupt table, and preventing unauthorised writes to
  37. system areas on the hard disk.  Since Twelve Tricks doesn't use an
  38. interrupt to plant the MBR, such programs won't be able to prevent it.
  39. We tested this using Flushot+, probably the most successful of the
  40. Active Monitors, and Twelve Tricks went straight through it - the same
  41. would be true, we think, of any other Active Monitor.
  42.  
  43. The Replacement MBR
  44.  
  45. When the MBR is run, which is every time you boot from the hard disk,
  46. Twelve Tricks copies 205 (d7h) bytes of itself onto locations 0:300h
  47. to 0:3d6h.  This overwrites part of the interrupt vector table, but it
  48. is a part that doesn't get used very much.  This means that these d7h
  49. bytes are memory resident without having to use any of the TSR calls
  50. of Dos, and without having to reserve part of high memory.  Reserving
  51. part of high memory is the usual ploy used by Boot Sector Viruses, but
  52. the drawback of that route is that you might notice that a few kb from
  53. your 640 kb has disappeared (CHKDSK would reveal this).  The method
  54. used by Twelve Tricks would not show up as a loss from your 640 kb.
  55.  
  56. When the computer is started up, a random number generator determines
  57. which of the Twelve Tricks will be installed.  It does the
  58. installation by replacing one of the interrupt vectors with a vector
  59. that points to the Twelve Tricks own code, and then chains on to the
  60. original code.  The twelve tricks are:
  61.  
  62. 1.  Insert a random delay loop in the timer tick, so that 18.2 times
  63. per second, the computer executes a loop that is randomly between 1
  64. and 65536 long (different each time it is executed).  This slows the
  65. machine down, and makes it work rather jerkily.
  66.  
  67. 2.  Insert an End-Of-Interrupt in the timer tick.  This interferes
  68. with the servicing of hardware interrupts, so for example, the clock
  69. is stopped, TSRs that depend on the timer tick don't work, and the
  70. floppy motor is permanently on.
  71.  
  72. 3.  Every time a key is pressed or released, the timer tick count is
  73. incremented by a random number between 0 and 65535.  This has a
  74. variety of effects;  programs sometimes won't run, when you type
  75. "TIME" you get "Current time is divide overflow", and copying files
  76. sometimes doesn't work.
  77.  
  78. 4.  Every time interrupt 0dh is executed, only do the routine three
  79. times out of four.  Interrupt 0dh is used on PCs and XTs for the fixed
  80. disk, on ATs for the parallel port.
  81.  
  82. 5.  Every time interrupt 0eh is executed, only do the routine three
  83. times out of four.  Interrupt 0eh is used for the floppy disk.
  84.  
  85. 6.  Every time interrupt 10h is called (this is the video routine),
  86. insert a delay loop that is randomly between 1 and 65536 long
  87. (different each time it is executed).  This slows the video down, and
  88. makes it work rather jerkily and/or slowly.
  89.  
  90. 7.  Every time the video routine to scroll up is called, instead of
  91. the requested number of lines being scrolled, the entire scrolling
  92. window is blanked.
  93.  
  94. 8.  Every time a request is made to the diskette handler, it is
  95. converted into a write request.  This means that the first time you
  96. try to read or write to a diskette, whatever happens to be in the
  97. buffer will be written to the diskette, and will probably overwrite
  98. the boot sector, FAT or directory, as these must be read before
  99. anything else can be done.  If you try to read a write protected
  100. diskette, you get "Write protect error reading drive A".  If you do a
  101. DIR of a write enabled diskette, you get "General Failure ...", and if
  102. you inspect the diskette using a sector editor, you'll find that the
  103. boot and FAT have been zeroed or over-written.
  104.  
  105. 9.  Every time interrupt 16h is called (read the keyboard) the
  106. keyboard flags (Caps lock, Num lock, shift states etc) are set
  107. randomly before the keystroke is returned.  This means that at the Dos
  108. prompt, the keyboard will only work occasionally.  Programs that poll
  109. interrupt 16h will be unusable.  Holding down the Del key will trigger
  110. a Ctrl-Alt-Del.
  111.  
  112. 10.  Everything that goes to the printer is garbled by xoring it with
  113. a byte from the timer tick count.
  114.  
  115. 11.  Every letter that is sent to the printer has its case reversed by
  116. xoring it with 20h.  Also, non-alpha characters are xored, so a space
  117. becomes a null, and line feeds don't feed lines.
  118.  
  119. 12.  Whenever the Time-Of-Day interrupt (1ah) is executed, do an
  120. End-Of-Interrupt instead.  This means that you can't set the system
  121. clock, and the time is set permanently to one value.
  122.  
  123. These are the twelve tricks.  In addition there are two more things
  124. that the trojan does.  It uses a random number generator;  one time
  125. out of 4096, it does a low level format of the track that contains the
  126. active boot sector;  this will also destroy part of the first copy of
  127. the FAT.  You can recover from this by creating a new boot sector, and
  128. copying the second copy of the FAT back over the first copy.  After it
  129. does the format, it will display the message "SOFTLoK+ " etc as above,
  130. and hang the computer.
  131.  
  132. If it doesn't do the format, it makes a random change to a random word
  133. in one of the first 16 sectors of the FAT, which will make a slight
  134. and increasing corruption in the file system.  This is perhaps the
  135. worst of the things that it does, as it will cause an increasing
  136. corruption of the files on the disk.
  137.  
  138. The Dropper program
  139.  
  140. The program that drops the trojan was, in the specimen that we
  141. analysed, a hacked version of CORETEST, a program to benchmark hard
  142. disk performance.  The file is CORETEST.COM, it is version 2.6, (dated
  143. 1986 in the copyright message) had a length of 32469 bytes, and it was
  144. timestamped 6-6-86, 9:44.  When we looked in more detail at this
  145. program, we found some interesting things.
  146.  
  147. It looks as if the original CORETEST program was an EXE file, and the
  148. trojan author prepended his code to it.  This code consists of some
  149. relocation stuff, then a decryptor, to decrypt the following 246h
  150. bytes.  The decryption is a double xor with a changing byte.  Those
  151. 246h bytes, when run, examine the memory to try to find one of five
  152. sets of hard disk handler code (presumably corresponding to five
  153. Bioses).  When it finds one of them, (we have identified the first one
  154. as being the IBM XT Bios) it plants the trojan MBR in place, using a
  155. far call to the Bios code.  The trojan MBR is 200h of the 246h bytes.
  156. The trojan is patched so that it also does disk accesses using a far
  157. call to the same location.  Finally, the prepended trojan passes
  158. control to the original program.  We call the combination of the
  159. prepended code, plus the original program, the Dropper.
  160.  
  161. The main purpose of the encryption, we would guess, is to evade
  162. detection by programs that check code for bombs and trojans. There
  163. are no suspicious strings or interrupt calls in the code until it
  164. is decrypted at run time.
  165.  
  166. As far as we can tell, it is not a virus, but a trojan.  However, it
  167. is unlikely that all the patching to the original program was done by
  168. hand - it is far more likely that the trojan author wrote a prepender
  169. program (we would call this the Prepender), to automatically attach
  170. his code to the target executable.  If this is the case, then there
  171. are two consequences.  The first is that he might have trojanised
  172. other programs besides the one that we have examined.  In other words,
  173. there might be other Droppers around besides the one we have examined.
  174. The second is that if that is the case, we cannot rely on the
  175. encryption having the same seed each time, as the Prepender might
  176. change the seed each time it operates.  So it would be unsafe to
  177. search files for the encrypted MBR.  Instead, we propose a search
  178. string based on the decryptor.
  179.  
  180. Indeed, a further possibility exists.  The Prepender program might
  181. have been placed into circulation, and people running it would
  182. unwittingly be creating additional Droppers.  There is absolutely no
  183. evidence to suggest that that is actually the case, but we would ask
  184. anyone who detects this Dropper in one of their files, to also examine
  185. all the others.
  186.  
  187. Detection
  188.  
  189. Here's a variety of ways to detect the trojan. The hexadecimal string
  190. e4 61 8a e0 0c 80 e6 61 is to be found in the MBR. This string will
  191. also be found in memory if you have booted from a trojanised MBR,
  192. at location 0:38b. You can use Debug to search in memory.
  193.  
  194. A useful search string to detect the Dropper is
  195.  
  196. be 64 02 31 94 42 01 d1 c2 4e 79 f7
  197.  
  198. Getting rid of it
  199.  
  200. It's easy to get rid of Droppers;  just delete them and replace them
  201. with a clean copy.  If you find the string above in the MBR or in
  202. memory at 0:38b, you need to boot from a clean Dos diskette and
  203. replace the partition record.  DO NOT use Fdisk to do this unless you
  204. are prepared for Fdisk to zero your FAT and directory;  you will lose
  205. all your data that way.  One way would be to do a file-by-file backup,
  206. low-level format to get rid of the trojan MBR, then Fdisk Format and
  207. restoer your backup.  We would recommend doing two backups using as
  208. different methods as possible if you use this route, in case one of
  209. them fails to restore.
  210.  
  211. The other way to replace the partition is to run a program that drops
  212. a clean partition record onto the MBR, but doesn't change the
  213. partitioning data.  We are currently preparing one of these - please
  214. ask if you need it.
  215.  
  216. Damage done
  217.  
  218. The whole of the MBR is used for the code.  Most normal MBRs don't use
  219. more than half the space, and a number of other programs have started
  220. using this space.  For example Disk Manager, and the Western Digital
  221. WDXT-Gen controllers (but the Dropper doesn't work on the WDXT-Gen).
  222. This means that the Dropper might cause an immediate problem in some
  223. circumstances.
  224.  
  225. The main damage done, however, will be in the impression that this
  226. trojan creates that your hardware is suffering from a variety of
  227. faults, which usually go away when you reboot (only to be replaced by
  228. other faults).  Also, the FAT gets progressively corrupted.
  229.  
  230. Occurrences
  231.  
  232. So far, this has only been reported in Surrey, England.  It was
  233. noticed because it made a disk using Speedstor to control it,
  234. non-bootable.  Disks that are controlled in the normal way, remain
  235. bootable.  We would be grateful if any sightings could be reported to
  236. us, especially if the Dropper program is different from the one we
  237. have examined;  we would also like a specimen of it,
  238.  
  239. Please report instances to the addresses below:
  240.  
  241. Dr Alan Solomon                Day voice:     +44 494 791900
  242. S&S Anti Virus Group           Eve voice:     +44 494 724201
  243. Water Meadow                   Fax:           +44 494 791602
  244. Germain Street,                BBS:           +44 494 724946
  245. Chesham,                       Fido node:     254/29
  246. Bucks, HP5 1LP                 Usenet:        drsolly at ibmpcug.co.uk
  247. England                        Gold:          83:JNL246
  248.                                CIX, CONNECT   drsolly
  249. or
  250.  
  251. Mr Christoph Fischer           Day voice:     +49 721 6084041
  252. Micro-BIT Virus Centre         Eve voice:     +49 721 861540
  253. University of Karlsruhe        Fax:           +49 721 621479
  254. Zirkel 2                       BITNET:        RY15 at DKAUNI11
  255. D-7500 Karlsruhe 1
  256. West-Germany
  257.  
  258.  
  259.  File Name    Length   Method     Date      Time    (Enter) or (S)kip, (V)iew
  260. ------------  ------  --------  --------  --------  -------------------------
  261. 12TRICKS.TXT   13066  Imploded  02-17-90  10:57:28  Action? 
  262.