A native Rust implementation of the Windows Management Instrumentation (WMI) protocol stack for Linux systems. Query Windows hosts directly without intermediaries using authenticated DCOM/RPC connections.
- Full Protocol Stack: Complete implementation of DCOM activation, ORPC, NDR marshaling, and WMI protocols
- Secure Authentication: NTLMv2 with signing/sealing + Production Kerberos via kerbsec (NEW!)
- π kerbsec: Our purpose-built, lightweight (~1,500 LOC) Kerberos library
- β‘ Credential caching with 30x performance boost (FILE, Memory, KCM, Keyring backends)
- π Zero-copy IOV operations for maximum DCE/RPC performance
- π Automatic DNS canonicalization and SPN construction
- π‘οΈ TLS channel bindings for relay attack prevention
- π Automatic memory zeroization of all sensitive data
- π― DCE/RPC optimized with proper 3-leg handshake
- π₯οΈ Platform-native using system GSS-API (MIT Kerberos/Heimdal)
- Windows 11 Ready: Kerberos authentication for post-NTLM environments
- Production Ready: ~90% protocol coverage with 76 passing tests
- Minimal External Dependencies: Uses system Kerberos libraries only
- Developer Friendly: Stub transport for testing without Windows targets
β Phase 4 Complete: Full ORPC Integration and WMI Protocol (90% stack completion)
- DCOM activation with OXID/IPID resolution
- Authenticated RPC with signing/sealing
- Multi-fragment PDU support
- NDR codec with VARIANT types
- WMI ConnectServer and ExecQuery
See docs/PROTOCOL-COMPLETION.md for detailed status.
Microsoft is actively removing NTLM from Windows. Windows 11 24H2 has already removed NTLMv1, and NTLM for DCOM is blocked by default. By October 2026, NTLM will be completely blocked unless manually overridden.
Immediate Impact:
- Current NTLM authentication fails on Windows 11 24H2
- Cross-platform WMI connections are affected
- Kerberos implementation is now critical, not optional
See docs/NTLM-DEPRECATION-TIMELINE.md for full details and migration guidance.
use linux_wmi::{WmiSession, Credentials, KerberosConfig, KerberosCacheBackend};
// NEW in v0.2.0: Secure credential handling with automatic zeroization
let creds = Credentials::new(
"Administrator".to_string(),
"Password123".to_string(), // Automatically protected
"DOMAIN".to_string(),
"WORKSTATION".to_string(),
);
// Enhanced Kerberos with credential caching (60x faster!)
let config = KerberosConfig::new("DOMAIN.COM")
.with_spn("HOST/server.domain.com")
.with_cache_backend(KerberosCacheBackend::File) // Persistent cache
.with_caching(true); // Enable for performance
// Create session with Kerberos
let mut session = WmiSession::with_kerberos(
"server.domain.com",
config,
creds, // Password automatically zeroized when dropped
)?;
// Connect to namespace
session.open_namespace("root\\CimV2")?;
// Execute WQL query
let processes = session.exec_query("SELECT * FROM Win32_Process")?;
for process in processes {
println!("Process: {}", process["Name"]);
}# Run integration test
./examples/test_e2e.sh 192.168.1.100
# Test with specific credentials
RUST_LOG=debug cargo run --example test_connect 192.168.1.100 \
--user Administrator \
--pass 'Password123' \
--domain DOMAIN \
--query 'SELECT * FROM Win32_ComputerSystem'
# Use direct port specification (bypass DCOM port resolution)
export LINUX_WMI_PORT=49155 # Use actual WMI port from netstat
cargo run --example test_connect 192.168.1.100 \
--user Administrator \
--pass 'Password123' \
--query 'SELECT * FROM Win32_ComputerSystem'linux-wmi supports multiple methods for discovering and connecting to WMI services:
- Direct Port - Specify WMI port via
LINUX_WMI_PORTenvironment variable - Anonymous DCOM - Attempt anonymous activation (when allowed by Windows)
- Authenticated DCOM - Use NTLM credentials for DCOM activation
- Fallback - Use port 135 directly (legacy mode)
For Windows 11 and security-hardened environments that block NTLM for DCOM, use the direct port method:
# On Windows, find WMI port:
netstat -an | findstr LISTENING | findstr :49
# On Linux, connect directly:
export LINUX_WMI_PORT=<discovered_port>
cargo run --example test_connect <host> --user <user> --pass <pass>See docs/AUTHENTICATION-GUIDE.md for troubleshooting authentication issues.
The implementation follows Microsoft specifications:
- MS-RPCE: RPC over TCP with PDU handling
- MS-DCOM: Distributed COM with ORPC headers
- MS-WMI: Windows Management Instrumentation
- MS-NLMP: NTLMv2 authentication
βββββββββββββββββ
β WMI Client β
βββββββββββββββββ€
β NDR Codec β β VARIANT, BSTR, Arrays
βββββββββββββββββ€
β ORPC Layer β β ORPCTHIS/THAT, OXID
βββββββββββββββββ€
β DCOM SCM β β Activation, Port Resolution
βββββββββββββββββ€
β RPC/NTLM β β Auth, Signing, Sealing
βββββββββββββββββ€
β TCP Transport β β Socket I/O
βββββββββββββββββ
# Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Development tools (optional)
cargo install cargo-watch# Debug build
cargo build
# Release build
cargo build --release
# Run tests
cargo testThe project includes comprehensive testing:
- Unit tests for each protocol layer
- Golden byte tests for wire format validation
- Integration tests with stub transport
- E2E test script for live Windows targets
# Run all tests
cargo test
# Run with logging
RUST_LOG=debug cargo test
# Use stub transport (no Windows required)
LINUX_WMI_SKIP_EPM=1 cargo test
# Use real NDR codec
LINUX_WMI_USE_REAL_NDR=1 cargo test- π API Reference - Complete API documentation
- π Migration Guide - Upgrade from v0.1.0 to v0.2.0
- π Security Guide - Best practices and threat model
- π― Authentication Guide - NTLM and Kerberos setup
- β‘ kerbsec Features - Our internal Kerberos library capabilities
- π Changelog - Version history and updates
- Protocol Completion Status - Implementation progress
- Architecture - System design
- DCOM Activation - Activation flow
- Implementation Strategy - Development phases
- Kerberos Design - v0.2.0 Kerberos implementation
- Credential Caching - Performance optimization guide
Contributions are welcome! Please ensure:
- All tests pass (
cargo test) - No clippy warnings (
cargo clippy) - Code is formatted (
cargo fmt)
- Automatic Memory Protection: All passwords and session keys automatically zeroized
- Credential Caching: Secure storage with file permissions (0600)
- TLS Channel Bindings: Protection against relay attacks
- NTLM Security: Session keys never logged, signing/sealing enabled
- Replay Protection: Sequence numbers prevent replay attacks
- Multiple Cache Backends: Choose security level (Memory, FILE, KCM, Keyring)
See Security Guide for comprehensive security documentation.
- Synchronous I/O (async planned for future release)
- Limited to common WMI classes (extensible)
No Kerberos supportβ FIXED in v0.2.0 with full Kerberos implementation
This project is licensed under the MIT License - see the LICENSE file for details.
- Microsoft for protocol specifications
- Rust community for excellent libraries (md5, hex, serde, etc.)
- Impacket project for protocol insights