Skip to main content

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


Basic Usage

Enumerate domain users and groups:
Output shows RID, account name, and type (SidTypeUser, SidTypeGroup, SidTypeAlias):

Specify Maximum RID

The max RID is a positional argument (passed after the target), not a flag. Default is 4000. Increase for larger environments:
Lower for faster scans when you only need well-known accounts:
Common RID ranges:

NULL Session Enumeration

No credentials needed on misconfigured Domain Controllers:
Alternative syntax:
NULL sessions work when:
  • RestrictAnonymous is not set or set to 0
  • RestrictAnonymousSAM is 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:
Output:
The domain SID is needed for:
  • 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:
Use the user list with password spraying:

Cross-Domain Enumeration via Trusts

Enumerate accounts in a trusted domain by targeting the trust relationship:
Target a specific domain SID:
If you have the SID of a trusted domain, you can enumerate its accounts through any DC that has a trust relationship with it.

Quick Reference