Beruflich Dokumente
Kultur Dokumente
Cs609@vu.edu.pk
Lecture # 45
Types of Viruses
• Partition Table Virus
• Boot Sector Virus
• File Viruses
File Viruses
• Various Viruses embeds themselves in different
executable files.
• Theoretically any file that can contain any executable
code, a Virus can be embedded into it. i.e. .COM, .EXE
are executable files so Viruses can be embedded into
them, Plain Text Files, Plain Bitmap Files are pure data
and cannot be executed so Viruses cannot be actively
embedded into them, and even if they are somehow
embedded they will never get a chance to execute itself.
COM File
• COM File is a mirror image of the program code. Its
image on disk is as it is loaded into the memory.
• COM Files are single segment files in which both Code
and Data resides.
• COM File will typically have a Three Bytes Near Jump
Instruction as the first instruction in program which will
transfer the execution to the Code Part of the Program.
jmp code
====
==== ;Data Part
====
code:
====
==== ;Code Part
The following slide illustrates how a COM file virus relocates itself to make itself
independent in memory.
Program
M
PSP
Paras
Virus PSP
Virus
Z Z
Detection
• Viruses can be detected by searching for their Signature
in Memory or Executable Files.
• Signature is a binary subset of Virus Code. It is a part of
Virus Code that is unique for that particular Virus only
and hence can be used to identify the Virus
• Signature for a Virus is selected by choosing a unique
part of its Code. To find a Virus this Code should be
searched in memory and in files. If a match is found then
the system is infected.
Removal
Partition Table & Boot Sector Viruses
• Partition Table and Boot Sector Viruses can be removed
by re-writing the Partition Table or Boot Sector Code.
• If the Virus is resident it may exhibit stealth i.e. prevent
other programs from writing on Partition Table or Boot
Sector by intercepting int 13H
• In case it’s a stealth Virus the system should be booted
from a clean disk will not give the Virus any chance to
execute or load itself.
File Viruses
• If the Virus size is known Viruses can be removed easily from file.
• Firstly, the original value of first 3-bytes in case of COM File or the entry
point in case of EXE should be restored.
• The appended portion of Virus can be removed by coping the contents of
original file into a temporary file.
Program
Virus
•The Virus Code is not copied.
• The original file is then deleted and the temporary file is renamed as the
original file.