Skip to main content

Clamav Tutorial

Install Clamav And Create Signatures 
Step1: 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:

Signature formats:
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:
PESectionSize:MD5:MalwareName 
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:
MalwareName=HexSignature 
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.
• 3 = HTML (normalized: whitespace transformed to spaces, tags/tag attributes normalized, all lowercase), Javascript is normalized too: all strings are normalized (hex encoding is decoded), numbers are parsed and normalized,local variables/function names are normalized to ’n001’ format, argument to eval() is parsed as JS again, unescape() is handled, some simple JS packers are handled, output is whitespace normalized.
• 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
modifier:
• * = 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.

Comments

Popular posts from this blog

Hacking Windows 10 UWP App: DLL Injection & common Vulnerabilities

I recently started working on  widows 10 Apps( Apps not Applications) security. Before diving deep in hacking terms lets try to understand what's new in Windows 10 UWP( Universal Platform) as compared to old Apps. Lets begin with how apps actually work on windows 10(desktop/tablet). Now windows 10 comes with a container only for running apps inside the isolated environment. By default, /APPCONTAINER(Linker Flag) is off. This option modifies an executable to indicate whether the app must be run in the appcontainer process-isolation environment. Specify /APPCONTAINER for an app that must run in the appcontainer environment—for example, a Windows Store app. (The option is set automatically in Visual Studio when you create a Windows Store app from a template.) For a desktop app, specify /APPCONTAINER:NO or just omit the option. The /APPCONTAINER option was introduced in Windows 8. Now there is no registry entry concept for these app in the System HIVE rather they install they own hiv

Installing vmware-11.0 on Ubuntu 15.04 Using kernel Patch

curl http://pastie.org/pastes/9934018/download -o /tmp/vmnet-3.19.patch cd /usr/lib/vmware/modules/source tar -xf vmnet.tar patch -p0 -i /tmp/vmnet-3.19.patch tar -cf vmnet.tar vmnet-only rm -r *-only vmware-modconfig --console --install-all References: http://askubuntu.com/questions/605530/vmware-player-7-1-0-on-ubuntu-15-04-kernel-3-19-0-10-generic-app-loading http://askubuntu.com/questions/617704/failed-to-build-vmnet-for-kernel-3-19

SSI Injection Attack

SSIs are directives present on Web applications used to feed an HTML page with dynamic contents. They are similar to CGIs, except that SSIs are used to execute some actions before the current page is loaded or while the page is being visualized. In order to do so, the web server analyzes SSI before supplying the page to the user. The Server-Side Includes attack allows the exploitation of a web application by injecting scripts in HTML pages or executing arbitrary codes remotely. It can be exploited through manipulation of SSI in use in the application or force its use through user input fields. It is possible to check if the application is properly validating input fields data by inserting characters that are used in SSI directives, like:  Code: < ! # = / . " - > and [a-zA-Z0-9] Another way to discover if the application is vulnerable is to verify the presence of pages with extension .stm, .shtm and .shtml. However, the lack of these type of pages does not mean that th