home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / utils / antivir2.zip / HDSENTRY.DOC < prev    next >
Text File  |  1987-07-22  |  7KB  |  141 lines

  1.       HDSENTRY - HARD DISK PROTECTION FROM TROJAN PROGRAMS
  2.               (c) Copyright 1987 by Andrew M. Fried
  3.  
  4. Every day, thousands of free programs are downloaded from  public
  5. bulletin  board systems throughout the world.  While  the  system
  6. itself is generally owned and operated by an individual, much  of
  7. the contents of the BBS come from the public domain.
  8.  
  9. The system operators of these bulletin boards, or sysops as  they
  10. are affectionately called, rely on their callers for new material
  11. that could be of interest to others.  Some of the stuff  uploaded
  12. by  users include technical articles, software  reviews,  program
  13. patches,  unprotects (ways to crack copy protection),  pleas  for
  14. assistance and, of course, software.
  15.  
  16. A problem has recently surfaced concerning the software  uploaded
  17. to  these  systems.  Every once in a while,  a  program  surfaces
  18. that, when run, maliciously attacks the systems hard disk.  Since
  19. these  programs  are  often disguised, they are  referred  to  as
  20. 'trojan' programs.
  21.  
  22. HDSENTRY was written at the request of a friend of mine (who also
  23. happens  to  be  a sysop). During the past  few  months,  several
  24. 'trojan'  programs have been uploaded to his BBS.  He asked if  a
  25. simple  program could be developed which would insulate the  hard
  26. disk from the rest of the system.  Thus, HDSENTRY was born.
  27.  
  28. HDSENTRY  will  enable you to run any program on a  floppy  drive
  29. undisturbed. This will permit you to 'test' an unknown program on
  30. a  floppy disk without fears that it will jump over to your  hard
  31. disk and "eat it up". The program running on the floppy may  even
  32. make  calls to the fixed disk so long as the calls do not pose  a
  33. threat  to the system.
  34.  
  35. HDSENTRY will prevent most programs from accessing the hard  disk
  36. for  any type of destructive call. Nondestructive calls  such  as
  37. reading  or  resetting the drive are  permitted;  formatting  and
  38. writing  to  the disk are trapped and  prevented  from  occuring.
  39. Interrupt  26h,  the  absolute  disk  write  interrupt,  is  also
  40. effectively removed from the system by this program.
  41.  
  42. The  only way to bypass HDSENTRY's protection scheme would be  to
  43. write  directly  to the ports of the fixed  disk  controller  and
  44. manipulate the disk with the aid of DOS or ROM BIOS.  This is  no
  45. simple task; only a very experienced and knowledgeable programmer
  46. could  do  this. It is my belief that anyone  that  sophisticated
  47. would not be spending their time writing vandalous programs.
  48.  
  49.  
  50. CALLING THE PROGRAM
  51. -------------------
  52. The  program  is  called without any  extensions  or  arguements.
  53. Simple  type  'HDSENTRY' at the DOS prompt.  HDSENTRY  will  load
  54. itself  and remain resident in memory (programs such as this  are
  55. often  referred  to  as  TSR or  "terminate  and  stay  resident"
  56. programs).
  57.  
  58.  
  59. PROTECTION
  60. ----------
  61. Once  HDSENTRY  is run, interrupt vector 13h  (the  diskette  and
  62. fixed disk interrupt handler) and interrupt vector 26h  (absolute
  63. disk  write  interrupt) are changed to point to  routines  inside
  64. HDSENTRY. Any subsequent calls to interrupt 26h will be ignored.
  65.  
  66. Calls made to interrupt 13h are first checked to see if they  are
  67. accessing  the fixed disk or the floppy. If the floppy  is  being
  68. accessed, HDSENTRY permits the interrupt to continue undisturbed.
  69. If,  on the other hand, one of the fixed disks is the  target  of
  70. the  function call, HDSENTRY checks the interrupt request to  see
  71. if a write or format command has been issued. If so, the  program
  72. flashes an error message on the screen and the program  continues
  73. (unaware  that it did not reach the fixed  disk).  Nondestructive
  74. calls  are permitted, and those requests will be passed onto  the
  75. original interrupt handler for execution.
  76.  
  77.  
  78. Technical Information
  79. ---------------------
  80. HDSENTRY was written in IBM assembly language and designed to  be
  81. used on IBM PC/XT's and PC/AT's.  Systems without a hard disk are
  82. not supported under this version of HDSENTRY.
  83.  
  84. Basically,  HDSENTRY operates by revectoring all of the ROM  BIOS
  85. calls which are responsible for providing direct hardware control
  86. of the systems disk drives.  I am referring to interrupts 13h and
  87. 26h, ofcourse.
  88.  
  89. Once  HDSENTRY  has  been  initialized  in  memory,  all  support
  90. requests for disk services are sent to its handler.
  91. If  HDSENTRY finds that the service call is  requesting  services
  92. from  the  diskette,  the  parameters are  passed  along  to  the
  93. original  interrupt  handler for processing.  If,  on  the  other
  94. hand,  the  call is directed towards a fixed  disk,  the  handler
  95. examines the AH register in order to ascertain what BIOS  service
  96. is being requested.  The possibilities include:
  97.      0 - reset diskette system
  98.      1 - read status of system
  99.      2 - read disk sector
  100.      3 - write to disk sector
  101.      4 - verify desired sector
  102.      5 - format desired track
  103.      8 - read drive parameters
  104.     21 - read dasd type  (AT only)
  105.     22 - disk change line status (AT only)
  106.     23 - set dasd type for format (AT only)
  107.  
  108. If HDSENTRY finds that the call involves either a write or format
  109. command,  a  warning  is displayed and  an  interrupt  return  is
  110. generated.   The original interrupt handler never sees  the  call
  111. and cannot be invoked.
  112.  
  113. One  technical point to mention concerning interrupt 26h is  that
  114. it,  unlike  all  other  interrupts, does  not  perform  a  clean
  115. interrupt return.  Upon return, a word is left in the stack which
  116. must  be removed by the application program making  the  function
  117. request.
  118.  
  119. The  significance of this is that if our program failed to add  a
  120. word  to  the stack before performing an  interrupt  return,  the
  121. offending  program would cause chaos by popping information  from
  122. the  stack  when it shouldn't.  The stack pointer would  get  all
  123. messed   up   and  unpredictable  results  would   occur   almost
  124. immediately.
  125.  
  126.  
  127. Conclusion
  128. ----------
  129. This program should be invoked before running any newly  acquired
  130. software downloaded from a BBS.  It permits you to run a  program
  131. on  your  floppy  disk drive without worrying  that  a  concealed
  132. command will trash your hard disk.  Removing the program once  it
  133. is invoked, however, requires you to reboot the system.
  134.  
  135. The program is a good example of memory resident programming,  as
  136. well.
  137.  
  138. Andrew M. Fried
  139. 895 Cynthia Drive
  140. Titusville, Fla. 32780
  141.