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

# Manejo inconsistente de entradas excepcionales

Notas sobre Manejo inconsistente de entradas excepcionales para los laboratorios de PortSwigger Web Security Academy, incluido el flujo de explotación, pruebas de payload, validación en Burp Suite y contexto de mitigación.

### Gestión inconsistente de entradas excepcionales

**Descripción del laboratorio**

Este laboratorio muestra una mala validación de las entradas de usuario en el proceso de registro. Este fallo lógico permite acceder a funciones administrativas normalmente reservadas a los empleados. / Objetivo: acceder al panel de administración y eliminar usuario **carlos**.

<figure><img src="https://754079710-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>

**Observación inicial**

Al registrarse, se envía un correo electrónico de validación a la dirección proporcionada. / El servidor operativo recibe \*\*todos los correos electrónicos\*\* asociados al dominio y a sus subdominios:

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

<figure><img src="https://754079710-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>

Por lo tanto, cualquier dirección creada con este dominio o sus subdominios es admisible.

<figure><img src="https://754079710-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>

**Comportamiento anómalo identificado**

Al crear una dirección de correo electrónico que contiene un número muy grande de caracteres antes de la `@` símbolo, encontramos que el campo \*\*

{% code overflow="wrap" %}

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

{% endcode %}

Este límite provoca una inconsistencia entre el valor realmente almacenado y el mostrado o utilizado para las comprobaciones de seguridad.

<figure><img src="https://754079710-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>

**Funcionamiento de la falla**

El objetivo es forzar la truncación para que el correo electrónico registrado termine exactamente con el `dontwannacry.com` área de confianza.

Verificación de longitud:

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="https://754079710-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>

Una vez alcanzados los 255 caracteres, la dirección final se construye de esta manera:

{% code overflow="wrap" %}

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

{% endcode %}

El servidor operativo recibe bien el correo electrónico, ya que acepta todos los subdominios.

<figure><img src="https://754079710-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>

La aplicación, después del truncamiento, interpreta la dirección como perteneciente al `dontwannacry.com` dominio.

<figure><img src="https://754079710-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>

La cuenta se considera interna o de confianza. / Una vez conectado, se permite el acceso al **Panel de Administración** sin control adicional.

<figure><img src="https://754079710-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/es/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.
