A Beacon Object File (BOF) for Cobalt Strike which uses direct system calls to enable WDigest credential caching.

Related tags

Utilities WdToggle
Overview

WdToggle

A Proof of Concept Cobalt Strike Beacon Object File which uses direct system calls to enable WDigest credential caching and circumvent Credential Guard (if enabled).

Additional guidance can be found in this blog post: https://outflank.nl/blog/?p=1592

Background

This PoC code is based on the following excellent blog posts:

Exploring Mimikatz - Part 1 - WDigest

Bypassing Credential Guard

Utilizing direct systems calls via inline assembly in BOF code provides a more opsec safe way of interacting with the LSASS process. Using direct system calls avoids AV/EDR software intercepting user-mode API calls.

Visual Studio (C++) does not support inline assembly for x64 processors. So in order to write a single Beacon Object File containing our compiled / assembled code code we must use the Mingw-w64 (GCC for Windows) compiler.

What is this repository for?

  • Demonstrate the usage of direct systems calls using inline-assembly to provide a more opsec safe way of interacting with the LSASS process.
  • Enable WDigest credential caching by toggling the g_fParameter_UseLogonCredential global parameter to 1 within the LSASS process (wdigest.dll module).
  • Circumventing Credential Guard (if enabled) by toggling the g_IsCredGuardEnabled variable to 0 within the LSASS process (wdigest.dll module).
  • Execute this code within the Beacon process using a Beacon object file.

How do I set this up?

We will not supply compiled binaries. You will have to do this yourself:

  • Clone this repository.

  • Make sure you have the Mingw-w64 compiler installed. On Mac OSX for example, we can use the ports collection to install Mingw-w64 (sudo port install mingw-w64).

  • Run the make command to compile the Beacon object file.

  • Within a Cobaltstrike beacon context run the inline-execute command and provide the path to the object WdToggle.o file.

  • Run the Cobaltstrike logonpasswords command (Mimikatz) and notice that clear text passwords are enabled again for new user logins or users who unlock their desktop session.

    WdToggle

Limitations

  • This memory patch is not reboot persistent, so after a reboot you must rerun the code.
  • The memory offset to the wdigest!g_fParameter_UseLogonCredential and wdigest!g_IsCredGuardEnabled global variable could change between Windows versions and revisions. We provided some offsets for different builds, but these can change in future releases. You can add your own version offsets which can be found using the Windows debugger tools.
C:\Program Files (x86)\Windows Kits\10\Debuggers\x64>cdb.exe -z C:\Windows\System32\wdigest.dll

0:000>x wdigest!g_fParameter_UseLogonCredential
00000001`800361b4 wdigest!g_fParameter_UseLogonCredential = 
0:000> x wdigest!g_IsCredGuardEnabled
00000001`80035c08 wdigest!g_IsCredGuardEnabled = 
0:000>

Detection

To detect credential theft through LSASS memory access, we could use a tool like Sysmon. Sysmon can be configured to log processes opening a handle to the lsass.exe process. With this configuration applied, we can gather telemetry for suspicious processes accessing the LSASS process and help detecting possible credential dumping activity. Of course, there are more options to detect credential theft, for example using an advanced detection platform like Windows Defender ATP. But if you don’t have the budget and luxury of using these platforms, then Sysmon is that free tool that can help to fill up the gap.

Credits

You might also like...
convert elf file to single c/c++ header file

elf-to-c-header Split ELF to single C/C++ header file

You Only Look Twice: Rapid Multi-Scale Object Detection In Satellite Imagery
You Only Look Twice: Rapid Multi-Scale Object Detection In Satellite Imagery

YOLT You Only Look Twice: Rapid Multi-Scale Object Detection In Satellite Imagery As of 24 October 2018 YOLT has been superceded by SIMRDWN YOLT is an

Small header-only C++ library that helps to initialize Vulkan instance and device object

Vulkan Extensions & Features Help, or VkExtensionsFeaturesHelp, is a small, header-only, C++ library for developers who use Vulkan API.

Locate the current executable and the current module/library on the file system

Where Am I? A drop-in two files library to locate the current executable and the current module on the file system. Supported platforms: Windows Linux

Stripped down version of BIGTREETECH-TouchScreenFirmware which only supports ST7920 emulation (Marlin Mode)

Stripped down version of BIGTREETECH-TouchScreenFirmware which only supports ST7920 emulation (Marlin Mode). This project only uses peripheral drivers supplied by the screen manufacturer and uses it's own library to parse the ST7920 commands.

A small proxy DLL which enables dev. console in Mass Effect 1, 2 and 3 (Legendary Edition).
A small proxy DLL which enables dev. console in Mass Effect 1, 2 and 3 (Legendary Edition).

LEBinkProxy A small proxy DLL which enables dev. console in Mass Effect 1, 2 and 3 (Legendary Edition). Usage In your game binary directory (Game\ME?\

A LKM rootkit targeting 4.x and 5.x kernel versions which opens a backdoor that can be used to spawn a reverse shell to a remote host and more.
A LKM rootkit targeting 4.x and 5.x kernel versions which opens a backdoor that can be used to spawn a reverse shell to a remote host and more.

Umbra Umbra (/ˈʌmbrə/) is an experimental LKM rootkit for kernels 4.x and 5.x (up to 5.7) which opens a network backdoor that spawns reverse shells to

A interpreter that runs the script which is programmed in the language of FF0 script (or you can call it as Warfarin)

ff0-script A interpreter that runs the script which is programmed in the language of FF0 script (or you can call it as Warfarin) You can do it, unders

D3D9On12 is a mapping layer, which maps graphics commands from D3D9 to D3D12

D3D9On12 is a mapping layer, which maps graphics commands from D3D9 to D3D12. D3D9On12 is not an implementation of the D3D9 API, but is instead an implementation of the D3D9 usermode DDI (device driver interface).

Comments
  • Compile Error

    Compile Error

    Tried:

    • make
    • manually using gcc
    • On Kali
    • On Windows same error:

    C:\users\admin\Downloads\WdToggle\Syscalls.h:111:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:212:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:313:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:413:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:516:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:619:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:720:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:822:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:924:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:1022:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\Syscalls.h:1122:1: error: unknown type name 'NTSTATUS' C:\users\admin\Downloads\WdToggle\WdToggle.c: In function 'GrabLsassHandle':

    Im stumped, any ideas what I am doing wrong? Appreciate any guidance or tips.

    K

    opened by Wh1teHat65 0
Owner
Outflank B.V.
Clear advice with a hacker mindset. Red Teaming - Digital Attack Simulation - Incident Detection and Response
Outflank B.V.
Beacon Object File (BOF) for remote process injection via thread hijacking

cThreadHijack ___________.__ .______ ___ .__ __ __ ___\__ ___/| |_________ ____ _____

Connor McGarr 158 Dec 28, 2022
Cobalt Strike BOF Files with Nim!

BOF-Nim oh yeah baby I have an inkling it's possible, right now the problem seems to be getting the go function to be present in the Symbol table. No

byt3bl33d3r 77 Dec 24, 2022
SPAWN - Cobalt Strike BOF

Cobalt Strike BOF that spawns a sacrificial process, injects it with shellcode, and executes payload. Built to evade EDR/UserLand hooks by spawning sacrificial process with Arbitrary Code Guard (ACG), BlockDll, and PPID spoofing.

Bobby Cooke 349 Dec 1, 2022
Section Mapping Process Injection (secinject): Cobalt Strike BOF

Section Mapping Process Injection (secinject): Cobalt Strike BOF Beacon Object File (BOF) that leverages Native APIs to achieve process injection thro

null 77 Dec 16, 2022
The libxo library allows an application to generate text, XML, JSON, and HTML output using a common set of function calls. The application decides at run time which output style should be produced.

libxo libxo - A Library for Generating Text, XML, JSON, and HTML Output The libxo library allows an application to generate text, XML, JSON, and HTML

Juniper Networks 253 Dec 10, 2022
CacheLib is a C++ library providing in-process high performance caching mechanism.

Pluggable in-process caching engine to build and scale high performance services

Facebook 808 Jan 5, 2023
x64 Assembly HalosGate direct System Caller to evade EDR UserLand hooks

ASM HalosGate Direct System Caller Assembly HalosGate implementation that directly calls Windows System Calls, evades EDR User Land hooks, and display

Bobby Cooke 130 Dec 24, 2022
A simple YAML parser which produces a Node Tree Object representation of YAML Documents

A simple YAML parser which produces a Node Tree Object representation of YAML Documents and includes a find method to locate individual Nodes within the parsed Node Tree.

Timothy Rule 2 Sep 18, 2022
[WIP] A Riru module tries to enable Magisk hide for isolated processes.

Riru-IsolatedMagiskHider Background Many applications now detect Magisk for security, Magisk provided "Magisk Hide" to prevent detection, but isolated

残页 562 Jan 3, 2023
VMPImportFixer is a tool aimed to resolve import calls in a VMProtect'd (3.x) binary.

VMPImportFixer VMPImportFixer is a tool aimed to resolve import calls in a VMProtect'd (3.x) binary. Information VMPImportFixer attempts to resolve al

null 256 Dec 28, 2022