Overview
impacket-lookupsid enumerates Windows users and groups by brute forcing SID (Security Identifier) lookups through the LSARPC named pipe. It queries the LSA (Local Security Authority) to resolve RIDs (Relative Identifiers) to account names.
Works over SMB (port 445) and can often succeed with NULL sessions on misconfigured Domain Controllers.
Authentication
| Method | Flag | Example |
|---|---|---|
| Password | domain/user:password | CORP/admin:Password1 |
| NTLM hash | -hashes | -hashes :aad3b435b51404eeaad3b435b51404ee |
| NULL session | ''/''@target | ''/'':''@10.10.10.5 |
| Guest | guest@target | guest:''@10.10.10.5 |
Basic Usage
Enumerate domain users and groups:Specify Maximum RID
The max RID is a positional argument (passed after the target), not a flag. Default is 4000. Increase for larger environments:| RID Range | Accounts |
|---|---|
| 500-501 | Administrator, Guest |
| 502 | krbtgt |
| 512-514 | Domain Admins, Domain Users, Domain Guests |
| 515-519 | Domain Computers, Domain Controllers, Schema/Enterprise Admins |
| 1000+ | Custom users and groups |
NULL Session Enumeration
No credentials needed on misconfigured Domain Controllers:RestrictAnonymousis not set or set to 0RestrictAnonymousSAMis disabled- The “Network access: Restrict anonymous access to Named Pipes and Shares” policy is not enforced
- Common on older Domain Controllers (2008/2012) and misconfigured environments
Finding Domain SID
The domain SID is printed at the top of the output:- Forging Golden Tickets (
ticketer.py) - Forging Silver Tickets
- SID History injection
- Cross-domain attacks via trust relationships
Enumerating Users for Password Spraying
Extract only user accounts and format for spraying tools:Cross-Domain Enumeration via Trusts
Enumerate accounts in a trusted domain by targeting the trust relationship:Quick Reference
| Flag | Description |
|---|---|
maxRid (positional) | Maximum RID to brute force, passed after the target (default: 4000) |
-hashes | NTLM hash for pass-the-hash (LM:NT or :NT) |
-k | Use Kerberos authentication |
-no-pass | No password prompt |
-target-ip | IP of the target machine (overrides target resolution) |
-domain-sids | Enumerate SIDs for the domain |
-port | Target port (default: 445) |