コンテンツにスキップ

カテゴリ目次へ戻る / コマンド全体目次へ戻る

LDAP を検索し、ドメイン内の非制約委任、制約付き委任、RBCD の設定を一覧にします。

項目内容
実装examples/findDelegation.py
カテゴリActive Directory / LDAP / アカウント管理
規模283 行
配布setup.py の scripts=examples/*.py によりスクリプトとしてインストール

オプションの最新の定義は python examples/findDelegation.py -h で確認できます。

引数説明
targetdomain[/username[:password]]
-target-domainDomain to query/request if different than the domain of the user. Allows for retrieving delegation info across trusts.
-tsAdds timestamp to every logging output
-debugTurn DEBUG output ON
-userRequests data for specific user
-disabledQuery disabled users too
-hashesNTLM hashes, format is LMHASH:NTHASH
-no-passdon’t ask for password (useful for -k)
-kUse Kerberos authentication. Grabs credentials from ccache file (KRB5CCNAME) based on target parameters. If valid credentials cannot be found, it will use the ones specified in the command line
-aesKeyAES key to use for Kerberos Authentication (128 or 256 bits)
-dc-ipIP Address of the domain controller. If ommited it use the domain part (FQDN) specified in the target parameter. Ignoredif -target-domain is specified.
-dc-hostHostname of the domain controller to use. If ommited, the domain part (FQDN) specified in the account parameter will be used
-ldaps / -use-ldapsUse LDAPS instead of LDAP

対象ドメインへ bind し、user/computer の UAC、msDS-AllowedToDelegateTo、RBCD security descriptor を検索します。SID と SPN を解決し、account type、delegation type、対象 SPN を表にします。

delegation は単一属性では表現されません。このコマンドは account の userAccountControl、msDS-AllowedToDelegateTo、そして msDS-AllowedToActOnBehalfOfOtherIdentity を組み合わせ、unconstrained、 constrained、protocol transition 付き constrained、RBCD を分類します。 したがって、単に SPN を列挙するのではなく「誰が、どの service または account に対して delegation 可能か」という関係へ変換する処理です。

通常の constrained delegation は委任元 account に対象 SPN が格納されます。 RBCD は逆に、委任先 computer の security descriptor に許可された SID が 格納されます。run() は RBCD の binary descriptor を ldaptypes で解析し、 各 ACE の SID を directory object 名へ引き直します。この向きの違いを 保ったまま同じ表へ正規化するのが実装の中心です。

SID や SPN の解決に失敗しても、関係そのものが存在しないとは限りません。 削除済み object、別 domain の SID、読み取り権限不足では raw SID だけが残る ことがあります。checkIfSPNExists() や名前解決を変更するときは、表示名の 補完失敗によって元の delegation record を捨てないようにします。

シンボル位置責務を追う入口
FindDelegation58__init__()、printTable()、run()
checkIfSPNExists()36モジュール関数
モジュール使用する主な名前
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
  • 照会や認証の試行が中心です。実行回数が多いと監査ログやアカウントロック、対象の負荷に影響します。
  • 失敗時は、名前解決、接続、認証、サービスの状態、権限のどこで止まったかを、プロトコルのステータスから切り分けます。

ldap / ldapasn1 / ldaptypes、SAMR の delegation flag、ldap_login に依存します。checkIfSPNExists() と FindDelegation.run() が検索と分類を担当します。cross-domain の -target-domain では、認証ドメインと検索 base の違いを維持してください。