
パスワードマネージャーやWindowsユーティリティにインジェクションを行い、DLLプロキシ、COMハイジャック、AppDomainManagerインジェクションを介して認証情報を収集する、ポストエクスプロイテーション型の認証情報収集ツールキット。
ThievingFoxは、さまざまなパスワードマネージャーやWindowsユーティリティから認証情報を収集するための、ポストエクスプロイテーションツールのコレクションです。 各モジュールは、ターゲットプロセスへの特定のインジェクション手法を利用し、内部関数をフックして認証情報を収集します。
関連するブログ記事はこちらでご覧いただけます。
Rustupをインストールする必要があります。こちらの手順に従ってください:https://rustup.rs/
mingw-w64パッケージをインストールする必要があります。 Debianでは、以下のコマンドでインストールできます:
apt install mingw-w64
Rustにはx86およびx86_64のWindowsターゲットの両方をインストールする必要があります:
rustup target add x86_64-pc-windows-gnu
rustup target add i686-pc-windows-gnu
MonoとNugetもインストールする必要があります。手順はこちら:https://www.mono-project.com/download/stable/#download-lin
Monoリポジトリを追加した後、Nugetはaptでインストールできます:
apt install nuget
最後に、Pythonの依存関係をインストールする必要があります:
pip install -r client/requirements.txt
ThievingFoxはpython >= 3.11で動作します。
Rustupをインストールする必要があります。こちらの手順に従ってください:https://rustup.rs/
Rustにはx86およびx86_64のWindowsターゲットの両方をインストールする必要があります:
rustup target add x86_64-pc-windows-msvc
rustup target add i686-pc-windows-msvc
.NET開発環境もインストールする必要があります。Visual Studioから、ツール > ツールと機能を取得 > 「.NET デスクトップ開発」をインストール に移動してください。
最後に、Pythonの依存関係をインストールする必要があります:
pip install -r client/requirements.txt
ThievingFoxはpython >= 3.11で動作します。
注意:WindowsホストでKeePassモジュールを使用するには、msbuildがPATHに含まれている必要があります。これは、Visual Studioの開発者用PowerShell(ツール > コマンドライン > 開発者用PowerShell)からクライアントを実行することで実現できます。
すべてのモジュールは以下のWindowsバージョンでテストされています:
| Windowsバージョン |
|---|
| Windows Server 2022 |
| Windows Server 2019 |
| Windows Server 2016 |
| Windows Server 2012R2 |
| Windows 10 |
| Windows 11 |
[!CAUTION] モジュールは他のバージョンではテストされておらず、動作しないことが予想されます。
[!CAUTION] これらのツールが対象アプリケーションの安定性に影響を与えないように努めていますが、インラインフッキングやライブラリインジェクションは安全ではなく、クラッシュやアプリケーションの不安定化を引き起こす可能性があります。そのような場合、ターゲットで
cleanupモジュールを使用すれば、次回アプリケーションを起動するときにインジェクションやフッキングが行われないようにするのに十分のはずです。
ThievingFoxには3つの主要モジュールがあります:poison、cleanup、collect。
コマンドライン引数で指定された各アプリケーションについて、poisonモジュールはハイジャックされる元のライブラリを取得し(COMハイジャッキングおよびDLLプロキシ用)、元のDLLのプロパティに一致するライブラリをコンパイルし、サーバーにアップロードし、必要に応じてレジストリを変更してCOMハイジャッキングを実行します。
すべてのライブラリのコンパイルを高速化するために、client/cache/にキャッシュが保持されます。
--mstsc、--rdcman、--mobaxtermにはそれぞれ固有のオプションとして--mstsc-poison-hkcr、--rdcman-poison-hkcr、--mobaxterm-poison-hkcrがあります。これらのオプションのいずれかを指定すると、COMハイジャッキングによってHKCRハイブのレジストリキーが置き換えられ、すべてのユーザーに影響が及びます。デフォルトでは、現在ログインしているすべてのユーザー(HKCUハイブを持つすべてのユーザー)のみが影響を受けます。
--keepassおよび--keepassxcには固有のオプションとして、--keepass-path、--keepass-share、--keepassxc-path、--keepassxc-shareがあり、これらのアプリケーションがデフォルト以外のパスにインストールされている場合に指定します。他のアプリケーションではCOMハイジャッキングが使用されるため、これは必要ありません。
KeePassモジュールでは、ターゲットにVisual C++ 再頒布可能パッケージがインストールされている必要があります。
複数のアプリケーションを同時に指定することも、--allフラグを使用してすべてのアプリケーションをターゲットにすることもできます。
[!IMPORTANT] ディレクトリ名がネイティブDLL内に埋め込まれているため、
--tempdirパラメータを変更した場合はキャッシュをクリーンアップすることを忘れないでください。
$ python3 client/ThievingFox.py poison -h
usage: ThievingFox.py poison [-h] [-hashes HASHES] [-aesKey AESKEY] [-k] [-dc-ip DC_IP] [-no-pass] [--tempdir TEMPDIR] [--keepass] [--keepass-path KEEPASS_PATH]
[--keepass-share KEEPASS_SHARE] [--keepassxc] [--keepassxc-path KEEPASSXC_PATH] [--keepassxc-share KEEPASSXC_SHARE] [--mstsc] [--mstsc-poison-hkcr]
[--consent] [--logonui] [--rdcman] [--rdcman-poison-hkcr] [--mobaxterm] [--mobaxterm-poison-hkcr] [--all]
target
positional arguments:
target Target machine or range [domain/]username[:password]@<IP or FQDN>[/CIDR]
options:
-h, --help show this help message and exit
-hashes HASHES, --hashes HASHES
LM:NT hash
-aesKey AESKEY, --aesKey AESKEY
AES key to use for Kerberos Authentication
-k Use kerberos authentication. For LogonUI, mstsc and consent modules, an anonymous NTLM authentication is performed, to retrieve the OS version.
-dc-ip DC_IP, --dc-ip DC_IP
IP Address of the domain controller
-no-pass, --no-pass Do not prompt for password
--tempdir TEMPDIR The name of the temporary directory to use for DLLs and output (Default: ThievingFox)
--keepass Try to poison KeePass.exe
--keepass-path KEEPASS_PATH
The path where KeePass is installed, without the share name (Default: /Program Files/KeePass Password Safe 2/)
--keepass-share KEEPASS_SHARE
The share on which KeePass is installed (Default: c$)
--keepassxc Try to poison KeePassXC.exe
--keepassxc-path KEEPASSXC_PATH
The path where KeePassXC is installed, without the share name (Default: /Program Files/KeePassXC/)
--keepassxc-share KEEPASSXC_SHARE
The share on which KeePassXC is installed (Default: c$)
--mstsc Try to poison mstsc.exe
--mstsc-poison-hkcr Instead of poisonning all currently logged in users' HKCU hives, poison the HKCR hive for mstsc, which will also work for user that are currently not
logged in (Default: False)
--consent Try to poison Consent.exe
--logonui Try to poison LogonUI.exe
--rdcman Try to poison RDCMan.exe
--rdcman-poison-hkcr Instead of poisonning all currently logged in users' HKCU hives, poison the HKCR hive for RDCMan, which will also work for user that are currently not
logged in (Default: False)
--mobaxterm Try to poison MobaXTerm.exe
--mobaxterm-poison-hkcr
Instead of poisonning all currently logged in users' HKCU hives, poison the HKCR hive for MobaXTerm, which will also work for user that are currently not
logged in (Default: False)
--all Try to poison all applications
コマンドライン引数で指定された各アプリケーションについて、cleanupはまず、ターゲットアプリケーションにフッキングライブラリを強制的にロードさせる毒入れアーティファクトを削除します。その後、リモートホストにアップロードされたライブラリを削除しようとします。
HKCUとHKCRの両方のハイブで毒入れをサポートするアプリケーションについては、両方ともクリーンアップされます。
複数のアプリケーションを同時に指定することも、--allフラグを使用してすべてのアプリケーションをクリーンアップすることもできます。
リモートホスト上の抽出された認証情報はクリーンアップしません。
[!IMPORTANT]
cleanupモジュールの実行中に対象アプリケーションが使用中の場合、ターゲットに配置されたDLLは削除できません。それでも、cleanupモジュールはインジェクションを有効にする設定を元に戻すため、次回アプリケーションを起動する際にはインジェクションが行われないことが期待されます。ThievingFoxが削除できないファイルはログに記録されます。
$ python3 client/ThievingFox.py cleanup -h
usage: ThievingFox.py cleanup [-h] [-hashes HASHES] [-aesKey AESKEY] [-k] [-dc-ip DC_IP] [-no-pass] [--tempdir TEMPDIR] [--keepass] [--keepass-share KEEPASS_SHARE]
[--keepass-path KEEPASS_PATH] [--keepassxc] [--keepassxc-path KEEPASSXC_PATH] [--keepassxc-share KEEPASSXC_SHARE] [--mstsc] [--consent] [--logonui]
[--rdcman] [--mobaxterm] [--all]
target
positional arguments:
target Target machine or range [domain/]username[:password]@<IP or FQDN>[/CIDR]
options:
-h, --help show this help message and exit
-hashes HASHES, --hashes HASHES
LM:NT hash
-aesKey AESKEY, --aesKey AESKEY
AES key to use for Kerberos Authentication
-k Use kerberos authentication. For LogonUI, mstsc and consent modules, an anonymous NTLM authentication is performed, to retrieve the OS version.
-dc-ip DC_IP, --dc-ip DC_IP
IP Address of the domain controller
-no-pass, --no-pass Do not prompt for password
--tempdir TEMPDIR The name of the temporary directory to use for DLLs and output (Default: ThievingFox)
--keepass Try to cleanup all poisonning artifacts related to KeePass.exe
--keepass-share KEEPASS_SHARE
The share on which KeePass is installed (Default: c$)
--keepass-path KEEPASS_PATH
The path where KeePass is installed, without the share name (Default: /Program Files/KeePass Password Safe 2/)
--keepassxc Try to cleanup all poisonning artifacts related to KeePassXC.exe
--keepassxc-path KEEPASSXC_PATH
The path where KeePassXC is installed, without the share name (Default: /Program Files/KeePassXC/)
--keepassxc-share KEEPASSXC_SHARE
The share on which KeePassXC is installed (Default: c$)
--mstsc Try to cleanup all poisonning artifacts related to mstsc.exe
--consent Try to cleanup all poisonning artifacts related to Consent.exe
--logonui Try to cleanup all poisonning artifacts related to LogonUI.exe
--rdcman Try to cleanup all poisonning artifacts related to RDCMan.exe
--mobaxterm Try to cleanup all poisonning artifacts related to MobaXTerm.exe
--all Try to cleanup all poisonning artifacts related to all applications
コマンドライン引数で指定された各アプリケーションについて、collectモジュールはリモートホスト上のC:\Windows\Temp\<tempdir>に保存されている、該当アプリケーションの出力ファイルを取得し、復号化します。ファイルはリモートホストから削除され、取得したデータはclient/ouput/に保存されます。
複数のアプリケーションを同時に指定することも、--allフラグを使用してすべてのアプリケーションからログを収集することもできます。
$ python3 client/ThievingFox.py collect -h
usage: ThievingFox.py collect [-h] [-hashes HASHES] [-aesKey AESKEY] [-k] [-dc-ip DC_IP] [-no-pass] [--tempdir TEMPDIR] [--keepass] [--keepassxc] [--mstsc] [--consent]
[--logonui] [--rdcman] [--mobaxterm] [--all]
target
positional arguments:
target Target machine or range [domain/]username[:password]@<IP or FQDN>[/CIDR]
options:
-h, --help show this help message and exit
-hashes HASHES, --hashes HASHES
LM:NT hash
-aesKey AESKEY, --aesKey AESKEY
AES key to use for Kerberos Authentication
-k Use kerberos authentication. For LogonUI, mstsc and consent modules, an anonymous NTLM authentication is performed, to retrieve the OS version.
-dc-ip DC_IP, --dc-ip DC_IP
IP Address of the domain controller
-no-pass, --no-pass Do not prompt for password
--tempdir TEMPDIR The name of the temporary directory to use for DLLs and output (Default: ThievingFox)
--keepass Collect KeePass.exe logs
--keepassxc Collect KeePassXC.exe logs
--mstsc Collect mstsc.exe logs
--consent Collect Consent.exe logs
--logonui Collect LogonUI.exe logs
--rdcman Collect RDCMan.exe logs
--mobaxterm Collect MobaXTerm.exe logs
--all Collect logs from all applications
| アプリケーション | インジェクション手法 |
|---|
| KeePass.exe | AppDomainManagerインジェクション |
| KeePassXC.exe | DLLプロキシ |
| LogonUI.exe (Windowsログイン画面) | COMハイジャッキング |
| consent.exe (Windows UACポップアップ) | COMハイジャッキング |
| mstsc.exe (WindowsデフォルトRDPクライアント) | COMハイジャッキング |
| RDCMan.exe (SysinternalsのRDPクライアント) | COMハイジャッキング |
| MobaXTerm.exe (サードパーティRDPクライアント) | COMハイジャッキング |