Install Clamav And Create SignaturesStep1: Install clamav in ubuntu by following simple steps given below:
Edit /etc/apt/sources.list and add a line like this to it:
deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
Then run apt-get update && apt-get install clamav
If you need clamd, you may also want to run apt-get install clamav-daemon
Step2:CVD (ClamAV Virus Database) is a digitally signed container that includes signature databases in various text formats. The header of the container is a 512 bytes long string with colon separated fields: ClamAV-VDB:build time:version:number of signatures:functionalitylevel required:MD5 checksum:digital signature:builder name:build time (sec)
sigtool --info displays detailed information about a given CVD file:
MD5 The easiest way to create signatures for ClamAV is to use MD5 checksums, however this method can be only used against static malware.
MD5, PE section based You can create aMD5 signature for a specific section in a PE file. Such signatures shall be stored inside .mdb files in the following format:
The easiest way to generate MD5 based section signatures is to extract target PE sections into separate files and then run sigtool with the option --mdb
Body-based signatures ClamAV stores all body-based signatures in a hexadecimal format. In this section by a hex-signature we mean a fragment of malware’s body converted into a hexadecimal string which can be additionally extended using various wildcards
Hexadecimal format You can use sigtool --hex-dump to convert any data into a hex-string
Basic signature format The simplest (and now deprecated) signature format is:
ClamAV will scan the entire file looking for HexSignature. All signatures of this type must be placed inside *.db files.
Extended signature format The extended signature format allows for specification of additional information such as a target file type, virus offset or engine version, making the detection more reliable. The format is: MalwareName:TargetType:Offset:HexSignature[:MinFL:[MaxFL]]
where TargetType is one of the following numbers specifying the type of the target file:
• 0 = any file
• 1 = Portable Executable, both 32- and 64-bit.
• 2 = file inside OLE2 container (e.g. image, embedded executable, VBAscript). The OLE2 format is primarily used by MS Office and MSI installation files.
• 4 = Mail file
• 5 = Graphics
• 6 = ELF
• 7 = ASCII text file (normalized)
• 8 = Unused
• 9 = Mach-O files
And Offset is an asterisk or a decimal number n possibly combined with a special
• * = any
• n = absolute offset
• EOF-n = end of file minus n bytes
Signatures for PE, ELF and Mach-O files additionally support:
• EP+n = entry point plus n bytes (EP+0 for EP)
• EP-n = entry point minus n bytes
• Sx+n = start of section x’s (counted from 0) data plus n bytes
• Sx-n = start of section x’s data minus n bytes
• SL+n = start of last section plus n bytes
• SL-n = start of last section minus n bytes
Step3: Bring in our malicious exe and perform clamav scan:
Step 4:Now we can also create our own custom signature by simply creating a hash and using it as signature.
The easiest way to create signatures for ClamAV is to use MD5 checksums, however this method can be only used against static malware.