> 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/business-logic/high-level-logic-vulnerability.md).

# Высокоуровневая логическая уязвимость

Заметки по лабораторным работам PortSwigger Web Security Academy о высокоуровневой логической уязвимости, включая рабочий процесс эксплуатации, тестирование полезной нагрузки, проверку в Burp Suite и контекст устранения уязвимости.

### Уязвимость логики высокого уровня

**Описание лабораторной работы**

В этой лабораторной работе данные, предоставленные пользователем, не проверяются должным образом. Можно использовать логический изъян в процессе покупки, чтобы изменить конечную цену товаров. / Цель — купить \*\*

Предоставленный идентификатор:

* **Пользователь**: wiener
* **Пароль**: peter

**Анализ работы корзины**

Когда товар добавляется в корзину, отправляемый запрос выглядит так:

```bash
productId=1&redir=PRODUCT&quantity=1
```

Эта `количество` параметр напрямую контролируется клиентом и не проверяется должным образом на стороне сервера.

**Использование логической ошибки**

Если количество изменить на отрицательное значение, например:

```bash
productId=1&redir=PRODUCT&quantity=-1
```

Общая сумма корзины уменьшается, в результате чего цена становится отрицательной (например, \*\* $1337\*\*).

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8acde11cbf9c6e452a287c320078803934e39e43%2Fimage%20(216).png?alt=media" alt=""><figcaption></figcaption></figure>

Однако при проверке корзины приложение блокирует этот случай сообщением:

> *Общая стоимость корзины не может быть меньше нуля*

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-41fa5b77d97316389bd175440d43d78deca2b277%2Fimage%20(217).png?alt=media" alt=""><figcaption></figcaption></figure>

**Обход ограничения**

Чтобы эксплуатировать уязвимость:

Добавляем **целевая куртка** с допустимым количеством:

```bash
productId=1&redir=PRODUCT&quantity=1
```

Затем добавьте другой товар с отрицательным количеством, чтобы уменьшить итог:

```bash
productId=2&redir=PRODUCT&quantity=-100
```

Это приводит к сильно отрицательному итогу (например, **-$6241.00**).

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-db6d0a58cfd28884432dd1fa84d4b5a913fc6dda%2Fimage%20(218).png?alt=media" alt=""><figcaption></figcaption></figure>

Подберите отрицательное значение (например, `-17`) так, чтобы итоговая сумма оставалась **положительной**, но очень низкой (менее $100).

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e028396766a54310bef40d6aa24e67fa4a6f2abd%2Fimage%20(220).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ru/web/business-logic/high-level-logic-vulnerability.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
