![]() |
![]() | Preparing Your Own Virus Signatures | ![]() |
![]() |
![]() | Preparing Your Own Virus Signatures--2 | ![]() |
GuitarBob
![]() |
![]() |
To continue this informal look at preparing signatures for ClamAV/ClamWin, let us next look at MDB signatures. MDB signatures are an MD5 hash for only one section of a Windows PE file. To get an MDB signature, you have to break up a Windows PE file into sections and get an MD5 file hash for the section that you have picked for the signature. The MDB signature takes this form: bytesize:sectionhash:platform.virustype.virusname. Clam AV will assign a number to the signature. Your hash should use
small letters because Clam AV can not use hashes made with capital letters. Here is a real MDB virus signature: 2048:ac65056031e91d3b1774050ecad68630:Win.Trojan.Ransom. You can see that it is similar to the HDB signature mentioned previously, but the bytesize goes before the file hash this time. You can paste your MDB hash into a Notepad text file named sigfile.mdb and save it to your ClamWin database folder. Then do a manual scan of your sample file with ClamWin to make sure your signature is detected. You can put several MDB signatures each on a separate line in the Notepad file. Keep your signature file for about a week to give Clam AV a chance to process your signature. There are lots of file hasher programs but not very many programs can break up a file into sections and give you a section hash or let you save the section to a file that for which you can get a hash. The dphash program by Dirk Paehl will show the file sections and give you an MD5 section hash, but it will be in capital letters, which Clam AV can not use. I have painted dphash section hashes and copied them to a word processor, then toggled the upper case of the letters to lower case, and then pasted the lower case MD5 hash into a Notepad file for my MDB signatues, but that is very slow and cumbersome. It is much easier to use the Virus Total online scanner, which will show you the section names, sizes (for the total file and for each section) if you look at the File Details provided by Virus Total. You can use Virus Total as the a source for your MDB (or HDB signatures). Just make sure to verify that the file is infected by a virus and that your signature is detected in the file by ClamWin before you submit it to Clam AV. Be careful in selecting the section that you are going to use for your hash. First of all, total up the byte size of all sections of the file and make sure that the total bytesize of all the file sections is close to the total bytesize for the original file. The total bytesize of all sections will usually differ slightly from the total bytesize of the original file--the section total bytesize is usually smaller than the file total bytesize. If the total difference is less than 10K, do not worry about it. If the total difference is more than 10K, get an HDB signature because the difference in size indicates that the file is probably an installer file and is not the real malware file--an HDB signature is best in that case. An MDB signature for an installer file will probably result in a false positive detection for the installer file--as the virus file is not available until the installer runs. As to which section of a file to use for your MDB signature, I suggest that you use the section that has the largest byte size, which is probably the most important section. If you are still not sure which section to use, get the section that is labeled "code" or the section labeled "rsrc." These are standard section names, but some files may not use the standard names. You usually can't go wrong with an MDB signature on the largest file section--except on installer files. Virus writers are lazy, and other viruses may re-use the same section from which you prepared your MDB hash, so your MDB signature may detect them also. An MDB signature is usually better than an HDB signature, which will only detect one version of one file. However, malware can use sections from "good" files, so there can be an occasional false positive detection from an MDB signature, but your false positive rate will be low unless you use an MDB signature for those installer files. Also, do not use sections for your MDB signature that are named for a packer--such as Themida. If you do, your signature will probably be for the packer, which can result in a false positive detection because packers are used by both "good" programmers and malware programmers. If there is any doubt about a signature, get an HDB signature to minimize the possibility of false positives. Please post if you have any questions about preparing your own signatures. Regards, |
|||||||||||
|
![]() |
![]() | Preparing Your Own Virus Signatures-- 3 | ![]() |
GuitarBob
![]() |
![]() |
Part III NDB Entry Point Signatures
NDB signatures are the standard Clam AV virus signatures. To get a NDB signature, you have to open up a file in a debugger, find the portion of the entry point hexadecimal code that you want, and copy it into a signature for Clam AV. The file sections are very large, so I like to copy just the 1st 8 lines (128 bytes) of the entry point section. An NDB entry point signature takes this form: Platform:VirusType.VirusName:SignatureType:FileLocation:HexidecimalSignature. Here is an actual NDB entry point signature: Win.Trojan.FakeAV-59332:1:EP +0:6824114000e8eeffffff000000000000300000004000000000000000f2e84a1d163ae64e9f59673c4e53958b000 00000000001000000442e6261730d416762696e66667972667100795762760000000006000000d0514000070000008 0474000070000003847400001000200dc43400000000000ffffffffffffffff00000000. The platform is Windows, the virus type is a trojan, and the name is FakeAv. Clam AV has already assigned a number after the virus name. The signature type is always 1 for an NDB entry point signature, and the file location is always EP+0--which means the entry point. As usual, put your signature in a Notepad file and name it Sigfile.ndb and save it in the ClamWin DB data folder. Test the signature to make sure it is detected by ClamWin when you scan the infected file before you upload it to Clam AV. To tell whether or not an infected file is a good candidate for an NDB entry point signature, you have to break it up into sections. The size of the code section and the entry point section should be the same, and the total file size should only be 10K or less larger than the size of all sections added together--just like for the MDB signatures. Since malware can obscure the entry point, your signature may not be for the actual entry point, but it will still be a good signature if you follow these guidelines, which will also minimize false positives. If you have gotten this far and are still interested in preparing Clam AV signatures, I can give you some software tools that will make it much easier for you to prepare all signatures--NDB, MDB, and HDB. Send email to: rwsmc at yahoo dot com. Identify yourself in the email, and tell where you are located. You are an exceptional person if you have gotten this far! Regards, |
|||||||||||
|
![]() |
![]() | ![]() |
scanfan
![]() |
![]() |
The path to the database directory is:
%ALLUSERSPROFILE%\.clamwin\db If it's not there, perhaps because you installed for the current user only, try your user profile instead. |
|||||||||||
|
![]() |
![]() | Preparing Your Own Virus Signatures | ![]() |
|
||
![]() |
![]() |
Powered by phpBB © phpBB Group
Design by phpBBStyles.com | Styles Database.
Content © ClamWin Free Antivirus GNU GPL Free Software Open Source Virus Scanner. Free Windows Antivirus. Stay Virus Free with Free Software.
Design by phpBBStyles.com | Styles Database.
Content © ClamWin Free Antivirus GNU GPL Free Software Open Source Virus Scanner. Free Windows Antivirus. Stay Virus Free with Free Software.