Skip to content

About

WinRM pass-the-hash BOF with NTLMv2 authentication and signed, encrypted WSMan traffic

Resources

Stars

58 stars

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinRM-PtH-BOF

A standalone, C2-agnostic Beacon Object File (BOF) for executing commands over WinRM using NTLMv2 pass-the-hash authentication.

The BOF handles NTLM authentication, session signing and sealing, and encrypted WSMan communication directly in memory. No Mimikatz, SSPI, credential injection, or external executable is required.

An optional AxScript extension is included for AdaptixC2.

For authorized security testing and research only.

Features

  • Native NTLMv2 pass-the-hash authentication using a supplied NT hash.
  • NTLM MIC generation when required.
  • Session signing, sealing, and encrypted WSMan communication.
  • Remote command execution with output retrieval.
  • No local process spawning or LSASS credential modification.
  • Standalone x64 and x86 BOF builds.
  • Optional AdaptixC2 integration supporting Beacon, Gopher, and Kharon agents.

Requirements

  • A C2 framework with a compatible BOF loader.
  • MinGW-w64 (x86_64-w64-mingw32-gcc and i686-w64-mingw32-gcc) for compilation.
  • A target with WinRM enabled over HTTP (TCP 5985 by default).
  • A valid NT hash for an account authorized to execute commands through WinRM.

Note: HTTPS/5986 is not currently supported.

Build

Compile both architectures:

make

The compiled BOFs are generated in the bin/ directory.

These objects are designed to work with compatible BOF loaders. Framework-specific argument handling may vary.

AdaptixC2 Integration

AdaptixC2 support is provided through the included winrm_pth.axs script. This integration is optional and is not required by the BOF itself.

  1. Compile the project using make.
  2. Load winrm_pth.axs through AxScript → Script Manager.
  3. Run help winrm_pth in your Windows agent console.

The script automatically selects the appropriate BOF for the agent architecture and registers winrm_pth as a standalone command without conflicting with the Extension Kit's invoke command.

Usage

winrm_pth <target> "<command>" DOMAIN\username <NT_HASH> [-t milliseconds] [-P port]

Example:

image

For local accounts, use the target computer name instead of the domain, such as SERVER01\Administrator.

The command shown above uses the optional AdaptixC2 integration. Other compatible C2 frameworks can execute the compiled BOF using their supported argument-packing and execution mechanisms.

Mythic (Xenon Agent)

image Arguments are passed as typed values using `wchar:` for strings and `int32:` for integers. The domain and username are separate fields.

How It Works

The BOF performs the NTLMv2 authentication exchange using the supplied NT hash, then derives the session keys needed to protect WinRM communication.

WSMan requests are encrypted and signed using NTLM session security. Responses are decrypted and verified before processing.

Commands first attempt to execute through the standard text shell (cmd.exe /c). If the target returns a verified AccessDenied SOAP fault for the cmd shell, the BOF automatically retries using the PowerShell Remoting Protocol (PSRP) over the same authenticated connection. The PSRP path opens a runspace, submits the command as a pipeline, and parses the CLIXML output stream. No re-authentication is needed since the NTLM session keys carry over from the initial exchange.

The output indicates which backend ran the command (cmd or PowerShell). Fallback only triggers on a verified access-denied fault. Authentication failures (401), signature validation errors, and transport failures are reported immediately without retry.

Response buffering is limited to 256 KiB. WinHTTP automatic authentication and redirects are disabled for each request to avoid unintended credential use.

Roadmap

PowerShell Remoting Fallback (PSRP)

  • Automatically fall back to PowerShell when a verified w:AccessDenied SOAP fault occurs.
  • Reuse existing NTLM authentication, signing/sealing, and WSMan transport.
  • Implement PSRP runspace, pipeline execution, output handling, and cleanup.
  • Preserve existing cmd.exe /c command behavior during fallback.
  • Display which backend (CMD or PowerShell) executed the command.
  • Prevent fallback on authentication (401), signature validation, or connection failures.

Cross-C2 Portability

  • Use standard BeaconData API for argument parsing across all COFF loaders.
  • Retain raw text fallback for AdaptixC2 AxScript integration.
  • Replace custom argument parser with framework-provided BeaconData functions.

References

About

WinRM pass-the-hash BOF with NTLMv2 authentication and signed, encrypted WSMan traffic

Resources

Stars

58 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages