mitm-find-bizlogic について
mitm-find-bizlogic は、mitmproxy の通信ログからビジネスロジックの脆弱性を探すセキュリティテスト用スキルです。アプリケーションの検査向けに、決済、検証、レート制限、競合状態、ワークフローを検索パターンとテスト手順で扱います。
主な機能
- 01mitmproxy の log.txt を分析
- 02決済・価格操作の兆候を検索
- 03検証・レート制限の回避を確認
- 04競合状態とワークフローの欠陥を特定
- 05深刻度別に問題を整理
活用シーン
- 01クーポンの重複利用リスクの確認
- 02メール変更時の検証フローのテスト
- 03チェックアウト手順の回避を調査
- 04取引エンドポイントの並行処理を検査
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ instavm/ security-skills --skill mitm-find-bizlogicインストール後、Claude Code で/mitm-find-bizlogicを入力して読み込まれたか確認します。
詳細
ビジネスロジックの脆弱性を検出する
次の対象について、mitmproxy のダンプ(log.txt)を分析し、ビジネスロジックの欠陥を見つけます:$ARGUMENTS
必要条件:カレントディレクトリに
log.txtが必要です。ファイルがない場合は、先にトラフィックをキャプチャしてください。mitmdump --set flow_detail=3 2>&1 | tee log.txt
注目すべきビジネスロジックのパターン(HackerOne の実際の報奨金レポート 376 件より)
1. 決済/価格の改ざん
報奨金事例:
- Uber:paymentProfileUUID の回避による無料乗車
- 返金目的での負の数量の指定
- カート内の価格改ざん
- クーポン/プロモーションコードの併用
- 通貨換算の悪用
検索パターン:
grep -iE '(price|amount|total|cost|fee|discount|coupon|promo|payment)' log.txt
grep -iE '(quantity|qty|count|num)[=:]["'\'']?-?[0-9]+' log.txt
2. アカウント/メールアドレス認証の回避
事例:
- Acronis:未認証のメールアドレス変更によるアカウント乗っ取り
- 認証なしでのメールアドレス変更
- 電話番号認証の回避
- 不完全なアカウント削除
検索パターン:
grep -iE '(verify|confirm|validate|activate|email|phone)' log.txt
grep -iE '(change|update).*(email|phone|password)' log.txt
3. レート制限/ブルートフォース攻撃の回避
事例:
- OTP 認証にレート制限がない
- ログイン試行回数の制限を回避
- 並列リクエストの悪用
- API 経由での CAPTCHA 回避
検索パターン:
grep -iE '(otp|code|pin|token|verify)' log.txt
grep -iE '(limit|rate|attempts|retry|captcha)' log.txt
4. 競合状態
事例:
- ウォレットでの二重支払い
- クーポンの同時使用
- 並列の送金リクエスト
- 競合を利用した投票の改ざん
確認事項:
- Financial transactions (transfer, payment, redeem)
- Limited resource operations (claim, reserve, book)
- State-changing operations (status update, approve)
5. ワークフロー/状態の回避
事例:
- 複数段階のプロセスで手順をスキップ
- サブスクリプションなしで機能にアクセス
- 承認ワークフローの回避
- 試験/クイズの結果を改ざん
検索パターン:
grep -iE '(step|stage|phase|status|state|workflow|approve)' log.txt
grep -iE '(submit|complete|finish|process)' log.txt
脆弱性のカテゴリと深刻度
| 種類 | 深刻度 | 影響 |
|---|---|---|
| 決済の回避/改ざん | CRITICAL | 金銭的損失 |
| ロジックの欠陥によるアカウント乗っ取り | CRITICAL | アカウントの完全な侵害 |
| ワークフローを介した権限昇格 | HIGH | 不正アクセス |
| プレミアム機能の無料利用 | HIGH | 収益の損失 |
| データの改ざん | MEDIUM | 完全性の問題 |
| レート制限の回避 | MEDIUM | 悪用の可能性 |
| ロジックを介した情報漏えい | LOW | プライバシーの漏えい |
テスト方法
ステップ 1:ビジネスフローをマッピングする
# Find transaction-related endpoints
grep -iE 'POST.*(order|payment|checkout|cart|purchase|subscribe|redeem)' log.txt
# Find state-changing endpoints
grep -iE 'POST.*(update|change|modify|set|create|delete)' log.txt
# Find verification flows
grep -iE '(verify|confirm|validate|check|otp|code)' log.txt
ステップ 2:パラメーターの改ざんをテストする
# Price manipulation
# Original: {"price": 100, "quantity": 1}
# Test: {"price": 1, "quantity": 1}
# Test: {"price": 100, "quantity": -1}
# Status manipulation
# Original: {"status": "pending"}
# Test: {"status": "approved"}
# Role manipulation
# Original: {"plan": "free"}
# Test: {"plan": "premium"}
ステップ 3:競合状態をテストする
# Send concurrent requests
for i in {1..10}; do
curl -X POST 'https://target.com/api/redeem' -d '{"code":"PROMO123"}' &
done
wait
# Check if code was redeemed multiple times
ステップ 4:ワークフローの回避をテストする
# Skip step 2, go directly to step 3
curl 'https://target.com/api/checkout/step3' -d '{"order_id":"123"}'
# Access premium without subscription
curl 'https://target.com/api/premium/feature' -H 'Cookie: free_user_session'
実際の攻撃シナリオ
シナリオ 1:支払いプロファイルの回避による無料乗車
1. Capture ride request with paymentProfileUUID
2. Remove or modify paymentProfileUUID field
3. Server doesn't validate, processes ride without payment
4. Unlimited free rides
シナリオ 2:メールアドレス変更によるアカウント乗っ取り
1. Victim signs up with email but doesn't verify
2. Attacker changes email via API (no verification required)
3. Attacker now controls account with their email
4. Reset password → full takeover
シナリオ 3:クーポンの競合状態
1. Find single-use coupon worth $100
2. Send 10 concurrent redeem requests
3. Race condition allows multiple redemptions
4. Get $1000 discount instead of $100
シナリオ 4:試験のスコア改ざん
1. Take online exam, submit answers
2. Intercept response with score
3. Find score calculation endpoint
4. Replay with modified answers or directly set score
改ざんするパラメーター
金融関連のパラメーター
price, amount, total, subtotal, tax
discount, discount_percent, coupon_value
quantity, qty, count, num
currency, currency_code
payment_method, payment_id
tip, fee, shipping_cost
ステータス/状態のパラメーター
status, state, phase, step
is_verified, is_active, is_premium
approved, confirmed, completed
role, plan, tier, subscription
ID 関連のパラメーター
user_id, account_id, profile_id
email, phone, username
referral_code, invite_code
出力形式
## Business Logic Finding: [Brief Description]
**Endpoint**: `METHOD https://target.com/path`
**Flow**: [Payment|Registration|Verification|Workflow]
**Severity**: [CRITICAL|HIGH|MEDIUM|LOW]
**Normal Flow**:
1. User does X
2. Server validates Y
3. Action Z occurs
**Exploit Flow**:
1. User does X
2. User manipulates [parameter]
3. Server fails to validate
4. Unauthorized action occurs
**Evidence**:
[Request/response showing manipulation]
**Impact**:
- Financial loss of $X per abuse
- Account compromise
- Unauthorized access to premium features
**Test Command**:
curl -X POST 'https://target.com/...' -d '{"manipulated":"value"}'
**Remediation**:
- Server-side validation of all parameters
- Signed/encrypted values for sensitive data
- Idempotency keys for financial operations
- Rate limiting on sensitive endpoints
無視する誤検知
- クライアント側のみの計算(サーバー側で検証済み)
- 改ざんするとエラーが返るパラメーター
- 本番環境以外のデバッグ/テスト用エンドポイント
- 意図的に緩く設定されたレート制限
- 意図的に無料/アクセス可能にされている機能
コメント
Markdown 対応