> 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/information-disclosure/information-disclosure-via-version-control-history.md).

# 通过版本控制历史泄露信息

### 版本控制历史中的信息泄露

**实验说明**

此实验通过版本控制仓库的历史暴露敏感信息。/ 目标是获取用户的密码 **administrator**，然后使用此账户登录以删除用户 **carlos**.

**初步分析**

通过探索应用程序，我们发现存在一个目录 **`.git`** 可直接从 Web 服务器访问。

<figure><img src="/files/6eea09046db0e1acb2450f79a531549929b6585e" alt=""><figcaption></figcaption></figure>

这表明完整的 Git 仓库是公开可见的，可能使源代码和变更历史都能被获取。

**利用**

**Git 仓库提取**/ 使用 git-dumper 工具下载以下内容： `.git` 目录：

```bash
git-dumper https://0a7800030384626580b39ee5001e00b1.web-security-academy.net/.git .git
```

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

**提交历史分析**/ 一旦仓库在本地重建完成，就会查看提交历史：

```bash
git log
```

分析显示，有一个提交包含了管理员密码的删除。

<figure><img src="/files/1167889927298f2917c2467a71749de377c55452" alt=""><figcaption></figcaption></figure>

**差异检查**/ 检查该提交的具体内容，以确定被删除的信息：

```bash
git log -p ab875bcd9cf3ea84ad6af9471521aea4c3a1852d
```

显示的差异使得可以找到用户的密码 **administrator**.

* q0b3xu3ko6pqcqdjofrq

<figure><img src="/files/a6e391e1c0270f3c6873e98eb41ba89e2b5b885e" 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/information-disclosure/information-disclosure-via-version-control-history.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.
