Skewrun
skewrun is an Active Directory time discovery toolkit for red teams. It dynamically resolves the Domain Controller's time via network protocols (CLDAP, SMB, NTP, Kerberos, NTLM) and executes commands via libfaketime (LD_PRELOAD), tricking the executed binary into using the exact DC time.
This solves the Kerberos KRB_AP_ERR_SKEW (Clock Skew Too Great) error, allowing you to run tools like Impacket or NetExec from a Linux attack machine whose clock is heavily desynchronized from the target Windows domain, without requiring root privileges to change the system time.
Architecture: Library-First
Starting with v0.9.0, Skewrun is built as a library-first architecture:
ad-time: A pure Rust library crate that extracts time from AD protocols stealthily. It can be natively embedded into other Rust implants or tools.skewrun: A CLI binary that orchestrates thead-timelibrary and wraps target processes withlibfaketime.
Installation
# Pre-built static binary (no Rust toolchain required)
# From crates.io
# From source
&& &&
Note: You must have libfaketime installed on your system (e.g., apt-get install libfaketime).
Usage
# Default behavior (tries CLDAP -> SMB -> NTP)
# Force specific methods
# Just print the offset (useful for shell scripting)
# Offline mode: supply a known offset manually
Using as a library
use CldapSource;
use TimeSource;
use Duration;
Each protocol module (kerberos, ntlm, cldap, smb, ntp) is independent and extractable for use in custom red team tooling.
How It Works
Skewrun queries the DC to calculate the exact microsecond offset (DC_Time - Local_Time). It then sets the FAKETIME environment variable and injects libfaketime into the target command using LD_PRELOAD.
FAKETIME limitations (Static Binaries)
LD_PRELOAD relies on intercepting libc dynamically linked calls (like clock_gettime). If you attempt to use skewrun on a statically compiled binary (such as many Go or Rust tools), libfaketime will silently fail to hook the time functions. Skewrun will warn you if it detects you are attempting to run a static binary.
Forensic Noise & Evasion
The goal is to blend in with standard Windows wire traffic and minimize forensic footprint on the DC.
| Method | Protocol | Port | OPSEC Notes (EDR/NDR Visibility) |
|---|---|---|---|
| cldap (Default) | CLDAP | UDP/389 | Extremely Stealthy. Universally allowed. Emulates a standard Windows DC Locator Ping (rootDSE). Dilutes the attribute query and randomizes TimeLimits to evade NDRs. |
| smb (Default) | SMB2 | TCP/445 | Stealthy. Extracts time from the SMB2 NEGOTIATE response. Plausible workstation noise. |
| ntp (Default) | SNTP | UDP/123 | Standard. Native RFC 4330. Highly expected traffic from any client. |
| ntlm | SMB2 | TCP/445 | Stealthy. Exploits SMB2 SESSION_SETUP to get an NTLM Type 2 Challenge containing MsvAvTimestamp. Disconnects TCP before Type 3, meaning no Event ID 4625 (Logon Failure) is generated. Emulates Windows 10/11 flags. |
| kerberos | Kerberos | TCP/88 | Loud. Sends an AS-REQ for a non-existent user. Encodes proper two-component sname, rotates cname (typos like admnistrator), till (10h ± 30min jitter), nonce, and ClientGuid to blend in. Always generates Event 4768/0x6 (pre-authentication failure for unknown principal) which is exported to SIEM regardless of audit policy. May trigger honey-account alerts if the cname matches a configured tripwire. |
License
Dual-licensed under MIT or Apache 2.0 at your option.