Repository navigation
Conversation
-lookup-domain DOMAIN resolves DOMAIN's SID with LsarLookupNames on the target and brute forces RIDs under it instead of the target's own domain. The target forwards the lookups, so a trusted domain can be enumerated through a host in another domain. This helps when the target is fixed, e.g. a relayed session through ntlmrelayx's SOCKS proxy. -lookup-name NAME (repeatable) resolves specific names to their SID and account type instead of brute forcing, e.g. -lookup-name 'DOMAIN\HOST$'. Names without a domain are qualified with -lookup-domain when given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
249659b to
7a903b4
Compare
|
@gabrielg5 I rebased and pushed so the action should succeed now |
gabrielg5
left a comment
There was a problem hiding this comment.
Hey hi!
Thanks for this one. Left a couple suggestions there...
Also one observation from testing -lookup-name in GOAD; KINGSLANDING$, WINTERFELL$, and CASTELBLACK$ all resolved successfully, and Windows returned SidTypeUser for each computer account. The script prints that value as returned by LSA. This matches MS-LSAT’s SID type definitions (https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lsat/171e9a87-8e01-4bd8-a35e-3468128c8fc4), which say that the protocol does not use SidTypeComputer
This is different than your description. Did you see SidTypeComputer in a different setup?
Thank you!
|
|
||
| options = parser.parse_args() | ||
|
|
||
| if options.lookup_domain and options.domain_sids: |
There was a problem hiding this comment.
If a wrapper passes -lookup-domain "$domain" and the variable is empty, the script silently falls back to the default account domain.
Think it's better if we keep the current behavior when the flag is omitted and raise a parser error when it’s supplied with an empty value.
| if options.lookup_domain and options.domain_sids: | |
| if options.lookup_domain == '': | |
| parser.error('-lookup-domain requires a non-empty domain name') | |
| if options.lookup_domain and options.domain_sids: |
| group.add_argument('-lookup-domain', action='store', metavar='DOMAIN', help='Resolve DOMAIN\'s SID through the target and ' | ||
| 'enumerate it instead (e.g. a trusted domain; requests are forwarded across the trust)') | ||
| group.add_argument('-lookup-name', action='append', metavar='NAME', help='Resolve NAME (e.g. DOMAIN\\HOST$) to its SID ' | ||
| 'instead of brute forcing. Can be repeated. Names without a domain use -lookup-domain if given') |
There was a problem hiding this comment.
A nit one... Rephrased help text for the newly added parameters. Think it clarifies better the double-use of -lookup-domain
| group.add_argument('-lookup-domain', action='store', metavar='DOMAIN', help='Resolve DOMAIN\'s SID through the target and ' | |
| 'enumerate it instead (e.g. a trusted domain; requests are forwarded across the trust)') | |
| group.add_argument('-lookup-name', action='append', metavar='NAME', help='Resolve NAME (e.g. DOMAIN\\HOST$) to its SID ' | |
| 'instead of brute forcing. Can be repeated. Names without a domain use -lookup-domain if given') | |
| group.add_argument('-lookup-domain', metavar='DOMAIN', | |
| help='Domain to enumerate. With -lookup-name, use DOMAIN as the default qualifier for unqualified names.') | |
| group.add_argument('-lookup-name', action='append', metavar='NAME', | |
| help='Resolve NAME to its SID and show the SID type reported by the server. ' | |
| 'Repeat for multiple names. Skips RID enumeration.') |
There was a problem hiding this comment.
Make the startup log reflect the lookup mode.
| if self.__lookup_names: | |
| logging.info('Resolving names at %s', remoteName) | |
| else: | |
| logging.info('Brute forcing SIDs at %s', remoteName) |
Reject an empty -lookup-domain so a wrapper passing an unset variable does not silently fall back to the account domain. Clarify the help text for both flags and log "Resolving names" instead of "Brute forcing SIDs" when -lookup-name is used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, applied all three suggestions in 35d98a4. You're right on the SID type: computer accounts come back as |
lookupsid.pycan only brute force the target's own account/primary domain. When the target is fixed, for example a relayed session through ntlmrelayx's SOCKS proxy, there's no way to enumerate a trusted domain even though the target will forward those lookups across the trust.This adds:
-lookup-domain DOMAIN: resolves DOMAIN's SID viaLsarLookupNameson the target and brute forces RIDs under it instead.-lookup-name NAME(repeatable): resolves specific names to their SID and account type instead of brute forcing, e.g.-lookup-name 'DOMAIN\HOST$'. Unqualified names use-lookup-domainwhen given.Both are rejected in combination with
-domain-sids. Default behavior is unchanged.Example output for
-lookup-name:🤖 Generated with Claude Code