Skip to content

Back to the Category Index / Back to the Command Index

Searches LDAP and lists unconstrained delegation, constrained delegation, and RBCD settings in a domain.

ItemDetails
Implementationexamples/findDelegation.py
CategoryActive Directory / LDAP / Account Management
Size283 lines
DistributionInstalled as a script through scripts=examples/*.py in setup.py

Check python examples/findDelegation.py -h for the current option definitions.

ArgumentDescription
targetdomain[/username[:password]]
-target-domainDomain to query if different from the user’s domain; supports delegation queries across trusts.
-tsAdd timestamps to log output.
-debugEnable debug logging.
-userRequest data for a specific user.
-disabledInclude disabled users in the query.
-hashesNTLM hashes in LMHASH:NTHASH format.
-no-passSkip the password prompt (useful with -k).
-kUse Kerberos authentication. Read credentials from the ccache (KRB5CCNAME) based on the target; fall back to command-line credentials if none are valid.
-aesKey128- or 256-bit AES key for Kerberos authentication.
-dc-ipDomain controller IP address. Defaults to the domain (FQDN) in the target; ignored if -target-domain is set.
-dc-hostDomain controller hostname. Defaults to the domain (FQDN) in the account parameter.
-ldaps / -use-ldapsUse LDAPS instead of LDAP.

The command binds to the target domain and searches user and computer UAC values, msDS-AllowedToDelegateTo, and RBCD security descriptors. It resolves SIDs and SPNs, then tabulates account type, delegation type, and target SPNs.

Delegation is not represented by a single attribute. The command combines an account’s userAccountControl, msDS-AllowedToDelegateTo, and msDS-AllowedToActOnBehalfOfOtherIdentity to classify unconstrained, constrained, constrained with protocol transition, and RBCD delegation. It transforms these attributes into relationships describing who can delegate to which service or account, rather than merely listing SPNs.

Ordinary constrained delegation stores the target SPNs on the delegating account. RBCD reverses this: permitted SIDs are stored in the security descriptor on the destination computer. run() parses the binary RBCD descriptor with ldaptypes and resolves each ACE’s SID to a directory object name. Normalizing these directions into one table is central to the implementation.

Failure to resolve a SID or SPN does not prove the relationship is absent. A deleted object, a SID from another domain, or insufficient read permissions may leave only a raw SID. When changing checkIfSPNExists() or name resolution, retain the underlying delegation record even if display-name enrichment fails.

SymbolLocationEntry Point for Tracing Behavior
FindDelegation58__init__(), printTable(), run()
checkIfSPNExists()36Module function
ModuleMain Names Used
impacketversion
impacket.dcerpc.v5.samrUF_ACCOUNTDISABLE, UF_TRUSTED_FOR_DELEGATION, UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION
impacket.exampleslogger
impacket.examples.utilsldap_login, parse_identity
impacket.ldapldap, ldapasn1, ldaptypes

Output, Side Effects, and Required Privileges

Section titled “Output, Side Effects, and Required Privileges”
  • Primarily queries and authentication attempts. Repeated runs can affect audit logs, account lockouts, and target load.
  • On failure, use protocol status to determine whether name resolution, connection, authentication, service state, or permissions stopped the operation.

This command depends on ldap / ldapasn1 / ldaptypes, SAMR delegation flags, and ldap_login. checkIfSPNExists() and FindDelegation.run() handle search and classification. With cross-domain -target-domain, preserve the distinction between the authentication domain and search base.