コンテンツにスキップ

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

リモートホストから SYSTEM の DPAPI 資格情報と SCCM クライアントの秘密情報を取得し、DPAPI_SYSTEM 鍵で復号します。

項目内容
実装examples/dpapidump.py
カテゴリ秘密情報 / DPAPI / レジストリ / ファイル解析
規模507 行
配布setup.py の scripts=examples/*.py によりスクリプトとしてインストール

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

引数説明
-credsExtract SYSTEM user DPAPI credentials (default: all)
-sccmExtract SCCM client credentials (default: all)
-userkeydpapi_userkey for SYSTEM (e.g. if previously dumped using secretsdump). If not provided an LSA secrets dump will be performed to retrieve it.
target[[domain/]username[:password]@]
-tsAdds timestamp to every logging output
-debugTurn DEBUG output ON
-com-versionDCOM version, format is MAJOR_VERSION:MINOR_VERSION e.g. 5.7
-bootkeybootkey for SYSTEM hive
-throttleThrottle in seconds between operations
-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)
-keytabRead keys for SPN from keytab file
-rpc-auth-leveldefault, integrity (RPC_C_AUTHN_LEVEL_PKT_INTEGRITY) or privacy (RPC_C_AUTHN_LEVEL_PKT_PRIVACY). For example CIM path “root/MSCluster” would require privacy level by default)(選択肢: integrity, privacy, default)
-dc-ipIP Address of the domain controller. If ommited it use the domain part (FQDN) specified in the target parameter
-target-ipIP Address of the target machine. If omitted it will use whatever was specified as target. This is useful when target is the NetBIOS name and you cannot resolve it

SMB へ接続し、Remote Registry/LSA から boot key と DPAPI_SYSTEM を取得します。対象 directory/file または WMI の SCCM policy 情報を列挙し、master key GUID と blob を対応付けて復号・表示します。throttle を適用し、終了時に remote service/connection を戻します。

SYSTEM DPAPI secret を remote host から読むには、まず machine の boot key と LSA secret DPAPI_SYSTEM が必要です。connect() が SMB session を作り、 RemoteOperations が Remote Registry/LSA に必要な状態を準備し、 getDPAPI_SYSTEM() が machine/user DPAPI key material を取り出します。

credential 経路では system profile 以下の master key file と credential file を SMB で列挙します。各 DPAPI_BLOB は master key GUID を持つため、 decideBlobMasterkey() が取得済み master key と対応付け、machine key で master key を復号した後に個別 blob を復号します。GUID/cache の対応を誤ると 単なる padding error に見えるため、段階を分けています。

SCCM 経路では DCOM/WMI から policy/secret 情報を取得し、DPAPI で保護された 部分を同じ key hierarchy へ渡します。WMI、SMB、Remote Registry のどこまで 利用するかは option で変わります。remote service 状態、一時 file、DCOM connection を cleanup() で戻し、throttle は WMI/SMB への連続要求を制御します。

シンボル位置責務を追う入口
DumpCreds48__init__()、connect()、getDPAPI_SYSTEM()、getFileContent()、decryptBlob()、decideBlobMasterkey()、addPolicySecret()、dump()、cleanup()
モジュール使用する主な名前
impacketversion
impacket.exampleslogger
impacket.examples.utilsparse_target
impacket.dcerpc.v5.dtypesNULL
impacket.dcerpc.v5.dcomwmi
impacket.dcerpc.v5.dcomrtCOMVERSION, DCOMConnection
impacket.dcerpc.v5.dcom.wmiDCERPCSessionError
impacket.dcerpc.v5.rpcrtRPC_C_AUTHN_LEVEL_PKT_INTEGRITY, RPC_C_AUTHN_LEVEL_PKT_PRIVACY
impacket.smbconnectionSMBConnection
impacket.dpapiCREDENTIAL_BLOB, CredentialFile, DPAPI_BLOB, MasterKey, MasterKeyFile
impacket.uuidbin_to_string
impacket.examples.regsecretsLSASecrets, RemoteOperations
impacket.krb5.keytabKeytab
  • 照会や認証の試行が中心です。実行回数が多いと監査ログやアカウントロック、対象の負荷に影響します。
  • オプションによりローカルファイルを作成または更新します。既存ファイルの扱いと秘密情報を含む出力の権限を確認してください。
  • remote service、task、file、share、WMI/RPC resource などの一時資源を利用する経路があります。異常終了時の回収も動作契約です。
  • 失敗時は、名前解決、接続、認証、サービスの状態、権限のどこで止まったかを、プロトコルのステータスから切り分けます。
  • 後始末に関係する実装として cleanup() があります。新しい早期 return や例外経路でも到達するか確認します。

SMBConnection、examples.regsecrets、impacket.dpapi、DCOM/WMI、RPC auth-level に依存します。DumpCreds.dump() が収集を、decideBlobMasterkey() / decryptBlob() が key 選択と復号を担当します。