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.
- 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.
- A C2 framework with a compatible BOF loader.
- MinGW-w64 (
x86_64-w64-mingw32-gccandi686-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.
Compile both architectures:
makeThe 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 support is provided through the included winrm_pth.axs script. This integration is optional and is not required by the BOF itself.
- Compile the project using
make. - Load
winrm_pth.axsthrough AxScript → Script Manager. - Run
help winrm_pthin 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.
winrm_pth <target> "<command>" DOMAIN\username <NT_HASH> [-t milliseconds] [-P port]
Example:
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.
Arguments are passed as typed values using `wchar:` for strings and `int32:` for integers. The domain and username are separate fields.
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.
- Automatically fall back to PowerShell when a verified
w:AccessDeniedSOAP fault occurs. - Reuse existing NTLM authentication, signing/sealing, and WSMan transport.
- Implement PSRP runspace, pipeline execution, output handling, and cleanup.
- Preserve existing
cmd.exe /ccommand behavior during fallback. - Display which backend (CMD or PowerShell) executed the command.
- Prevent fallback on authentication (401), signature validation, or connection failures.
- 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.