home *** CD-ROM | disk | FTP | other *** search
/ Hacker 2 / HACKER2.mdf / virus / 40hex_8.005 < prev    next >
Text File  |  1995-01-03  |  40KB  |  739 lines

  1. 40Hex Number 8 Volume 2 Issue 4                                       File 005
  2.  
  3.            STARSHIP - interesting file-boot virus.
  4.                          Muttik I.G.
  5.                 (Internet: MIG@politon.msk.su)
  6.  
  7.  
  8.      KEYWORDS
  9.  
  10.      Virus, DOS, executable file, masterboot record,
  11.      resident in memory, encryption.
  12.  
  13.  
  14.      ABSTRACT
  15.  
  16. STARSHIP virus (file and boot simultaneously) is described. It
  17. infects IBM  PC and  compatibles running  DOS. Virus is called
  18. STARSHIP :  this string can be easily found in the memory dump
  19. of virus.  Virus infects  masterboot record  on  harddisk  and
  20. executable files  files created on floppy drives. The virus is
  21. encrypted. Infected executable files have no descriptor longer
  22. than 2  bytes. Virus  appears to  have no destructive code, it
  23. uses  music  and  video  effects  when  active.  The  abnormal
  24. operation of the infected computers was sometimes detected.
  25.  
  26.  
  27.      INTRODUCTION
  28.  
  29.      History of  computer viruses  is very  short.  The  first
  30. known publications  are dated  with 1984-1985  [1,2]. But  now
  31. situation in this field changes every day - uncountable number
  32. of various  computer viruses  are  known  at  present  in  DOS
  33. operating system.  The variety  of known viruses is fantastic,
  34. but all  of them  falls into  three  known  categories:  file,
  35. boot [3,4] and cluster. Active area of the first virus type is
  36. executable files  and of  the second  type -  boot records  on
  37. harddisks and  diskettes. The  third category is not yet over-
  38. populated, the only representative is bulgarian DIR-II virus.
  39.      Probably the  first virus  which infects  files and  boot
  40. sectors was  Ghost virus  [5]. This  virus was  discovered  by
  41. Fridrik Skulason  at Icelandic University. Ghost virus infects
  42. only COM  files. This virus increases file size by 2351 bytes.
  43. When active  the Ghost replaces boot sector of infected system
  44. with a  boot virus  similar to  Ping Pong, but this boot virus
  45. does  not   have   infection   routine.   The   Ghost   virus,
  46. consequently, may  be considered  as a file virus with unusual
  47. active phase.  After some  time appeared Virus-101, Frodo and,
  48. finally, a  bunch of new viruses was found: Thanksgiving virus
  49. (V-1),  TEQUILA   and  STARSHIP  (these  type  of  viruses  is
  50. sometimes called "multi-partite").
  51.      STARSHIP virus  was found  in  Moscow  in  January  1991.
  52. Probably this virus was written in the USSR.
  53.      The living cycle of STARSHIP virus is the following. When
  54. infected file  is started  it modifies masterboot record (MBR)
  55. on the harddisk and writes virus on the disk. Thereafter, when
  56. computer reboots, virus intercepts interrupt vectors 13h (low-
  57. level disk I/O) and 21h (DOS service). During the reboot virus
  58. is stored in the videomemory at address BB00:0. It is moved to
  59. the core  RAM later, when the first program terminates. Now it
  60. stays resident  and infects any COM/EXE file created on floppy
  61. drives.
  62.  
  63.      1. GENERAL DESCRIPTION
  64.  
  65.      Length of STARSHIP virus in memory is 2688 bytes. Size of
  66. code is 2560 bytes, buffers and variables takes the remainder.
  67. On harddisk virus takes 3072 bytes (6 sectors * 512 bytes).
  68.      Virus layout  is shown  in Table.1  and its  memory  dump
  69. (fragmentary) is  presented  in  Figure.1.  (NOTE:  All  dumps
  70. presented is  the article  are partial in order to prevent the
  71. possibility to use for generation of new viruses.)
  72.      No text  messages except  one  string  ">STARSHIP_1<"  of
  73. length 12  (found only in memory) were discovered. This string
  74. can be  found only  in memory, because virus is stored on disk
  75. and in the infected file in encrypted form.
  76.      Normally virus stays resident and the size of used memory
  77. block is  B00h=2816. The beginning of this memory block is the
  78. Program Segment  Prefix (PSP)  of program  that triggered  the
  79. installation of virus in the core RAM. Really virus is started
  80. at offset  80h in  this PSP (consequently, the real virus size
  81. is: B00h-80h=A80h=2688 bytes).
  82.      Virus uses  standard interrupts  13h, 20h,  21h, 27h  and
  83. creates its own interrupts F9h and FCh (see later). When virus
  84. is already  resident (installed  in the core RAM) it uses only
  85. 13h and  21h vectors.  Entry points of both interrupt handlers
  86. can be  easily found  (CS:005F and CS:00C5; here CS represents
  87. the code segment where virus resides).
  88.      In the  memory dump of virus one can found the buffer for
  89. the filename  (see ASCIIZ= 'B:\TMP\DROZFILA.COM' at CS:000D in
  90. Fig.1).
  91.      Virus  extensively   uses  its   internal  random  number
  92. generator. The  random number  seed is  taken from  BIOS timer
  93. variable  (0:46Ch).   Random  generator   is  used   for   the
  94. demonstration of  video effect and while creating the infected
  95. file (change  of size  is random  and virus  code is encrypted
  96. using random number). The word "random" may be a real motto of
  97. the described  virus -  it uses  random number  generator very
  98. frequently.
  99.      The part  of virus  memory image  is encrypted  using XOR
  100. function (approximately 60% of total virus size). This section
  101. is decrypted  and used  only while infecting files (section is
  102. marked in  Table.1 with the box). After infection of each file
  103. the XOR  mask is changed, and encryption is performed with the
  104. new mask.  Described procedure  makes  the  encrypted  section
  105. volatile and unreadable. This behavior is not used to hide any
  106. strings in  virus body  (there are  no strings  at all, except
  107. virus  name)  -  maybe  it  is  implemented  only  to  achieve
  108. permanent variance.
  109.      Virus uses  trace capabilities  of processor to determine
  110. the original  BIOS interrupt  13h entry  point.  Virus  issues
  111. int 13h with  trace flag  set and  records the  CS:IP when  CS
  112. becomes greater  or equal  to C800h  (corresponds to  the  ROM
  113. area). However  this method  seems to be non-universal. I have
  114. investigated the  process of  disk infection  and  found  that
  115. rewriting of  MBR sometimes  triggered the  resident antivirus
  116. utilities (program  TSAFE:  Turbo-Anti  Virus  Ver.6.80A  from
  117. CARMEL Software Engineering, Israel).
  118.      While disassembling  the virus  I have found special code
  119. inserts used  to  fool  disassemblers.  In  most  cases  these
  120. inserts uses  non-working calls  and  jumps  pointing  on  the
  121. garbage in  the virus  body. These  inserts are a real problem
  122. for disassemblers  and I  have not  found one  that managed to
  123. correctly separate  code and  data (or  code and garbage). The
  124. intelligent analysis of code is needed, which is not performed
  125. by  all   available  disassemblers  (including  smart  SOURCER
  126. ver. 3.07, by V Communications Inc.).
  127.      I have  carefully examined  the reconstructed  source and
  128. established that STARSHIP virus appears to have no destructive
  129. code.
  130.  
  131.  
  132.      2. FILE INFECTION
  133.  
  134.      Strategy of  file infection  is the  following. Files are
  135. infected while  creation of  EXE/COM file  on A:  or B: disks.
  136. Virus records  file name  in internal buffer (at CS:000D), and
  137. starts infection  routine when  request to  close the file was
  138. issued. This  technique is  similar to the method used by Dark
  139. Avenger virus [3,5,7].
  140.      The idea  to infect only executable file that are created
  141. on floppy  disks explains  why STARSHIP does not intercept int
  142. 24h. This  interrupt is  usually catched by viruses to prevent
  143. message - "Write  protect error". But when file is created (!)
  144. on the  floppy disk  it automatically  indicates that the user
  145. has removed (or will remove) the write protect tab.
  146.      Change of infected file size is true random (for the same
  147. file you  can get  many variants  of infection  with different
  148. size growth). Change of size is typically 2616...2648 bytes.
  149.      Virus infects  COMMAND.COM file  when it  is  created  on
  150. floppy disk.  No special  strategy is  used to  infect command
  151. interpreter - it is infected as a simple .COM file.
  152.      When infecting executable (only EXE and COM) files, virus
  153. preserves attribute.  If the file is readonly - this attribute
  154. remains  unchanged  after  infection.  STARSHIP  examines  the
  155. executable file  type by its contents, not by extension (tests
  156. for 5A4Dh  at file  beginning, but  it does  not test  4D5Ah).
  157. Virus does  not infect  short files  - see Table 2. Virus does
  158. not infect  the files  that are  already infected.  Buffer  at
  159. virus end  is used  to read  code beginning  and determine the
  160. presence of  virus (it  seems to  me that virus may frequently
  161. regard uninfected  files as infected, because it performs very
  162. primitive analysis).
  163.      Virus infection  routine uses  the following  interrupts:
  164. int F9h (it points on the original int 21h, as set by DOS) and
  165. int FCh  (points on  original int  13h, as set by BIOS). These
  166. interrupts are used instead of int 21h and 13h. This technique
  167. is probably  used to  prevent triggering  of certain antivirus
  168. utilities. These  utilities often  controls all invokations of
  169. 21h and 13h interrupts. The infection routine appends virus to
  170. the end  of executable  file and  adjusts  the  program  entry
  171. point.
  172.      Executable files with COM extension are modified by virus
  173. at first  3 bytes,  which are  replaced with  JMP instruction,
  174. pointing on  the decryptor.  Original 3  bytes from file start
  175. are stored at the very end of the infected file (like the body
  176. of virus these bytes are encrypted with XOR function).
  177.      After modification  of the  EXE  file  header  new  CS:IP
  178. points on  the virus decryptor. SS, SP and MINALLOC fields are
  179. changed. Original  CS, IP,  SS and SP are stored at the end of
  180. the virus  body at  offset A4Fh  (you cannot fetch these bytes
  181. directly - they are encrypted).
  182.      The header  of the  infected EXE  file has  some  special
  183. features. Instruction  pointer always  follows  the  relation:
  184. 4<IP<13h. Spacing  between stack  segment and  code segment is
  185. constant: SS-CS=100h  and  stack  pointer  is  always  set  to
  186. SP=800h. Moreover,  STARSHIP does  not infect  EXE files  when
  187. MAXALLOC field  of EXE  header is less than 0FFFFh. Virus does
  188. not infect files with nonzero overlay number.
  189.      Virus code  is added  to the end of file in the encrypted
  190. form.  This  encrypted  code  goes  after  special  decrypting
  191. program (decryptor). The purpose of decryptor is to decode the
  192. virus body.
  193.      Decryptor of  virus body  seems to  be specially designed
  194. not to  have  a  characteristic  bytes  sequence  (descriptor)
  195. longer than  2 bytes  (for example:  XOR BH,BH and MOV BL,6 is
  196. used instead  of MOV BX,0006,  because first commands occupies
  197. 2-bytes, but  the last takes 3 bytes). In reality this program
  198. is mixed  with NOPs  and other 1-byte codes, not affecting the
  199. execution of decryptor. The sequence of operators in main code
  200. is fixed,  but spacing  between these  operators is  variable.
  201. Described technique  really eliminates the possibility to find
  202. virus using search based on certain descriptor, because any 2-
  203. byte sequences  are found  on the  disk too frequently. Search
  204. based on  the wildcard  strings must  take into  account  that
  205. spacing between operators in virus code is variable (from 0 to
  206. 16 bytes of NOPs and other silly stuff).
  207.      Moreover, the  decryptor  uses  synonyms  for  code:  for
  208. example the XCHG AX,SI command has three (!) different machine
  209. code representations  (0c687h,  0f087h,  96h  means  the  same
  210. processor directive  -  XCHG AX,SI).  As  well  MOV AX,SP  and
  211. MOV BX,AX has  two representations. That fact also complicates
  212. search based on the wildcard strings, producing many different
  213. wildcards for the same virus.
  214.      First  the  decryptor  must  determine  its  position  in
  215. memory, because  all references  in the virus must be relative
  216. to  the   known   point.   STARSHIP   uses   unusual   method,
  217. simultaneously suppressing  the attempts  to  trace  execution
  218. flow of  decryptor with  the use of debugger. Virus issues int
  219. 03h (it  usually points  on IRET)  and then  reads the  return
  220. address below (!) the stack pointer SP (LODSW SS:[SI]). If you
  221. use the  debugger, it will immediately destroy all words below
  222. the SP, resulting in the malfunction of the rest of decryptor.
  223. Sometimes instead of int 03h virus uses interrupts 01h/11h/12h
  224. as the dummy calls.
  225.      Decryption of  virus code attached to infected executable
  226. file is done from top addresses to bottom. This sequence makes
  227. tricky setting of breakpoint after the decryption loop because
  228. the last  decrypted byte is just below the loop. Hence, if you
  229. place here  the breakpoint  it will  be  decrypted,  its  code
  230. (0CCh) will  become garbage  and will  be executed  instead of
  231. invokation of breakpoint routine.
  232.      All general  processor registers  are set  to zero  after
  233. decryption process prior to start of infected program. Segment
  234. registers are preserved.
  235.      When  I  used  MS-Windows  or  any  other  graphics  user
  236. interfaces -  infection of  copied files  does not take place.
  237. That is  possibly because  virus uses videomemory as temporary
  238. buffer while  infecting files  and checks the videomode before
  239. infection.
  240.  
  241.      3. DISK INFECTION
  242.  
  243.      When decryptor  finished its work it transfers control to
  244. the disk  infection routine. First this code tests DOS version
  245. number (virus works only with versions later than 2.0) and the
  246. presence of video-RAM at BB00:0 (virus physically tests memory
  247. existence at  this address  via MOV/CMP sequence). Second - it
  248. tests if  virus is  already resident  (checks if special virus
  249. memory dispatcher  is present at address 0000:04B0). And third
  250. - STARSHIP determines the original int 13h entry point in BIOS
  251. (it traces  the call of int 13h, function 8; this call is used
  252. to determine  the physical  disk size).  The  fourth  -  virus
  253. infects the masterboot via direct call of BIOS int 13h.
  254.      STARSHIP  modifies   MBR  in   only  3  bytes:  head  and
  255. sector/cylinder of  DOS boot.  Virus  places  its  code  in  6
  256. consecutive sectors at the disk end (it uses physical disk #1,
  257. last head,  last track  and last 6 sectors in the last track).
  258. After modification  of MBR,  boot field  of  active  partition
  259. points on pseudoDOS boot, the first of used 6 sectors. Dump of
  260. pseudoDOS boot  is presented  in Figure  2. First  5 bytes  in
  261. pseudoDOS boot  are equal  to the  original DOS boot beginning
  262. (0EBh, 034h,  090h, 'MS').  The pseudoDOS  boot  contains  the
  263. loader of virus code that is located in next 5 sectors. (Note:
  264. the area at offset 115h..1F9h in pseudoDOS boot is filled with
  265. garbage).
  266.      Counter of  reboots (byte)  is located  at offset 1FCh in
  267. pseudoDOS boot.  This counter is initialized with random value
  268. in range  0...20h. Sometimes  it is initialized with 0FFh - in
  269. this  case  the  counter  is  not  incremented  during  reboot
  270. (probably such  computer cannot  be ill).  The probability  of
  271. this case is approximately 30%.
  272.      At offset  1FDh in pseudoDOS boot the XOR mask (byte) can
  273. be found.  This mask  is used  for  decryption  of  5  sectors
  274. following pseudoDOS boot (these sectors contains virus body).
  275.      Moreover, I  have found  in pseudoDOS  boot the code that
  276. loads and  executes unknown  procedure from  sectors 2...6  on
  277. head 0  and track  0. Code from these sectors is executed only
  278. if its  checksum is  valid. This  space between  MBR and first
  279. partition (it  normally starts  on head 1, track 0) is usually
  280. unused and  filled with zeros. This area is frequently used by
  281. some computer viruses [3] (DiskKiller for example). But I have
  282. not detected any valuable code in these sectors - this unknown
  283. procedure was probably written only to fool the researchers or
  284. for futer virus extension.
  285.      Upon infection virus stores no original MBR copy. It only
  286. saves changes  -  3  bytes  of  original  DOS  boot  head  and
  287. sector/cylinder (stored  under XOR  mask inside  5 sectors  of
  288. virus code). If you want to get these parameters you must read
  289. XOR mask from pseudoDOS boot, decrypt the virus body and fetch
  290. necessary 3 bytes from the appropriate positions.
  291.      There is  another method  to restore original MBR. If you
  292. perform the  request  to  read  MBR  (AX=201h,  CX=1,  DX=80h,
  293. ES:BX=buffer) via  int 13h:  virus will read real MBR, restore
  294. its original  contents and  you will obtain what you want. You
  295. can save  this MBR  copy on  disk, reboot  from uninfected DOS
  296. diskette and  write it  back on  harddrive instead of infected
  297. MBR. This  method works fine and we used it successfully prior
  298. to creation  of removing utility. The only disadvantage of the
  299. described method is that it takes too much time.
  300.  
  301.  
  302.      4. REBOOT OF INFECTED COMPUTER
  303.  
  304.      When computer  reboots the pseudoDOS boot is executed. It
  305. loads virus  code in  videomemory (at  address BB00:0000).  PC
  306. without videomemory  at segment  BB00 are not infected (I have
  307. no computer  with monochrome  display adapter  so the test was
  308. not  really   performed).  Then   it  decrypts   the  code  in
  309. videomemory, intercepts  int 13h  and creates  special  memory
  310. dispatcher at  address 0000:04B0.  The dispatcher structure is
  311. shown in Fig.3a.
  312.      Now all  accesses to  disk are  controlled with the virus
  313. patch on  interrupt 13h. This code filters all accesses to MBR
  314. and last  6 sectors  on disk.  The MBR now looks unchanged and
  315. all writes to last 6 sectors are impossible (error flag is not
  316. returned).   Described    technique   preserves   virus   from
  317. modification, since its code is installed in DOS file area.
  318.      After installation  in videomemory  virus examines if DOS
  319. interrupts (20h, 21h, 27h) are set. This technique seems to be
  320. universal :  I have  tested DOS versions 2.0, 2.11, 3.0, 3.30,
  321. 4.0 and  virus successfully  intercepts DOS  interrupts. Virus
  322. hanged during reboot only with MS-DOS version 5.00. Section of
  323. virus implementing  the task  of DOS interception analyses the
  324. validity of  CS in  the vectors table for DOS interrupts (20h,
  325. 21h, 27h) to determine if it is safe to intercept DOS vectors.
  326.      DOS interrupt  21h is  intercepted by STARSHIP before any
  327. programs can  do the  same from CONFIG.SYS or AUTOEXEC.BAT. So
  328. any resident  software vaccine  programs  ANTI4US2,  FLOSERUM,
  329. TSAFE or  others, including programs with driver anatomy would
  330. be unable to detect the operation of virus.
  331.      After the  interception of DOS interrupts virus waits for
  332. the termination  of  first  program.  It  test  the  calls  of
  333. interrupts 20h,  27h and  of the DOS functions 0, 31h and 4Ch.
  334. When Exit_to_DOS  request was  issued virus body is moved from
  335. videomemory to  the core memory. If terminated program remains
  336. resident virus  expands its  memory block  (glues to  resident
  337. tail). If  program simply  returns to  DOS (AH=0, AH=4C) virus
  338. substitutes the exit request with the TSR request (AH=31h) and
  339. creates its own memory block. At this moment memory dispatcher
  340. is modified to point on the new interrupt routines in the body
  341. of virus.  From this moment virus stops controlling interrupts
  342. 20h and  27h.  It  uses  now  only  13h  and  21h  interrupts.
  343. Dispatcher layout  after the shift of virus to the core RAM is
  344. presented in Fig.3b.
  345.      If the  first loaded program uses graphics - the virus is
  346. erased from  videomemory, but  it can  survive because  it has
  347. special restoring procedure (int B0h, at address 0000:02C0, in
  348. the vectors  table). That  is exotic  -  the  whole  interrupt
  349. service routine is located in the interrupt table (it occupies
  350. approximately 3  paragraphs and  covers  interrupts  B0...BB).
  351. This routine  checks presence  of  virus  in  videomemory  (in
  352. reality only  one word of videomemory is checked) and if virus
  353. image was  destroyed all 5 sectors with virus program are read
  354. to videomemory  and decoded (remember that disk image of virus
  355. is XOR-encrypted).  Computer hangs  only if  graphics is  used
  356. simultaneously with  accesses to DOS, but this situation seems
  357. to  be  exceptional,  because  programs  usually  included  in
  358. AUTOEXEC.BAT rarely use graphics.
  359.      The performing of all these tests on the infected machine
  360. was very  useful and  exciting  when  the  very  first  loaded
  361. program was DEBUG (you must remove or rename AUTOEXEC.BAT; you
  362. can also  place DEBUG  as  the  first  line  of  your  current
  363. AUTOEXEC.BAT). All  virus structures  were easily located. The
  364. most interesting  were attempts  to  erase  virus  image  from
  365. videomemory -  virus immediately  restores its  code. In DEBUG
  366. you can  investigate the  process of virus installation in the
  367. core RAM.  You only  need to trace the request of DOS function
  368. 4Ch (terminate) - and you will see how virus code is moved and
  369. how its memory dispatcher is modified.
  370.      After the  installation of virus in the core RAM it waits
  371. for the  creation of any executable files on the floppy drives
  372. A: and  B:. This  is usually done with DOS "copy" command when
  373. destination file is located on floppy disk.
  374.  
  375.  
  376.      4. ACTIVE PHASE
  377.  
  378.      The evil  happens when  reboots counter reaches 80 (while
  379. initial reboot  counter is  in range  0..31). Disease  appears
  380. after few  hours since  reboot and  this delay  depends on the
  381. disk activity.  Virus plays  music  tones  and  drops  colored
  382. points (ASCII=250)  without affecting  of  screen  background.
  383. Each point  and each  tone corresponds  to  one  disk  access.
  384. Frequency of  tones seems  to be  proportional to  the  seccyl
  385. parameter (CX) of int 13h. This musical and visual effect does
  386. not take place in any graphics modes. Colored points appearing
  387. at random  screen positions  does not  affect  pseudographics.
  388. Sometimes dots  are substituted  by spaces.  This video effect
  389. corrupts  the   screen  in   text  mode   resulting   in   the
  390. impossibility of using intensive disk accesses.
  391.      When disks  are inactive  all operates correctly. You can
  392. also use virtual disks or cache without any problems.
  393.      Reboot temporary suspends virus activity.
  394.      But remember  that infected  computer will  reach  active
  395. phase  only  with  approximate  probability  2/3.  In  certain
  396. infected computers triggering of virus is blocked! Behavior of
  397. infected computer  depends on  the initial  value  of  reboots
  398. counter.
  399.  
  400.  
  401.      5. ERRORS AND BUGS
  402.  
  403.      When STARSHIP infects harddisk it rewrites 6 last sectors
  404. on the  disk. The  contents of these sectors are unrecoverably
  405. lost!
  406.      Moreover, virus  controls all disk accesses (via int 13h)
  407. to prevent  the rewrite  of its code (all writes to virus area
  408. are simply  ignored; error  condition is not returned). But if
  409. you load  DOS from floppy disk and then modify this restricted
  410. zone (for  example if  you write file and it occasionally will
  411. occupy the  last cluster  on the harddisk) - computer will not
  412. reboot later  and hang.  You will  need  to  recreate  MBR  to
  413. overcome this problem.
  414.      I have  determined that  the problem  may appear when the
  415. first used  program is  MARK (by  TurboPower  Software).  This
  416. program is  used in  combination with  RELEASE to  remove  all
  417. resident utilities  that were  loaded after  MARK, to save and
  418. restore the  interrupt vectors  table and state of EMS memory.
  419. When MARK remains resident virus glues to its memory block and
  420. everything is  correct. But  when you start RELEASE - computer
  421. hangs. This  happens because  RELEASE restores  the interrupts
  422. table in  its state before (!) shift of virus to the core RAM,
  423. when virus  was in  videomemory. Consequently, vectors 13h and
  424. 21h  after   RELEASE  points   on  videomemory   where  is  no
  425. appropriate handlers  at this  moment -  computer  immediately
  426. hangs.
  427.      Probably, if  you replace  your CGA,  EGA or  VGA adaptor
  428. with MDA, your computer will hang after power-up because there
  429. will be  no space  to store virus during reboot. (Virus checks
  430. videomemory existence only once - prior to disk infection.)
  431.      The use of special restoration procedure at address 0:2C0
  432. in the  interrupt vectors  table must cause the malfunction of
  433. computers that  uses vectors  B0...BB  during  reboot.  (These
  434. vectors are  used by  virus only  during reboot,  when special
  435. restoration procedure  is located at address 0:2C0. When virus
  436. goes resident  in conventional  memory all  these vectors  are
  437. cleared with zeroes!)
  438.      I have  detected that  some XT  computers  with  RAMDRIVE
  439. driver  in  the  CONFIG.SYS  did  not  execute  some  programs
  440. (Harvard Graphics, MS-FORTRAN, QuickBASIC).
  441.      Some users  have reported the problems with the reboot of
  442. infected PS/2 model 30.
  443.      These examples  establishes the  rule - remove virus when
  444. you  fixed  its  presence.  There  are  no  harmless  viruses.
  445. Remember: any infected program may produce malfunction of your
  446. computer!
  447.  
  448.  
  449.      6. STARSHIP DETECTION
  450.  
  451.      STARSHIP virus  has one  special feature  - it  does  not
  452. modify any  executable file  on the  harddisk. So  if you  use
  453. passive virus detectors (based on the generation of CRC checks
  454. for the  files) to test your harddisk - you will never get the
  455. warning about  virus activity.  Each file on the harddisk will
  456. remain unchanged.  Additionally, if  this utility examines the
  457. contents of  MBR and  DOS boot  sector, it will not inform you
  458. about the  infection if it uses simple interrupt 13h. STARSHIP
  459. will substitute  infected MBR with the original in each access
  460. to MBR via int 13h.
  461.      How to  detect the  presence of  STARSHIP? It  is a  real
  462. problem, because  the search  of infected  files based  on the
  463. virus descriptor  is impossible.  No standard  software can be
  464. used to  found  STARSHIP.  Only  specially  designed  scanning
  465. programs that  analyses the  contents of the EXE header or the
  466. code at the file entry point are useful.
  467.      Here follows  some useful  hints  that  may  be  used  to
  468. determine the presence of STARSHIP virus.
  469.      If  you  have  antivirus  program  AIDSTEST  by  Lozinsky
  470. (version later than 115, April 1991) it can scan and desinfect
  471. files (AIDSTEST  calls virus  "STARSHIP-2616").  Sometimes  it
  472. refuses to  desinfect file  and reports something like "Cannot
  473. remove virus. Delete file(Y/N)?".
  474.      If you  reboot from original DOS diskette and start FDISK
  475. - it  shows (Display Partition Information) that Start and End
  476. of DOS partition are equal for the infected harddisk.
  477.      You can  also detect  the presence  of STARSHIP  virus in
  478. memory if  you examine  (unassemble) RAM  contents at  address
  479. 0:4B0 with the help of DEBUG (compare with Fig.3).
  480.      Typically executable  files has  text messages, tables or
  481. zeros at  the end.  So you  can visually  examine the  tail of
  482. executable file  and if  you will see approximately 2.7 kbytes
  483. of garbage  - that  is suspicious  and  you  may  suggest  the
  484. presence of  virus. Experienced  programmers may  also inspect
  485. the  program   entry  point   with  DEBUG   and  analyse   the
  486. disassembled listing.
  487.      I also  recommend not  to copy  executable files  on  the
  488. floppies  directly.   Use  archive  utilities  and  then  copy
  489. archives on  the floppies.  This sequence saves disk space and
  490. also preserves  from file  infection. But  this method has one
  491. disadvantage. If the initial file is already infected you will
  492. not be  able to  detect the  presence of  virus because  it is
  493. incorporated into the archive in compressed form.
  494.      The identification  of STARSHIP  virus is complex because
  495. it extensively  uses XOR  coding and uses random masks. In the
  496. infected file 100% of virus is encrypted. On disk - 5/6 and in
  497. memory - approximately 60%. That is very interesting feature -
  498. virus is  not available  in pure form, being variable on disk,
  499. in file and in memory.
  500.  
  501.  
  502.      CONCLUSION
  503.  
  504.      To  my   opinion  the   investigated  virus   is  a  very
  505. interesting program.  Virus code  is highly  optimized on  the
  506. machine-code level.  That was  possibly done to place the code
  507. exactly into  5 sectors  on disk.  Virus uses various software
  508. techniques,   it   has   antitracing   and   antidisassembling
  509. organization,  it  has  no  descriptor.  These  measures  were
  510. effective to  some extent,  because I  have some  problems  in
  511. source reconstruction.  In many  cases the  source seems to be
  512. not fully adequate.
  513.      The present  stage of  virus technology  is characterized
  514. with  the  complexity  of  virus  search,  identification  and
  515. reconstruction. This  tendency to  create complex and sneakily
  516. viruses seems  to be  general. For  example remember  the  XOR
  517. coded 1701  virus group,  the Yankee  Doodle  [5,6]  group  of
  518. viruses (called  also the  TP group  [3]) that  desinfects all
  519. debugged infected files [3,5] and smart Century virus [7], SVC
  520. series that  filters  all  accesses  to  the  directories  and
  521. presents original file size for each infected file.
  522.      The name  of virus  (STARSHIP_1) reveals  the idea of the
  523. author to  extend the series. Be attentive, remember - the use
  524. of backups may save you a vast of time.
  525.  
  526.  
  527.      ACKNOWLEDGEMENTS
  528.  
  529.      I   am   greatly   acknowledged   to   V.V.Snegirev   and
  530. A.G.Yakovlev for  useful discussions.  I also like to thank my
  531. wife Helen for her understanding and support.
  532.      I am aknowledged to Vesselin Bontchev, who read the draft
  533. variant of the paper and made many valuable comments.
  534.      I  also  wish  to  acknowledge  the  sponsorship  of  NPO
  535. "POLITON" (Moscow, USSR).
  536.  
  537.      REFERENCES
  538.  
  539. [1]  Dewdney A.K.,     In the  game called  Core  War  hostile
  540.      programs  engage   in  a   battle  of   bits,  Scientific
  541.      American, v.250,  5 (1984) 15-19.
  542. [2]  Cohen F.,     Computer viruses:  theory and  experiments,
  543.      Proc. 2nd  IFIP Int.  Conf. on  Computer Security, (1984)
  544.      143-158.
  545. [3]  Bezrukov N.N.,     Computer virusology. Part 1: Main work
  546.      principles, classification  and catalog of viruses in DOS
  547.      operating system,  Edition 3.6, date 18.07.1990. (In soft
  548.      form : files of 745 kbytes total size, 250p. in Russian).
  549. [4]   McBroom V.,     Computer viruses:  what they are, how to
  550.      protect against  them,  Software  Protection,  v.VIII,  3
  551.      (1989) 1-16.
  552. [5]  Documentation to  VIRUSCAN software  package from  McAfee
  553.      Assosiates. Version 4.3V66. File-SCANV66.DOC, size-38024.
  554. [6]  McAfee J.,     The virus cure, Datamation, v.35, 4 (1989)
  555.      29-40.
  556. [7]  Documentation to  Turbo Anti-Virus  software package from
  557.      CARMEL  Software   Engineering.  Version   6.80A.   File-
  558.      README.DOC, size-65566.
  559. ==================================================================
  560.  
  561. Table 1. Layout and size of virus procedures.
  562. (the box indicates the encrypted memory section)
  563.  
  564.   Size    Offset (hex)             Description
  565.  
  566.  
  567.     3%    000 - 04F      Variables and buffers (see Fig.1)
  568.     5%    050 - 0C1      Interrupt 13h handler
  569.    10%    0C2 - 1C7      Interrupt 21h handler
  570.    11%    1C8 - 312      Active part & check for DOS ready
  571.     2%    313 - 340      Random number generator (RND)
  572.     7%    341 - 3F7      Interrupts 20h, 21h, 27h handlers
  573.  +--- encrypted --------------------------------------------+
  574.  | 25%    3F8 - 692      Infector of EXE/COM file includes: |
  575.  |     9%      3F8 - 4DD      input logic                   |
  576.  |    10%      4DE - 5E9      create infected code          |
  577.  |     6%      5EA - 692      output logic                  |
  578.  |  3%    693 - 6E5      Tables                             |
  579.  |  3%    6E6 - 738      Startup code for EXE/COM           |
  580.  | 12%    739 - 88F      Infect disk                        |
  581.  |  2%    891 - 8BF      Interrupt 01h handler (trace)      |
  582.  | 11%    8C0 - 9D7      PseudoDOS boot and int B0h handler |
  583.  +----------------------------------------------------------+
  584.     4%    9D8 - A4E      Remover of code from videomemory
  585.     2%    A4F - A8F      Buffers (CS, IP, SS, SP, etc.)
  586.  
  587.  
  588. =======================================================
  589.  
  590. Table 2. Minimal and maximal sizes of infected
  591. executable files.
  592.        +-------------+------------------------+
  593.        |  File type  |    Minimal   Maximal   |
  594.        |             |    size      size      |
  595.        +-------------+------------------------+
  596.        |             |                        |
  597.        |   .COM      |    1917      62202     |
  598.        |             |                        |
  599.        |   .EXE      |    1917      512 K     |
  600.        +-------------+------------------------+
  601.  
  602. ==============================================================================
  603.  
  604. Figure 1. Memory block header (M-block) and memory dump of STARSHIP
  605. virus located in core RAM. Virus uses segment 18FB, and its memory
  606. block is at 18F2:0).
  607.  
  608. ------------------- M-memory block containing virus --------------------------
  609.  
  610. 18F2:0000  4D 08 00 B0 00 0A 00 A3-8E 0B A1 0C 00 A3 90 0B   M...............
  611.  
  612.  
  613. ------- PSP of file, which termination caused the virus installation ---------
  614.  
  615. 18F3:0000  CD 20 A3 19 00 9A F0 FE-1D F0 2F 01 0B 18 3C 01   . ......../...<.
  616. 18F3:0010  0B 18 56 05 0B 18 0B 18-01 01 01 00 02 FF FF FF   ..V.............
  617. 18F3:0020  FF FF FF FF FF FF FF FF-FF FF FF FF EE 18 E0 FF   ................
  618. 18F3:0030  00 90 14 00 18 00 F3 18-FF FF FF FF 00 00 00 00   ................
  619. 18F3:0040  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
  620. 18F3:0050  CD 21 CB 00 00 00 00 00-00 00 00 00 00 20 20 20   .!...........
  621. 18F3:0060  20 20 20 20 20 20 20 20-00 00 00 00 00 20 20 20           .....
  622. 18F3:0070  20 20 20 20 20 20 20 20-00 00 00 00 00 00 00 00           ........
  623.  
  624.  
  625. ------------------ Here follows the code of virus (CS=18FB) -----------------
  626.  
  627. 18FB:0000  E9 01 10 4E 0A 00 10 00-00 00 00 00 00 42 3A 5C   ...N.........B:\
  628. 18FB:0010  54 4D 50 5C 44 52 4F 5A-46 49 4C 41 2E 43 4F 4D   TMP\DROZFILA.COM
  629. 18FB:0020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
  630. 18FB:0030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
  631. 18FB:0040  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 FF   ................
  632. 18FB:0050  E9 93 06 3E 53 54 41 52-53 48 49 50 5F 31 3C 80   ...>STARSHIP_1<.
  633. 18FB:0060  FA 80 75 41 83 F9 01 75-3F 0A F6 75 38 80 FC 02   ..uA...u?..u8...
  634. 18FB:0070  75 29 1E 50 E8 13 03 58-9C FF 1E B8 04 1F 72 18   u).P...X......r.
  635. 18FB:0080  50 56 72 16 B8 01 00 BE-BE 01 26 89 40 02 B0 01   PVr.......&.@...
  636. 18FB:0090  26 88 40 01 5E 58 F8 FB-EB 7C 3C 80 FC 03 74 F6   &.@.^X...|<...t.
  637. 18FB:00A0  80 FC 05 74 F1 E9 3E 01-80 FE 08 75 F8 51 02 C8   ...t..>....u.Q..
  638. 18FB:00B0  80 F9 CC 59 72 EF 80 FD-FE 72 EA 80 FC 02 74 D6   ...Yr....r....t.
  639. 18FB:00C0  75 D9 FF F1 E8 9C 2E 80-3E 4F 00 00 75 18 50 1E   u.......>O..u.P.
  640. 18FB:00D0  8C C8 2D 09 00 E8 A9 02-A1 3C 00 48 E8 A2 02 2E   ..-......<.H....
  641. 18FB:00E0  F6 16 4F 00 1F 58 80 FC-3C 75 31 2E 83 3E 0B 00   ..O..X..<u1..>..
  642. 18FB:00F0  00 75 6E E8 6E 00 75 69-9D E8 CC 00 72 18 50 51   .un.n.ui....r.PQ
  643.  
  644.  
  645. ==================================================================
  646.  
  647. Figure 2. Dump of pseudoDOS boot sector
  648. (thin line denotes random garbage).
  649.  
  650.    0000  EB 34 90 4D 53 BF 05 00-CD 13 73 09 32 E4 CD 13   .4.MS.....s.2...
  651.    0010  4F 75 F5 CD 18 C3 B9 01-00 E8 E9 FF 80 3E 00 7E   Ou...........>.~
  652.    0020  EB 75 10 A0 02 7E BB 00-7E E8 97 00 0A E4 74 03   .u...~..~.....t.
  653.    0030  80 EF 02 06 53 CB FA 33-C0 8E D0 BC 00 7C 8B F4   ....S..3.....|..
  654.    0040  8E C0 8E D8 FB FC BF 00-06 B9 00 01 F3 A5 EA 53   ...............S
  655.    0050  06 00 00 B9 37 00 BE D6-06 BF C0 02 F3 A4 BF B0   ....7...........
  656.    0060  04 B9 08 00 F3 A4 1E C5-06 4C 00 AB 8C D8 AB 1F   .........L......
  657.    0070  FE 06 FC 7D A1 FC 7D B9-CC FE BB 00 7C BA 80 08   ...}..}.....|...
  658.    0080  0A C0 74 08 50 B8 01 03-E8 7A FF 58 41 89 0E DB   ..t.P....z.XA...
  659.    0090  02 88 36 DF 02 06 BB 00-BB 8E C3 88 26 E7 02 CD   ..6.........&...
  660.    00A0  B0 26 A2 63 01 26 8C 1E-C2 00 07 FA C7 06 4C 00   .&.c.&........L.
  661.    00B0  B0 04 8C 1E 4E 00 FB BB-00 7C B8 06 02 BA 80 00   ....N....|......
  662.    00C0  E9 53 FF 53 51 B9 0A 0A-32 E4 26 30 07 26 02 27   .S.SQ...2.&0.&.'
  663.    00D0  43 E2 F7 59 5B C3 C4 02-00 00 50 06 53 B8 00 BB   C..Y[.....P.S...
  664.    00E0  8E C0 BB 50 00 26 80 3F-E9 74 1E 52 51 B8 05 02   ...P.&.?.t.RQ...
  665.    00F0  B9 00 00 BA 80 00 9C 2E-FF 1E B8 04 B0 00 B9 0A   ................
  666.    0100  0A 26 30 07 43 E2 FA 59-5A 5B 07 58 CF CD B0 9A   .&0.C..YZ[.X....
  667.                        +--------------------------------+
  668.    0110  5F 00 00 BB EA|1E 0E 1F-8E C0 33 FF 50 FC 32 C0|  _.........3.P.2.
  669.   +--------------------+                                |
  670.   |0120  B9 50 00 F3 AA E8 F6 F7-8B F7 B9 0A 0A F3 A4 E8|  .P..............
  671.   |0130  98 F9 58 FA A3 B5 04 A3-C1 04 B8 90 90 A3 B0 04|  ..X.............
  672.   |0140  A3 BC 04 C7 06 BF 04 C5-00 B8 EB 05 A3 C8 04 B8|  ................
  673.   |0150  EB F4 A3 D4 04 BF CA 04-BE DB 04 06 1E 07 A5 A5|  ................
  674.   |0160  A4 FB A3 D9 04 A3 C8 02-C7 06 E0 02 CD 13 C7 06|  ................
  675.   |0170  E2 02 EB 0D FE 06 D9 02-CD B0 B9 37 00 BF C0 02|  ...........7....
  676.   |0180  1E 07 8C D8 F3 AA 07 1F-C3 B4 62 E8 7A F7 C3 90|  ..........b.z...
  677.   |0190  90 90 90 90 90 90 90 90-90 90 A4 4B 4C EA A6 8C|  ...........KL...
  678.   |01A0  BE 23 54 F4 BC E8 B8 6B-5B F1 B2 EC B2 81 5E F6|  .#T....k[.....^.
  679.   |01B0  88 D0 8C BC 64 CC 8E CC-86 69 6A C2 84 C8 80 6F|  ....d....ij....o
  680.   |01C0  FA 2B C0 8E D0 8E C0 8E-D8 B8 00 7C 8B E0 FB 8B|  .+.........|....
  681.   |01D0  F0 BF 00 7E FC B9 00 01-F3 A5 E9 00 02 B9 10 00|  ...~............
  682.   |01E0  8B 36 85 7E F6 04 80 75-08 83 EE 10 E2 F6 EB 37|  .6.~...u.......7
  683.   |                                   +-----------------+
  684.   |01F0  90 BF BE 07 57 B9 08 00-F3 A5|74 91 05 AD 55 AA   ....W.....t...U.
  685.   +-----------------------------------+
  686.  
  687. ==================================================================
  688. Figure 3. Dispatcher code located at absolute address 0:4B0.
  689.  
  690.  
  691.  
  692.         a) virus code located in videomemory
  693.  
  694. 0000:04B0  CD B0              INT  B0        <== int 13h
  695. 0000:04B2  9A 5F 00 00 BB     CALL BB00:005F
  696. 0000:04B7  EA 3D A3 00 F0     JMP  F000:A33D
  697.  
  698. 0000:04BC  CD B0              INT  B0        <== int 21h
  699. 0000:04BE  9A D6 03 00 BB     CALL BB00:03D6
  700. 0000:04C3  EA 60 14 73 02     JMP  0273:1460
  701.  
  702. 0000:04C8  CD B0              INT  B0        <== int 20h
  703. 0000:04CA  9A DD 03 00 BB     CALL BB00:03DD
  704. 0000:04CF  EA 3F 14 73 02     JMP  0273:143F
  705.  
  706. 0000:04D4  CD B0              INT  B0        <== int 27h
  707. 0000:04D6  9A 93 03 00 BB     CALL BB00:0393
  708. 0000:04DB  EA 66 63 73 02     JMP  0273:6366
  709.  
  710.  
  711.  
  712.         b) after removing of code from videomemory
  713.            (segment CS=18FB is where virus resides)
  714.  
  715.  
  716. 0000:04B0  90                 NOP            <== int 13h
  717. 0000:04B1  90                 NOP
  718. 0000:04B2  9A 5F 00 6D 19     CALL 18FB:005F
  719. 0000:04B7  EA 3D A3 00 F0     JMP  F000:A33D
  720.  
  721. 0000:04BC  90                 NOP            <== int 21h
  722. 0000:04BD  90                 NOP
  723. 0000:04BE  9A C5 00 6D 19     CALL 18FB:00C5
  724. 0000:04C3  EA 3D A3 00 F0     JMP  0273:1460
  725.  
  726. 0000:04C8  EB 05              JMP  4CF       <== int 20h
  727. 0000:04CA  EA 3F 14 73 02     JMP  0273:143F
  728. 0000:04CF  EA 66 63 73 02     JMP  0273:6366
  729. 0000:04D4  EB F4              JMP  4CA       <== int 27h
  730.  
  731. ===============================================================
  732. All  corrections and  remarks will be greatly appreciated. Send
  733. information directly via E-mail address (MIG@politon.msk.su) or
  734. in  comp.virus group of USENET (I am monitoring it permanently).
  735.  
  736. F   .rs mbyt-  tF   .rs mbyt-  tF   .  (What is this? -Ed.)
  737.  
  738. Downloaded From P-80 International Information Systems 304-744-2253
  739.