> 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/ru/web-vulnerabilities/json-web-token-jwt-attack/jwt-pivoting-user-pentesting-web.md).

# Переход на другого пользователя через JWT

## JWT-null:

Мы аутентифицируемся как **обычный пользователь** "user" с привилегиями *гость*:

<figure><img src="/files/0b06883963609f990fcfa9c8479774ecb606092a" alt="" width="563"><figcaption></figcaption></figure>

Мы наблюдаем, что у нас есть **cookie сеанса** в JWT:

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

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

Из **терминала**, мы переводим en **base64** «Header» и «Payload» en изменяя номер идентификации, затем мы удаляем «Verify signature»:

<figure><img src="/files/14670729b49f160b2dbf2dbcd2e5f96f92f5830e" alt=""><figcaption></figcaption></figure>

Мы вставляем новый **cookie сеанса** и получаем привилегии *обычный*:

<figure><img src="/files/8dbaecf19131496311e3668e309e71d7770ee4fa" alt=""><figcaption></figcaption></figure>

## JWT-secret

При тестировании метода JWT null это **не сработает** и попытка бы провалилась.

<figure><img src="/files/327d09971b65e4fefd9575f627c77098952b0531" alt="" width="563"><figcaption></figcaption></figure>

Идея заключалась бы в том, чтобы попробовать пароли в **Проверка подписи**, с помощью перебора или некоторого реверс-инжиниринга, чтобы получить cookie:

<figure><img src="/files/3110e21a83c94ab0394b5d942a939ecdc3a8b646" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/786379131037191719060b0239f7dc15725931bc" 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/ru/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.
