> 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/business-logic/inconsistent-handling-of-exceptional-input.md).

# Tratamento inconsistente de entrada excepcional

Notas sobre tratamento inconsistente de entrada excepcional para os laboratórios do PortSwigger Web Security Academy, incluindo fluxo de exploração, teste de payload, validação no Burp Suite e contexto de remediação.

### Tratamento inconsistente de entrada excepcional

**Descrição do laboratório**

Este laboratório mostra uma validação deficiente das entradas do usuário no processo de registro. Essa falha lógica permite acesso a recursos administrativos normalmente reservados aos funcionários. / Objetivo: acessar o painel de administração e excluir usuário **carlos**.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e4a529e2bc653e3fe5ba0cccc3d7114956f7b102%2F%7BF003D286-BE02-4F2A-A816-581F8D5EEF6F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Observação inicial**

Ao se registrar, um e-mail de validação é enviado para o endereço fornecido. / O servidor operacional recebe \*\*todos os e-mails\*\* associados ao domínio e a seus subdomínios:

```bash
@exploit-0a8c00a504628ac58246f51601c6009c.exploit-server.net
```

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d8344705c03e2f692e4bd0c5a87cb3460647bd02%2F%7B063204D9-9DAA-44FD-87D3-B28E73186EE9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Assim, qualquer endereço criado com esse domínio ou seus subdomínios é admissível.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-829269752bb8c018da9d2f097e055255937c3a54%2F%7B73C4204C-B05E-4969-9F0E-374462F4F4DE%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Comportamento anormal identificado**

Ao criar um endereço de e-mail contendo uma quantidade muito grande de caracteres antes do `@` símbolo, constatamos que o campo \*\*

{% code overflow="wrap" %}

```bash
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA@exploit-0a8c00a504628ac58246f51601c6009c.exploit-server.net
```

{% endcode %}

Essa limitação causa uma inconsistência entre o valor realmente armazenado e o exibido ou usado para verificações de segurança.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6458d90e182103302637ff5b65065df70258bb69%2F%7BDE810C79-066D-481B-A041-FDD7561AE051%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Funcionamento da falha**

O objetivo é forçar a truncagem para que o e-mail registrado termine exatamente com o `dontwannacry.com` área de confiança.

Verificação de comprimento:

{% code overflow="wrap" %}

```bash
eecho -n "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA@dontwannacry.com" | wc -c
```

{% endcode %}

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ba30042f34b216d452854ad38593a28b71fc2bee%2F%7B74ECAC2C-F3D0-4129-A380-21927E7EFF8B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Uma vez alcançados os 255 caracteres, o endereço final é construído desta forma:

{% code overflow="wrap" %}

```bash
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA@dontwannacry.com.exploit-0a8c00a504628ac58246f51601c6009c.exploit-server.net
```

{% endcode %}

O servidor operacional recebe o e-mail sem problemas, pois aceita todos os subdomínios.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ace3340e0a7a6742be84850375e76f11e62f9a95%2F%7B5754FFC3-BB9A-493B-93FC-4DCE114D9A0F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

A aplicação, após a truncagem, interpreta o endereço como pertencente ao `dontwannacry.com` domínio.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9f8f0b0cd19e23b39fd8836377ce8dd0f6208deb%2F%7B93850A5C-CF01-4546-B764-B99452FC0F3B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

A conta é considerada interna ou confiável. / Uma vez conectado, o acesso ao **Painel de Administração** é permitido sem controle adicional.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7970720e563c151a759f90b50cd4deac274c5ebd%2F%7BC6B8D516-BD7F-4F2B-9990-8657AE424C98%7D.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/pt-br/web/business-logic/inconsistent-handling-of-exceptional-input.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.
