> 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/authentication/brute-forcing-a-stay-logged-in-cookie.md).

# Fuerza bruta de una cookie de sesión persistente

### Fuerza bruta a una cookie de mantener la sesión iniciada

Este laboratorio permite a los usuarios seguir conectados incluso después de haber cerrado sus navegadores. La cookie usada para esta función es vulnerable a fuerza bruta. / Para resolver el laboratorio, necesitas hacer fuerza bruta sobre la cookie de Carlos para acceder a su página Mi cuenta.

**Credenciales proporcionadas:** `wiener:peter`/ \*\* Nombre de la víctima:\*\* `carlos`

### \*\*Análisis del mecanismo

Cuando marcas la opción de reconexión automática, se envía la siguiente consulta:

```bash
username=wiener&password=peter&stay-logged-in=on
```

<figure><img src="/files/60d474100a8065965ebab3f4dea051dc7ce2717e" alt=""><figcaption></figcaption></figure>

El servidor devuelve entonces una cookie llamada **stay-logged-in**, cuyo contenido está codificado en Base64:

```bash
d2llbmVyOjUxZGMzMGRkYzQ3M2Q0M2E2MDExZTllYmJhNmNhNzcw
```

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

Después de decodificarla, obtenemos:

```bash
wiener:51dc30ddc473d43a6011e9ebba6ca770
```

<figure><img src="/files/631bfe7c50c25fc8b293ad405cdb48c593d5c863" alt=""><figcaption></figcaption></figure>

Por lo tanto, la estructura de la cookie es:

Al comprobar el hash mediante CrackStation, descubrimos que corresponde al valor **peter** en MD5.

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

### **Configuración de fuerza bruta**

1. Envía la consulta de la cookie a **Burp Intruder** y selecciona el valor de la cookie como área de inyección.

<figure><img src="/files/9d90efbd1a3f35928bb20acc6a453952d2758648" alt=""><figcaption></figcaption></figure>

En Procesamiento de carga útil:

* añade una transformación que genere un hash **MD5**;

<figure><img src="/files/5872613bbcd89088b05bfa2e10085ba586df0863" alt=""><figcaption></figcaption></figure>

* añade un prefijo: `carlos:`

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

* codifica todo en **Base64**.

<figure><img src="/files/3c77c3605bd54440fa26e989040796604c7475b2" alt=""><figcaption></figcaption></figure>

1. Carga la lista de contraseñas en Configuración de la carga útil.

<figure><img src="/files/798f8f5ee3c9365bd788ec4fe7fb19dcb253de4d" alt=""><figcaption></figcaption></figure>

Durante el ataque, una respuesta **200** indica la cookie correcta para Carlos.

<figure><img src="/files/1c4ea5f46f24145782758b857cf9d77856b32252" alt=""><figcaption></figcaption></figure>

La cookie obtenida es:

```bash
Y2FybG9zOjdkOGJjNWYxYThkMzc4N2QwNmVmMTFjOTdkNDY1NWRm
```

Decodificación

{% code overflow="wrap" %}

```bash
echo -n "Y2FybG9zOjdkOGJjNWYxYThkMzc4N2QwNmVmMTFjOTdkNDY1NWRm" | base64 -d ;echo
```

{% endcode %}

* carlos:7d8bc5f1a8d3787d06ef11c97d4655df

Al comprobar este hash en CrackStation, encontramos que la contraseña asociada es **taylor**.

<figure><img src="/files/4d0a92b2daea4736c20d9aede629a257be23257e" 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/es/web/authentication/brute-forcing-a-stay-logged-in-cookie.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.
