SysWhispers3 Documentation

repository·master·Indexed 23 days ago

https://github.com/klezvirus/syswhispers3

A tool that generates C/C++ header and Assembly files to enable direct system calls, allowing developers to bypass user-mode API hooks from security products like AVs and EDRs. It supports multiple architectures (x86, x64), compilers (MSVC, MinGW), and syscall recovery methods including embedded, egg_hunter, jumper, and jumper_randomized.

Tokens
1.5K
Snippets
6
Records
8
Agent score
32%

What's inside SysWhispers3

  1. Integrate SysWhispers3 into Visual Studio

    master

    To use the generated files in a Visual Studio project:

    1. Copy the generated .h, .c, and .asm files into your project folder.
    2. In Visual Studio, go to ProjectBuild Customizations... and enable MASM.
    3. In the Solution Explorer, add the .h and .c/.asm files to the project.
    4. Right-click the .asm file, select Properties, and set the Item Type to Microsoft Macro Assembler.
  2. Install SysWhispers3

    master

    To install SysWhispers3, clone the repository from GitHub and navigate to the directory. You will need Python installed to run the generator.

    C:\> git clone https://github.com/klezVirus/SysWhispers3.git
    C:\> cd SysWhispers3
    C:\> python .\syswhispers.py --help
    git clone https://github.com/klezVirus/SysWhispers3.git
    cd SysWhispers3
    python .\syswhispers.py --help
  3. Troubleshoot SysWhispers3 issues

    master

    Common Errors

    • Type redefinitions: If syscalls.h causes errors, it may be because a typedef is already defined in your project. Use a more specific --preset instead of all, or manually remove the conflicting typedef from syscalls.h.
    • error A2084:constant value too large: This is a compilation error in the assembly. Regenerate the stubs using the script.

    Debugging Tools

    • Use -v (--verbose) to see troubleshooting output during the generation process.
    • Use -d (--debug) to insert a software breakpoint in the syscall stub, which is useful when debugging with WinDbg.
  4. Generate standard x64 syscalls

    master

    Use these commands for standard x64 implementations using the embedded method (default).

    Export all functions (with Windows version compatibility):

    py .\syswhispers.py --preset all -o syscalls_all

    Export common functions only:

    py .\syswhispers.py --preset common -o syscalls_common

    Export specific functions (e.g., memory protection/writing):

    py .\syswhispers.py --functions NtProtectVirtualMemory,NtWriteVirtualMemory -o syscalls_mem
    py .\syswhispers.py --preset all -o syscalls_all
    py .\syswhispers.py --preset common -o syscalls_common
    py .\syswhispers.py --functions NtProtectVirtualMemory,NtWriteVirtualMemory -o syscalls_mem
  5. Generate advanced SysWhispers3 evasion samples

    master

    SysWhispers3 provides advanced methods to bypass detection (e.g., RIP validation or syscall marking).

    32-bit mode with Jumper method:

    py .\syswhispers.py --preset all -o syscalls_all -m jumper --arch x86

    32-bit mode using WOW64 (specific functions):

    py .\syswhispers.py --functions NtProtectVirtualMemory,NtWriteVirtualMemory -o syscalls_mem --arch x86 --wow64

    Egg-Hunter method (to bypass 'mark of the syscall'):

    py .\syswhispers.py --preset common -o syscalls_common -m egg_hunter

    Jumper/Randomized method (to bypass dynamic RIP validation) using MinGW:

    py .\syswhispers.py --preset all -o syscalls_all -m jumper -c mingw
    py .\syswhispers.py --preset all -o syscalls_all -m jumper --arch x86
    py .\syswhispers.py --functions NtProtectVirtualMemory,NtWriteVirtualMemory -o syscalls_mem --arch x86 --wow64
    py .\syswhispers.py --preset common -o syscalls_common -m egg_hunter
    py .\syswhispers.py --preset all -o syscalls_all -m jumper -c mingw
  6. Compile SysWhispers3 stubs with MinGW (Linux)

    master

    For Linux environments using MinGW, use the provided Makefile.mingw.

    Makefile.mingw:

    CC_x64 := x86_64-w64-mingw32-gcc
    CC_x86 := i686-w64-mingw32-gcc
    OPTIONS := -masm=intel -Wall
    
    program:
      $(CC_x64) syscalls.c program.c -o program.x64.exe $(OPTIONS)
      $(CC_x86) syscalls.c program.c -o program.x86.exe $(OPTIONS)

    To compile:

    make -f Makefile.mingw
    make -f Makefile.mingw
  7. Compile SysWhispers3 stubs with MSVC (Windows)

    master

    If not using Visual Studio's IDE, you can use nmake with the provided Makefile.msvc.

    Makefile.msvc (64-bit):

    OPTIONS = -Zp8 -c -nologo -Gy -Os -O1 -GR- -EHa -Oi -GS-
    LIBS = libvcruntime.lib libcmt.lib ucrt.lib kernel32.lib
    
    program:
      ML64 /c syscalls-asm.x64.asm /link /NODEFAULTLIB /RELEASE /MACHINE:X64
      cl.exe $(OPTIONS) syscalls.c  program.c
      link.exe /OUT:program.x64.exe -nologo $(LIBS) /MACHINE:X64 -subsystem:console -nodefaultlib syscalls-asm.x64.obj syscalls.obj program.obj

    Makefile.msvc (32-bit):

    OPTIONS = -Zp8 -c -nologo -Gy -Os -O1 -GR- -EHa -Oi -GS-
    LIBS = libvcruntime.lib libcmt.lib ucrt.lib kernel32.lib
    
    program:
      ML /c syscalls-asm.x86.asm /link /NODEFAULTLIB /RELEASE /MACHINE:X86
      cl.exe $(OPTIONS) syscalls.c  program.c
      link.exe /OUT:program.x86.exe -nologo $(LIBS) /MACHINE:X86 -subsystem:console -nodefaultlib syscalls-asm.x86.obj syscalls.obj program.obj

    To compile:

    nmake -f Makefile.msvc
    nmake -f Makefile.msvc
  8. Use syswhispers.py CLI

    master

    The syswhispers.py script generates header (.h), source (.c), and assembly (.asm) files used to perform direct system calls, bypassing user-mode API hooks. Use the following arguments to configure the output:

    • -p, --preset <all|common>: Use a preset for function selection.
    • -a, --arch <x86|x64>: Target architecture.
    • -c, --compiler <msvc|mingw|all>: Target compiler.
    • -m, --method <embedded|egg_hunter|jumper|jumper_randomized>: Syscall recovery method.
    • -f, --functions <comma-separated-list>: Specific functions to export.
    • -o, --out-file <basename>: Output filename (without extension).
    • --int2eh: Use int 2eh instead of syscall.
    • --wow64: Use Wow64 to run x86 on x64 (requires --arch x86).
    • -v, --verbose: Enable debug output.
    • -d, --debug: Insert software breakpoints in syscall stubs for WinDbg.
    usage: syswhispers.py [-h] [-p PRESET] [-a {x86,x64}] [-m {embedded,egg_hunter,jumper,jumper_randomized}] [-f FUNCTIONS] -o OUT_FILE [--int2eh] [--wow64] [-v] [-d]