> For the complete documentation index, see [llms.txt](https://sec88.0x88.online/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sec88.0x88.online/api-sec/api-token-attacks.md).

# API Token Attacks

## Token Analysis with Burp Suite Sequencer

#### Analysis Process

* Utilize Burp Suite to analyze tokens for predictability and aid in token forgery attacks.
* Proxy the API authentication request to Burp Suite.
* Forward the request to Sequencer for token analysis.
* Use Live Capture to interact with the target and capture live tokens.
* Define the custom location of the token within the response for analysis.

#### Live Capture and Analysis

1. Configure the custom location of the token.
2. Start live capture to process thousands of requests.
3. Use the "Analyze now" button to see results sooner.
4. Evaluate the randomness and complexity of the analyzed tokens.
5. Identify predictable patterns or weaknesses in the token generation process.

#### Example: crAPI Token Analysis

* Demonstrates that tokens generated by crAPI seem sufficiently random and complex.
* Sequencer helps identify if tokens are predictable or lack randomness.
* Sequential token generation can lead to predictable tokens, even if seemingly complex.

#### Poor Token Generation Process

* Analyze "bad tokens" from the Hacking APIs Github repository.
* Use the Manual load option to provide a set of bad tokens.
* Analyze the tokens to identify patterns or weaknesses in the token generation process.

## JWT Attacks

#### [JWT Security](/web-appsec/improper-authentication/jwt-security.md)

#### JWT Tool

* Utilize the jwt\_tool for JWT attacks.
* Example Commands:

  ```bash
  $ jwt_tool -t http://target-name.com/ -rh "Authorization: Bearer JWT_Token" -M pb
  $ jwt_tool -t http://127.0.0.1:8888/identity/api/v2/user/dashboard -rh "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..."
  ```

#### Types of JWT Attacks

1. The None Attack
2. The Algorithm Switch Attack

   ```bash
   $ jwt_tool eyJhbGciOiJIUzUxMiJ9... -X a
   ```
3. JWT Crack Attack

   ```bash
   $ crunch 5 5 -o crAPIpw.txt
   $ jwt_tool TOKEN -C -d /wordlist.txt
   ```

These techniques allow you to analyze tokens for vulnerabilities, identify weaknesses in token generation, and perform targeted attacks, such as JWT manipulation and cracking. By understanding the characteristics of tokens, you can enhance the security of the API authentication process.


---

# 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://sec88.0x88.online/api-sec/api-token-attacks.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.
