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

# Force brute sur un cookie de session persistant

### Brute-forçage d’un cookie « rester connecté »

Ce laboratoire permet aux utilisateurs de rester connectés même après avoir fermé leur navigateur. Le cookie utilisé pour cette fonctionnalité est vulnérable à la force brute. / Pour résoudre le laboratoire, vous devez attaquer par force brute le cookie de Carlos afin d’accéder à sa page Mon compte.

**Identifiants fournis :** `wiener:peter`/ \*\* Nom de la victime :\*\* `carlos`

### \*\*Analyse du mécanisme

Lorsque vous cochez l’option de reconnexion automatique, la requête suivante est envoyée :

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

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

Le serveur renvoie alors un cookie nommé **stay-logged-in**, dont le contenu est encodé en Base64 :

```bash
d2llbmVyOjUxZGMzMGRkYzQ3M2Q0M2E2MDExZTllYmJhNmNhNzcw
```

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

Après décodage, on obtient :

```bash
wiener:51dc30ddc473d43a6011e9ebba6ca770
```

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

La structure du cookie est donc :

En vérifiant le hachage via CrackStation, nous découvrons qu’il correspond à la valeur **peter** en MD5.

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

### **Configuration de la force brute**

1. Envoyez la requête du cookie à **Burp Intruder** et sélectionnez la valeur du cookie comme zone d’injection.

<figure><img src="/files/80d5ef489e6ad65a3029b18b5e989353fe4d3e91" alt=""><figcaption></figcaption></figure>

Dans le traitement des charges utiles :

* ajoutez une transformation générant un hachage **MD5**;

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

* ajoutez un préfixe : `carlos:`

<figure><img src="/files/550b59eb8fcd3305e590bc8d72bcfb3ffffc56a3" alt=""><figcaption></figcaption></figure>

* tout encoder en **Base64**.

<figure><img src="/files/706ba7205edd85507d8a40003c11c943e6f94a60" alt=""><figcaption></figcaption></figure>

1. Chargez la liste de mots de passe dans les paramètres de charge utile.

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

Pendant l’attaque, une réponse **200** indique le bon cookie pour Carlos.

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

Le cookie obtenu est :

```bash
Y2FybG9zOjdkOGJjNWYxYThkMzc4N2QwNmVmMTFjOTdkNDY1NWRm
```

Décodage

{% code overflow="wrap" %}

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

{% endcode %}

* carlos:7d8bc5f1a8d3787d06ef11c97d4655df

En vérifiant ce hachage sur CrackStation, nous trouvons que le mot de passe associé est **taylor**.

<figure><img src="/files/bded3890388ff01907c95d75ec4a643242202fc5" 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/fr/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.
