> For the complete documentation index, see [llms.txt](https://cyb3r.gitbook.io/pentestbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cyb3r.gitbook.io/pentestbook/courses/api-sec.md).

# API SEC

### 1. API Reconnaissance <a href="#user-content-1-api-reconnaissance" id="user-content-1-api-reconnaissance"></a>

#### Passive Reconnaissance <a href="#user-content-passive-reconnaissance" id="user-content-passive-reconnaissance"></a>

* Google Dorks
* Github Dorks
* Shodan Dorks
* Archive.org

#### Active Reconnaissance <a href="#user-content-active-reconnaissance" id="user-content-active-reconnaissance"></a>

* Gobuster
* Amass

### 2. Endpoint Analysis <a href="#user-content-2-endpoint-analysis" id="user-content-2-endpoint-analysis"></a>

* Postman - intercept API requests
* Mitmweb
* mitmproxy2swagger -i flows-2 -o spec.yml -p [http://crapi.apisec.ai](http://crapi.apisec.ai/) -f flow
* mitmproxy2swagger -i flows-2 -o spec.yml -p [http://crapi.apisec.ai](http://crapi.apisec.ai/) -f flow --examples
* editor.swagger.io

### 3. Scanning APIs <a href="#user-content-3-scanning-apis" id="user-content-3-scanning-apis"></a>

* OWASP ZAP
  * Import OpenAPI definition
  * Automated scanner - Manual Explore

### 4. API Authentication Attacks <a href="#user-content-4-api-authentication-attacks" id="user-content-4-api-authentication-attacks"></a>

* sequencer: analyse the randomness of tokens
* jwt\_tool : <https://exploit-notes.hdks.org/exploit/web/jwt-pentesting/> , Portswigger
* crunch 5 5 > keys

### 5. Exploiting API Authorization <a href="#user-content-5-exploiting-api-authorization" id="user-content-5-exploiting-api-authorization"></a>

#### Broken Object Level Authorization (BOLA) <a href="#user-content-broken-object-level-authorization-bola" id="user-content-broken-object-level-authorization-bola"></a>

* Search for IDs in URL and body parameters

#### Broken Function Level Authorization (BFLA) <a href="#user-content-broken-function-level-authorization-bfla" id="user-content-broken-function-level-authorization-bfla"></a>

* Change IDs in CRUD request

### 6. Improper Assets Management <a href="#user-content-6-improper-assets-management" id="user-content-6-improper-assets-management"></a>

* Check for old versions of the API : maybe it still contain old vulnerabilities

### 7. Mass Assignment <a href="#user-content-7-mass-assignment" id="user-content-7-mass-assignment"></a>

* Overwrite object properties
* Add parameters to the user registration process to escalate privilege


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cyb3r.gitbook.io/pentestbook/courses/api-sec.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
