> 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

### 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 o usuário **carlos**.

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

**Observação inicial**

Após o registro, um e-mail de validação é enviado para o endereço fornecido. / O servidor em funcionamento recebe \*\*todos os e-mails\*\* associados ao domínio e seus subdomínios:

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

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

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

<figure><img src="/files/27c5bca7791badf1064e0450450e534d43df33fd" alt=""><figcaption></figcaption></figure>

**Comportamento anormal identificado**

Ao criar um endereço de e-mail contendo um número muito grande de caracteres antes do `@` símbolo, descobrimos que o campo \*\*

{% code overflow="wrap" %}

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

{% endcode %}

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

<figure><img src="/files/4ade24867c27d5c781c624ce6b3f92d6e33b8a96" 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 do comprimento:

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="/files/1837290f9c15e86a4853f8673660b924c12bcb7e" alt=""><figcaption></figcaption></figure>

Depois que os 255 caracteres são alcançados, o endereço final é construído desta forma:

{% code overflow="wrap" %}

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

{% endcode %}

O servidor em funcionamento recebe o e-mail normalmente, pois aceita todos os subdomínios.

<figure><img src="/files/5f19aa8c54c3f9c8e0cd40b5b4aaa8c025c3cc28" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/7ce1de61d9375e9248c51deec133578116707a74" 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="/files/c030841877f536d3c4e66c442bd7e820b406dd9e" 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/business-logic/inconsistent-handling-of-exceptional-input.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.
