Nimcrypt2 是另一个旨在绕过 AV/EDR 的 PE 打包器/加载器。它是对我原始 Nimcrypt 项目的改进,主要改进包括使用直接系统调用以及能够加载常规 PE 文件和原始 Shellcode。
在进一步介绍之前,我必须感谢为本项目做出绝大部分工作和研究的那些人。首先,我要感谢 @byt3bl33d3r 的 Offensive Nim 仓库,以及 @ShitSecure 公开发布的所有代码片段。这个工具的原版就是基于这些创建的,当前版本也不例外。特别是,本工具中使用的新 PE 加载功能只是实现了 ShitSecure 最近发布的 Nim-RunPE 代码。截至 2022 年 3 月 14 日,该代码还使用了他的 GetSyscallStub 代码来实现动态系统调用。我强烈建议赞助他以获得他自己的 Nim PE Packer,毫无疑问那是一个更好、功能更丰富的版本。
此外,我要感谢 @ajpc500 的 NimlineWhispers2 项目,本工具使用它来进行直接系统调用。我无论如何强调都不为过:这个项目仅仅是前述人员公开工作的集合体,因此所有功劳都应归于他们。
___
.-' `'.
/ \
| ;
| | ___.--,
_.._ |0) ~ (0) | _.---'`__.-( (_.
__.--'`_.. '.__.\ '--. \_.-' ,.--'` `""`
( ,.--'` ',__ /./; ;, '.__.'` __
_`) ) .---.__.' / | |\ \__..--"" ""'--.,_
`---' .'.''-._.-'`_./ /\ '. \ _.-~~~````~~~-._`-.__.'
| | .' _.-' | | \ \ '. `~---`
\ \/ .' \ \ '. '-._)
\/ / \ \ `=.__`~-. Nimcrypt v2
jgs / /\ `) ) / / `"".`\
, _.-'.'\ \ / / ( ( / / 3-in-1 C#, PE, & Raw Shellcode Loader
`--~` ) ) .-'.' '.'. | (
(/` ( (` ) ) '-;
` '-; (-'
Nimcrypt v 2.0
Usage:
nimcrypt -f file_to_load -t csharp/raw/pe [-o <output>] [-p <process>] [-n] [-u] [-s] [-e] [-g] [-l] [-v] [--no-ppid-spoof]
nimcrypt (-h | --help)
Options:
-h --help Show this screen.
--version Show version.
-f --file filename File to load
-t --type filetype Type of file (csharp, raw, or pe)
-p --process process Name of process for shellcode injection
-o --output filename Filename for compiled exe
-u --unhook Unhook ntdll.dll
-v --verbose Enable verbose messages during execution
-e --encrypt-strings Encrypt strings using the strenc module
-g --get-syscallstub Use GetSyscallStub instead of NimlineWhispers2
-l --llvm-obfuscator Use Obfuscator-LLVM to compile binary
-n --no-randomization Disable syscall name randomization
-s --no-sandbox Disable sandbox checks
--no-ppid-spoof Disable PPID Spoofing
Nimcrypt2 设计用于安装了 Nim 的 Linux 系统。在安装 Nim 之前,必须确保已通过包管理器安装了以下包:
sudo apt install gcc mingw-w64 xz-utils git
我倾向于使用 choosenim 来安装 Nim,方法如下:
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
echo "export PATH=$HOME/.nimble/bin:$PATH" >> ~/.bashrc
export PATH=$HOME/.nimble/bin:$PATH
Nimcrypt2 还依赖一些可通过 Nimble 安装的包。可以这样安装:
nimble install winim nimcrypto docopt ptr_math strenc
安装完所有依赖后,可以按如下方式编译 Nimcrypt2:
nim c -d=release --cc:gcc --embedsrc=on --hints=on --app=console --cpu=amd64 --out=nimcrypt nimcrypt.nim
可选: 要使用 Obfuscator-LLVM 标志,系统上必须同时安装 Obfuscator-LLVM 和 wclang。我发现这有点麻烦,但只要有毅力应该可以做到。以下是在我的 Kali Linux 系统上有效的快速步骤指南:
此外,必须将以下行添加到 nim.cfg 文件中,以让 Nim 指向你的 wclang 二进制文件:
amd64.windows.clang.exe = "x86_64-w64-mingw32-clang"
amd64.windows.clang.linkerexe = "x86_64-w64-mingw32-clang"
amd64.windows.clang.cpp.exe = "x86_64-w64-mingw32-clang++"
amd64.windows.clang.cpp.linkerexe = "x86_64-w64-mingw32-clang++"
可能有更好的方法,但这对我是有效的。如果遇到问题,请继续尝试,确保 x86_64-w64-mingw32-clang -v 命令的输出中显示 "Obfuscator-LLVM"。还要确保 MinGW 使用 Obfuscator-LLVM 库文件:否则 Nim 会报错。