コンテンツにスキップ

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

mimikatz の RPC サーバーに接続し、対話入力またはファイルからコマンドを送ります。

項目内容
実装examples/mimikatz.py
カテゴリリモート実行 / WMI / サービス
規模238 行
配布setup.py の scripts=examples/*.py によりスクリプトとしてインストール

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

引数説明
target[[domain/]username[:password]@]
-fileinput file with commands to execute in the mini shell
-debugTurn DEBUG output ON
-tsAdds timestamp to every logging output
-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 omitted it will 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

target と資格情報から RPC transport を構成し、mimikatz interface へ bind します。MimikatzShell が入力を一行ずつ protocol request へ変換し、応答文字列を decode・表示します。-file では同じ onecmd() 経路へ batch 入力します。

このコマンド自身が remote process へ code injection するのではなく、対象上で 既に利用可能な mimikatz RPC server の interface を client として呼びます。 target から DCE/RPC transport/string binding を作り、定義済み interface UUID へ bind した後、入力 command を NDR request structure に格納します。

MimikatzShell は local の cmd.Cmd loop と remote RPC request を分離します。 空行の再実行を抑止し、shell は local OS command、その他は remote mimikatz command として onecmd()/default() から送信します。-file も各行を同じ dispatch 経路に通すため、interactive と batch で protocol behavior がずれません。

応答は server が返す encoded buffer を文字列へ変換して表示します。RPC server 未導入、interface UUID 不一致、server command error、文字 encoding failure は 別の層です。新 command を client 側で解釈しすぎず、server へ渡す byte 列と local shell command の境界を明確に保ちます。

シンボル位置責務を追う入口
MimikatzShell45__init__()、emptyline()、precmd()、default()、onecmd()、do_exit()、do_shell()、do_help()
main()114モジュール関数
モジュール使用する主な名前
impacketversion
impacket.dcerpc.v5epm, mimilib
impacket.dcerpc.v5.rpcrtRPC_C_AUTHN_GSS_NEGOTIATE, RPC_C_AUTHN_LEVEL_PKT_PRIVACY
impacket.dcerpc.v5.transportDCERPCTransportFactory
impacket.exampleslogger
impacket.examples.utilsparse_target
import 名配布パッケージ経路・宣言状態
Cryptodomepycryptodomex直接 import、宣言済み
  • 対象の状態を変更する操作があります。変更前に対象名や SID、パスを確認してください。
  • 失敗時は、名前解決、接続、認証、サービスの状態、権限のどこで止まったかを、プロトコルのステータスから切り分けます。

dcerpc.v5.transport と mimikatz RPC interface、共通 target parser に依存します。shell の local shell command と remote command を混同しないこと、server 未導入時の RPC error を保つことが重要です。