ClamAV学习【7】——病毒库文件格式学习

搜查到一份详细的ClamAV病毒文件格式资料(http://download.csdn.net/detail/betabin/4215909),英文版,国内这资料不多的感觉。

重点看了下有关PE的病毒文件格式,就是*.mdb文件。还有之前郁闷用途的*.cvd文件。

就粘贴下刚刚的一点笔记:

1、介绍
CVD的前512bytes是其文件头,格式如下:
ClamAV-VDB:build time:version:number of signatures:functionality
level required:MD5 checksum:digital signature:builder name:build
time (sec)
2、保存脱壳后的签名,这样可以预防用其它壳
3、签名格式
3.1、MD5
最简单的方法,比较适用于静态malware。*.hdb文件,可以包含任意数量的签名,是最简单的数据库文件。

放在share/clamav下可以自动加载。用哈希签名要注意,只要遇到有一个byte不同,就会停止匹配。
3.2、PE section based的MD5
.mdb文件,格式如下:
PESectionSize:MD5:MalwareName
(貌似ClamAV的PE查杀就是用这种签名查杀)
3.3、Body-based的签名
ClamAV用十六进制的格式存储所有的body-based签名。可以用不同的wildcards拓展。wildcards直接拷贝来如下:
 ??
Match any byte.
 a?
Match a high nibble (the four high bits).
IMPORTANT NOTE: The nibble matching is only available in libclamav
with the functionality level 17 and higher therefore please only use
it with .ndb signatures followed by ”:17” (MinEngineFunctionalityLevel,
see 3.3.5).
 ?a
Match a low nibble (the four low bits).
 *
Match any number of bytes.
 {n}
Match n bytes.
 {-n}
Match n or less bytes.
 {n-}
Match n or more bytes.
 {n-m}
Match between n and m bytes (m > n).
 (aa|bb|cc|..)
Match aa or bb or cc..
 !(aa|bb|cc|..)
Match any byte except aa and bb and cc.. (ClamAV0.96)
 HEXSIG[x-y]aa or aa[x-y]HEXSIG
Match aa anchored to a hex-signature, see https://wwws.clamav.NET/
bugzilla/show_bug.cgi?id=776 for discussion and examples.
 (B)
Match word boundary (including file boundaries).
 (L)
Match CR, CRLF or file boundaries.
在*.db文件中,简单的签名格式如下:
MalwareName=HexSignature
当然,也有拓展的签名格式,就是有附加信息的。在*.ndb文件中格式如下:
MalwareName:TargetType:Offset:HexSignature[:MinFL:[MaxFL]]
还有逻辑签名,在*.ldb文件中,格式如下,
SignatureName;TargetDescriptionBlock;LogicalExpression;Subsig0;
Subsig1;Subsig2;...
其中,逻辑关系描述变量比较有趣,大于小于是匹配次数的比较。
3.4、PE文件的图标签名
0.96出现的一种比较模糊近似的图标签名匹配,在*.idb文件中格式如下:
ICONNAME:GROUP1:GROUP2:ICON_HASH


还有PE文件版本信息元数据签名以及其它的元数据签名。还有针对其它不同类型文件的签名,例如上面的PE文件的,还

原文:http://blog.csdn.net/betabin/article/details/7448447

原文地址:https://www.cnblogs.com/sunylat/p/6393440.html