> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/pt-br/web-vulnerabilities/json-web-token-jwt-attack/jwt-pivoting-user-pentesting-web.md).

# Pivotamento de usuário via JWT

## JWT-null:

Nos autenticamos como um **usuário normal** "usuário" com privilégios de *convidado*:

<figure><img src="/files/8b12b908719cf15053e47429c8e35d10df21e465" alt="" width="563"><figcaption></figcaption></figure>

Observamos que temos um **cookie de sessão** em JWT:

<figure><img src="/files/770fb251f96f86ab2860d5a40906d63d90a2fa1a" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/d2e85a84f3390054f2234a2637e2bc65e9d31c47" alt=""><figcaption></figcaption></figure>

Do **terminal**, traduzimos em **base64** o "Header" e o "Payload" ao alterar o número de identificação, então removemos a "Verify signature":

<figure><img src="/files/c4fc941c6c2a3b9d84a3a47fc0d929d56d6ce765" alt=""><figcaption></figcaption></figure>

Colamos o novo **cookie de sessão** e obtemos privilégios de *normal*:

<figure><img src="/files/ed157252b31d57511ab3dcbd0ff0786f696cc60f" alt=""><figcaption></figcaption></figure>

## JWT-secret

Ao testar o método JWT null, isso **não funcionaria** e a tentativa falharia.

<figure><img src="/files/6454afc83b485017706ba2a592a936979f27903a" alt="" width="563"><figcaption></figcaption></figure>

A ideia seria tentar senhas no **Verificar assinatura**, com brute force ou alguma engenharia reversa para obter o cookie:

<figure><img src="/files/0c96bb3c5da91e07080602f7e7210068edf9960b" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/bfb480b5a767e8e144e5eefeddef014422c04b1a" alt=""><figcaption></figcaption></figure>


---

# 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, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/pt-br/web-vulnerabilities/json-web-token-jwt-attack/jwt-pivoting-user-pentesting-web.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
