ms-lsat 0.1.0

MS-LSAT Local Security Authority (Translation) Remote Protocol client — SID↔name lookup over \PIPE\lsarpc via sealed DCE/RPC. LsarOpenPolicy2 + LsarLookupSids2 + LsarLookupNames2
Documentation

ms-lsat

Crates.io Docs.rs License: MIT

MS-LSAT (Local Security Authority Translation) client for Rust — SID↔name lookup over the \PIPE\lsarpc named pipe. The RPC channel Windows uses whenever it needs to answer "what's the account name for this SID?" (icacls, Explorer permissions, whoami /all) or the reverse.

Part of the icedracon offensive-AD ecosystem.

Status

0.1.0 — first release. Encoders + decoders for LsarOpenPolicy2, LsarLookupSids2, LsarLookupNames2 (+ LsarClose). Wire byte-shape matches the spec lsat.* NDR marshaling.

What it does

Opnum Name Purpose
6 LsarOpenPolicy Legacy handle-open
44 LsarOpenPolicy2 Handle-open, wide-string (v0.1 uses this)
14 LsarLookupNames Legacy name→SID
15 LsarLookupSids Legacy SID→name
57 LsarLookupSids2 v0.1 — batch SID→name, TranslatedNames_2
58 LsarLookupNames2 v0.1 — batch name→SID, TranslatedSids_2
0 LsarClose Release handle

Why you'd use this

Offensive:

  • RID-brute enumeration when SamrEnumerateUsersInDomain is blocked. Call LsarLookupSids2 with [S-1-5-21-<domain>-500, 501, 502, ..., 1200] — the DC returns which RIDs are populated with what names.
  • Pre-auth account enum on legacy configs where LookupNames accepts anonymous binds.

Defensive:

  • Resolve SIDs from an event log or SD without a WMI/AD-module dependency.
  • Build a cross-domain name resolver for DFIR reports.

Usage

# async fn ex() -> Result<(), Box<dyn std::error::Error>> {
use smb2_client::{client::Cred, SmbClient};
use windows_sddl::sid::Sid;

let mut smb = SmbClient::connect("10.10.10.20").await?;
smb.login_cred("10.10.10.20", "CORP", "labuser", Cred::Password("LabPass!")).await?;
smb.tree_connect("\\\\10.10.10.20\\IPC$").await?;

let file_id = smb.open_pipe("lsarpc").await?;
let mut lsat = ms_lsat::LsatClient::bind(&mut smb, file_id).await?;

// SID → name (RID-brute)
let sids: Vec<Sid> = (500..=1200)
    .map(|rid| Sid::parse(&format!("S-1-5-21-1-2-3-{rid}")).unwrap())
    .collect();
let rows = lsat.lookup_sids("\\\\10.10.10.20", &sids).await?;
for row in rows.iter().filter(|r| !r.name.is_empty()) {
    println!("{}: {}\\{} ({:?})", row.name, row.domain, row.name, row.kind);
}

// Name → SID
let names = &["Administrator", "krbtgt", "svc_sql"];
let rows = lsat.lookup_names("\\\\10.10.10.20", names).await?;
for r in rows { println!("{}: {:?}", r.domain, r.sid); }
# Ok(()) }

Related icedracon crates

  • samr — SAM enumeration (the primary user-listing path)
  • dcerpc — sealed DCE/RPC transport
  • windows-sddl — SID parse / format
  • smb2-client — SMB2 named-pipe transport

License

MIT © 2026 zevs