本文涉及的所有代码和资料:https://github.com/TideSec/GoBypassAV/
0x01 基于API的免杀测试
1.1 介绍
目前基于Go的免杀,很大一部分都是基于已有API来各种姿势的加载shellcode,再加上shellcode的加解密、代码混淆、加壳、条件执行等方法,从而规避杀软的检测。
基于Go的各种加载器也就是为shellcode申请一段内存,然后把指令寄存器指向shellcode的开头,让机器执行这段shellcode,而Go实现这个功能就需要调用windows API了。
https://github.com/TideSec/GoBypassAV/Go_Windows_API
通过对Go免杀的研究,实现了一个在线免杀平台,目前生成x64位的免杀效果尚可,x86的效果一般。
潮影在线免杀平台:http://bypass.tidesec.com/
1.2 测试环境
本文搜集汇总了网上各种基于Go的API代码实现方式,共16种,应该算是比较全面的了,逐一进行了免杀测试。
go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-w -s"
https://github.com/TideSec/GoBypassAV/blob/master/Encryption/xor/xor.go
1.3 测试结果
https://virustotal.com/
piiperxyzhttps://github.com/piiperxyz/AniYa
0x02 不同API的免杀测试情况
2.00 HelloTide测试(VT免杀率7/70)
helloTide-race-race
2.01 CreateFiber(VT免杀率18/70)
核心代码
2.02 CreateProcessWithPipe(VT免杀率8/70)
核心代码
2.03 CreateRemoteThread(VT免杀率8/70)
核心代码
2.04 CreateRemoteThreadEx(VT免杀率9/70)
核心代码
2.05 CreateThread(VT免杀率8/70)
核心代码
2.06 CreateThreadNative(VT免杀率8/69)
核心代码
2.07 CreatProcess(VT免杀率8/70)
核心代码
2.08 EarlyBird(VT免杀率6/69)
核心代码
2.09 EtwpCreateEtwThread(VT免杀率9/70)
核心代码
2.10 HeapAlloc(VT免杀率18/70)
核心代码
2.11 NtQueueApcThreadEx(VT免杀率9/70)
核心代码
2.12 ProcCryptProtectMemory(VT免杀率18/70)
核心代码
2.13 RtlCreateUserThread(VT免杀率8/69)
核心代码
2.14 RtlMoveMemory(VT免杀率17/70)
核心代码
2.15 SyscallUnsafe(VT免杀率16/70)
核心代码
2.16 UuidFromString(VT免杀率19/70)
核心代码
0x03 测试小结
发现在使用GO进行免杀时,单纯使用API时有的效果还可以,但兼容性稳定性不一定好,而兼容性好使用较多的免杀效果又比较一般。
https://github.com/brimstone/go-shellcode2.15 SyscallUnsafe
所以要想得到更好的免杀效果,还是要多种方式结合,下篇文章将总结一下Golang免杀的常见方式。多种方式结合,将会有更好的免杀效果。
0x04 参考资料
本文内容参考节选自以下资料:
https://github.com/Ne0nd0g/go-shellcode
https://github.com/safe6Sec/GolangBypassAV
https://blog.z3ratu1.cn/windows免杀入门.htm
https://github.com/piiperxyz/AniYa
https://xz.aliyun.com/t/11279