如何创建我自己的 .exe 或 .lib 文件病毒签名?我开始将某些字节读取到文件中,然后将它们存储在另一个文件中,然后手动将其添加到病毒扫描程序中。这行得通吗?谢谢
创建文件签名的方法有很多种,最简单也是最容易的方法之一是采用哈希函数(例如 SHA1),并对整个文件运行它。
基本上,您需要找到使其独一无二的字节序列,反病毒公司花费大量时间来分析行为、训练并找到独特的东西。防病毒应用程序读取二进制文件以查找字节模式
请阅读卡巴斯基的防病毒基础知识:病毒、签名、杀毒
要从基本开始,您需要创建/维护一个十六进制表,其中签名是唯一列,后跟名称、类型。并读取计算机中的文件并尝试与十六进制数据库表进行匹配。
现在如何保持它的唯一性,因为很难自己分析每个
.exe
来获得签名。如此处所述,请阅读创建防病毒签名简介
在此处查找什么是
yara
引擎和规则 virustotal.github.io/yara/ 以及 VirusTotal 如何使用它来创建 AV 签名,然后查看规则 yararules.com 。像 yaraeditor 这样的工具很少 帮助你,但通过谷歌你可以找到更多。
然后您可以使用开源防病毒软件,例如 ClamAV github.com/Cisco-Talos/clamav-devel 并使用它来达到目的。
Comodo 有一个病毒签名列表可供检查,网址为 https://www.comodo.com/home/internet-security/updates/vdp/database.php 哈希的伪代码:
hook.appLaunch((PortableExecutable *this) {
if(blacklist.hashes.has(Sha2(this->hex)) {
abort();
} else if(whitelist.hashes.has(Sha2(this->hex)) {
original_appLaunch(this);
} else {
submitForManualAnalysis(this);
abort();
}
});
签名伪代码:
hook.appLaunch((PortableExecutable *this) {
foreach(blacklist.signatures as sig) {
if(strstr(sig, this->hex)) { /*strstr is for text, and hex uses more space than binary, so you should produce a binary-mode-compatible version of strstr() for this*/
abort();
} else {
original_applaunch(this);
}
});
融合签名+哈希分析的伪代码:
hook.appLaunch((PortableExecutable *this) {
if(blacklist.hashes.has(Sha2(this->hex)) {
abort();
} else if(whitelist.hashes.has(Sha2(this)) {
launchthis(this);
} else {
foreach(blacklist.signatures as sig) {
if(strstr(sig, this->hex)) { /*strstr is for text, you must produce a binary-mode-compatible version of strstr() for this*/
blacklist.hashes.pushback(Sha2(this->hex));
abort();
}
}
whitelist.hashes.pushback(Sha2(this->hex));
original_appLaunch(this);
}
});
哈希值和签名是病毒分析工具最基本的形式,