ms-lsad
Pure-Rust client for the MS-LSAD Local Security Authority Domain Policy Remote Protocol.
Companion to ms-lsat — both bind against
\PIPE\lsarpc (interface UUID 12345778-1234-abcd-ef00-0123456789ab, v0.0).
LSAT covers SID↔name translation; this crate covers domain policy read and
trusted-domain object (TDO) enumeration.
Dual-use — audit / DFIR tools enumerate trust configuration; red-team tools use trust enumeration as a scouting step before cross-forest attack chains.
v0.1 opnums
| Opnum | Method | Status |
|---|---|---|
| 44 | LsarOpenPolicy2 |
✅ (reused from ms-lsat) |
| 13 | LsarEnumerateTrustedDomains |
✅ live-validated against Server 2025 |
| 0 | LsarClose |
✅ (reused) |
Live-validated against Windows Server 2025 DC (testlab.local, stand-alone,
0 configured trusts) — full stack SmbClient → login → tree_connect(IPC$) → open_pipe(lsarpc) → bind(LSA UUID) → LsarOpenPolicy2 → LsarEnumerateTrustedDomains
completes with no RPC fault; decoder returns the empty page cleanly.
Multi-entry deferred-data ordering is covered by synthetic-fixture unit tests.
Example
use LsadClient;
use SmbClient;
async
Runnable variant: cargo run --example enum_trusts -- <host> <domain> <user> <password>.
Roadmap
- v0.2 —
LsarEnumerateTrustedDomainsEx(opnum 50) for richer TDO info;LsarQueryTrustedDomainInfoByName(opnum 48) for trust-key read. - v0.3 —
LsarOpenSecret+LsarRetrievePrivateData(opnums 28 + 43) for domain DPAPI backup key extraction (G$BCKUPKEY_*secret path).
Composes with
dcerpc— sealed LSARPC transportms-lsat— shares the LSA policy handlems-drsr— alternative trust-key path via DRS bulkGetNCChangesreplication
License
MIT.