#C2远控-ShellCode-认知&环境
1.创建工程时关闭SDL检查
2.属性->C/C++->代码生成->运行库->多线程 (/MT)如果是debug则设置成MTD
3.属性->C/C++->代码生成->禁用安全检查GS
4.关闭生成清单 属性->链接器->清单文件->生成清单 选择否
#C2远控-ShellCode-分析&提取
ShellCode的本质其实就是一段可以自主运行的代码。
它没有任何文件结构,它不依赖任何编译环境,无法像exe一样双击运行,
因此需要通过控制程序流程跳转到shellcode地址加载上去执行shellcode。
目的:杀毒和感知平台如何定性
分析:OD&xdb&ida
提取:010Editor
加载:各种Loader方法执行
流程:ShellCode->Loader->EXE
思路:
1、Shellcode自写打乱-让杀毒不认识
2、Shellcode加密混淆-让杀毒不知道
3、Shellcode分离隐藏-让杀毒找不到
4、Shellcode注入回调-让杀毒绕圈圈
内存免杀是将shellcode直接加载进内存,由于没有文件落地,因此可以绕过文件扫描策略的查杀。为了使内存免杀的效果更好,在申请内存时一般采用渐进式申请一块可读写内存,在运行时改为可执行,在执行的时候遵循分离免杀的思想。分离免杀包含对特征和行为的分离两个维度,把shellcode从放在程序转移到加载进内存,把整块的ShellCode通过分块传输的方法上传然后再拼接,这些体现了基本的"分离"思想。
补充:
编辑器设置 VS
https://mp.weixin.qq.com/s/UJlVvagNjmy9E-B-XjBHyw
编译器差异 G++ GCC
https://blog.csdn.net/weixin_41012767/article/details/129365597
突破内存扫描
项目参考:https://github.com/wangfly-me/LoaderFly
360开启核晶(Vmware)
https://blog.csdn.net/fishfishfishman/article/details/134156418
对抗杀毒和感知云沙箱
常见沙盒沙箱检测技术
常见调试分析检测技术
https://github.com/a0rtega/pafish/
https://github.com/Arvanaghi/CheckPlease
https://github.com/wanttobeno/AntiDebuggers
https://github.com/LordNoteworthy/al-khaser
https://github.com/ZanderChang/anti-sandbox
https://github.com/nek0YanSu/CheckVM-Sandbox
https://github.com/sunn1day/malware-anti-techniques
https://bbs.kanxue.com/thread-225740.htm
https://anti-debug.checkpoint.com/techniques/debug-flags.html
Set-ExecutionPolicy Restricted
(1) 本地读取并以管道符运行
powershell Get-Content HelloWorld.ps1 | powershell -NoProfile -
(2) Bypass执行策略绕过
powershell -ExecutionPolicy bypass -File HelloWorld.ps1
(3) Unrestricted执行策略标志
powershell -ExecutionPolicy unrestricted -File HelloWorld.ps1
参考:
https://github.com/INotGreen/Bypass-AMSI
https://mp.weixin.qq.com/s/oJ8eHdX8HGuk6dZv0kmFxg
https://kyxiaxiang.github.io/2022/12/14/AMSIandEtw
https://github.com/S3cur3Th1sSh1t/Amsi-Bypass-Powershell
1、Go开发环境搭建
go安装
https://go.dev/dl/
goland安装
https://www.jetbrains.com/go/download/
proxy环境变量
https://goproxy.io/zh/docs/getting-started.html
go run
go build
网上给到的Go loader直接被秒的
处理:
1、处理EXE火商值,加签名和资源保护
2、在Go代码中换加载逻辑代码(Go开发)
2、Rust开发环境搭建
https://www.rust-lang.org/tools/install
cargo help
cargo run
cargo build
cargo build --release
参考Loader加载器:
https://github.com/b1nhack/rust-shellcode
https://github.com/Pizz33/GobypassAV-shellcode
https://github.com/colind0pe/AV-Bypass-Learning
3、Nim(后续)
https://ziglang.org/download/
4、Zig(后续)
https://nim-lang.org/install_windows.htm