Skip to content
ispectr3Public

About

Automated BOLA/IDOR Authorization Vulnerability Auditor for REST APIs with SARIF 2.1.0 Export

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Bolt-API

Automated BOLA / IDOR Authorization Vulnerability Auditor for REST APIs

CI License: MIT Python: 3.10+ Zero Dependencies

Bolt-API is an automated application security auditor designed to detect Broken Object Level Authorization (BOLA / IDOR, CWE-639) and Broken Function Level Authorization (BFLA, CWE-284) across REST APIs. By executing differential authorization tests between distinct identity contexts (Owner vs Attacker vs Anonymous), Bolt-API detects when tenant boundaries fail to be enforced at the data layer.


Architectural Workflow

flowchart TD
    subgraph Spec Ingestion
        A[OpenAPI 3.0 / Swagger JSON] --> B[Path Parameter Mapper]
        B --> C{Parameter Analysis}
        C -->|Integer / Predictable ID| D1[CWE-340 Alert]
        C -->|UUID / MongoID| D2[ID Mutation Engine]
    end

    subgraph Differential Authorization Matrix
        D2 --> E1["Baseline Request: User A (Owner Token)"]
        D2 --> E2["Cross-Tenant Request: User B (Attacker Token)"]
        D2 --> E3["Unauthenticated Request: Anonymous"]
    end

    subgraph Evaluation Engine
        E1 --> F{User A 200 OK?}
        F -->|Yes| G{User B 200 OK?}
        G -->|Yes| H["CRITICAL: BOLA Confirmed (CWE-639)"]
        E3 --> I{Anonymous 200 OK?}
        I -->|Yes| J["HIGH: Missing Auth (CWE-284)"]
        H --> K[SARIF 2.1.0 / Terminal Report / CI Exit Code]
        J --> K
    end
Loading

Authorization Matrix Comparison Logic

Scenario User A (Owner) User B (Attacker) Anonymous Security Assessment Severity
Secure Endpoint 200 OK 403 Forbidden 401 Unauthorized Proper object-level authorization Pass
BOLA Read 200 OK 200 OK 401 Unauthorized Cross-tenant data leakage (OWASP API1:2023) HIGH
BOLA Mutation / Delete 200 OK 200 OK 401 Unauthorized Unauthorized object modification/deletion CRITICAL
Missing Authentication 200 OK 200 OK 200 OK Public unauthenticated object exposure HIGH

Technical Highlights

  • Zero External Dependencies: Pure Python standard library implementation (urllib.request, json, argparse, socketserver).
  • OpenAPI 3.0/3.1 & Swagger 2.0 Ingestion: Automatically discovers path parameters, HTTP methods, and required security schemes from API schemas.
  • Identifier Mutation & Entropy Analysis: Evaluates ID predictability and generates boundary mutations (N-1, N+1, Nil UUID, zero-bytes).
  • Native SARIF 2.1.0 Output: Emits OASIS SARIF reports directly ingestible by GitHub Advanced Security Code Scanning and GitLab Security Dashboards.
  • Embedded Mock Testbed: Ships with a built-in vulnerable API server (bolt-api testbed) for immediate validation, local reproducibility, and CI verification.

Installation

Method 1: Local CLI Symlink (Recommended)

git clone https://github.com/ispectr3/bolt-api.git
cd bolt-api
./install.sh

Method 2: Standard Python Package

pip install .

Usage Guide

1. Starting the Built-in Testbed (Optional Demo Target)

Bolt-API includes a testbed exhibiting real BOLA and missing-auth vulnerabilities:

bolt-api testbed --port 5050

2. Running an Authorization Scan

Execute differential authorization testing against an API endpoint with an OpenAPI schema:

bolt-api scan \
  --url "http://127.0.0.1:5050" \
  --openapi "http://127.0.0.1:5050/openapi.json" \
  --user-a "Bearer alice-token" \
  --user-b "Bearer bob-token" \
  --id "1001"

Output:

⚡ Bolt-API — BOLA / IDOR Vulnerability Assessment
Target: http://127.0.0.1:5050 | Endpoints Audited: 3

Severity     Type             Method   Endpoint                       Target ID
--------------------------------------------------------------------------------
[HIGH    ] BOLA_READ        GET      /api/documents/{doc_id}        1001
[MEDIUM  ] PREDICTABLE_ID   GET      /api/documents/{doc_id}        1001
[CRITICAL] BOLA_DELETE      DELETE   /api/documents/{doc_id}        1001
[MEDIUM  ] PREDICTABLE_ID   DELETE   /api/documents/{doc_id}        1001

Detailed Evidence:

[1] GET /api/documents/{doc_id} — BOLA_READ (HIGH)
    Description: Attacker (User-B (Attacker)) unauthorizedly read User A's private resource via GET api/documents/1001
    Evidence:    Owner (User-A (Owner)) status: 200. Attacker (User-B (Attacker)) status: 200. Object ID '1001' was exposed across tenants.
    Remediation: Validate tenant/user ownership in authorization logic before fulfilling request.

[2] DELETE /api/documents/{doc_id} — BOLA_DELETE (CRITICAL)
    Description: Attacker (User-B (Attacker)) unauthorizedly deleted User A's resource via DELETE api/documents/1001
    Evidence:    Owner (User-A (Owner)) status: 200. Attacker (User-B (Attacker)) status: 200. Object ID '1001' was exposed across tenants.
    Remediation: Validate tenant/user ownership in authorization logic before fulfilling request.

3. Static OpenAPI Surface Audit

Inspect an OpenAPI file to map IDOR attack surfaces and public endpoints before launching network requests:

bolt-api audit-spec --spec openapi.json

CI/CD Pipeline & SARIF Integration

Generate a SARIF 2.1.0 report for upload to GitHub Code Scanning:

bolt-api scan \
  --url "https://staging.api.internal" \
  --openapi "./openapi.json" \
  --user-a "$USER_A_TOKEN" \
  --user-b "$USER_B_TOKEN" \
  --sarif "findings.sarif"

GitHub Actions workflow snippet:

- name: Run Bolt-API Scan
  run: |
    bolt-api scan --url "$API_URL" --openapi "$SPEC_URL" --user-a "$TOKEN_A" --user-b "$TOKEN_B" --sarif results.sarif

- name: Upload SARIF to GitHub Security Tab
  uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: results.sarif

Testing

Run unit and integration tests against local mock endpoints:

python3 -m unittest discover tests -v

License

Bolt-API is open-source software licensed under the MIT License.

About

Automated BOLA/IDOR Authorization Vulnerability Auditor for REST APIs with SARIF 2.1.0 Export

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages