コンテンツにスキップ

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

computer account の msDS-AllowedToActOnBehalfOfOtherIdentity を読み取り、委任先アカウントを追加・削除します。

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

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

引数説明
identitydomain.local/username[:password]
-delegate-toTarget account the DACL is to be read/edited/etc.(必須)
-delegate-fromAttacker controlled account to write on the rbcd property of -delegate-to (only when using `-action write`)
-actionAction to operate on msDS-AllowedToActOnBehalfOfOtherIdentity(選択肢: read, write, remove, flush、既定値: read)
-ldaps / -use-ldapsUse LDAPS instead of LDAP
-tsAdds timestamp to every logging output
-debugTurn DEBUG output ON
-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 or KDC (Key Distribution Center) for Kerberos. If omitted it will use the domain part (FQDN) specified in the identity parameter
-dc-hostHostname of the domain controller or KDC (Key Distribution Center) for Kerberos. If omitted, -dc-ip will be used

関連技術: LDAP の self-relative SD、Kerberos の S4U2proxy / PA_PAC_OPTIONS。

LDAP で delegate-to と delegate-from を SID へ解決し、対象属性の security descriptor を取得します。read は許可 SID を表示し、write は allow ACE を追加、remove は該当 ACE を除去、flush は空の descriptor を書き戻します。

RBCD の許可情報は委任元ではなく委任先 computer object の msDS-AllowedToActOnBehalfOfOtherIdentity に格納されます。値は SID の単純な 配列ではなく self-relative security descriptor です。read は descriptor の DACL を解析し、allow ACE の trustee SID を account 名へ解決して表示します。

write は delegate-from の SID を取得し、必要な access mask を持つ allow ACE を構築して既存 DACL へ追加します。remove は指定 SID の ACE だけを除き、 flush は属性全体を空にします。したがって remove と flush は影響範囲が 大きく違い、既存の別 delegate を保持するかどうかが操作の中心です。

LDAP modify へ渡す binary descriptor では revision、owner/group、ACL size、 ACE count が整合していなければなりません。重複 ACE、未知 ACE、解決不能 SID があっても既存情報を失わないよう、parse と再シリアライズの round-trip を 確認します。

シンボル位置責務を追う入口
RBCD69__init__()、read()、write()、remove()、flush()、get_allowed_to_act()、get_user_info()、get_sid_info()
create_empty_sd()36モジュール関数
create_allow_ace()56モジュール関数
parse_args()258モジュール関数
main()300モジュール関数
モジュール使用する主な名前
impacketversion
impacket.exampleslogger, utils
impacket.ldapldaptypes
impacket.examples.utilsinit_ldap_session, parse_identity
import 名配布パッケージ経路・宣言状態
ldap3ldap3直接 import、宣言済み
ldapdomaindumpldapdomaindump直接 import、宣言済み
  • 対象の状態を変更する操作があります。変更前に対象名や SID、パスを確認してください。
  • 失敗時は、名前解決、接続、認証、サービスの状態、権限のどこで止まったかを、プロトコルのステータスから切り分けます。

ldap3、ldapdomaindump、ldaptypes に依存します。create_empty_sd() と create_allow_ace() が binary descriptor を構築します。既存 ACE を保持する action と全消去を混同しないようにしてください。