> 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/source-code-disclosure-via-backup-files.md).

# 通过备份文件泄露源代码

### 通过备份文件披露源代码

**实验说明**

本实验通过 **备份文件** 存储在一个隐藏目录中。/ 目标是识别并提交 **数据库密码**，它硬编码在披露的源代码中。

**操作阶段**

**内容发现**/ 使用 **Burp Suite** （函数 Discover Content），我们分析应用程序可访问的路径。

<figure><img src="/files/200780ccb566e66db7ad15baf43fa8f350c8d0ce" alt=""><figcaption></figcaption></figure>

**敏感目录的识别**/ 分析显示存在一个名为 **backup**.

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

<figure><img src="/files/21f2679b2e54eaeb0315a8bf5ec69ded1a7723a6" alt=""><figcaption></figcaption></figure>

**访问备份文件**/ 在这个目录中，一个扩展名为 `.bk` 的备份文件可访问。/ 它包含解释过的 \*\*Java 代码\*\*。

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

**披露代码分析**/ 该文件揭示了一个 **PostgreSQL** 数据库的登录信息，凭据已硬编码。

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

```java
        ConnectionBuilder connectionBuilder = ConnectionBuilder.from(
                "org.postgresql.Driver",
                "postgresql",
                "localhost",
                5432,
                "postgres",
                "postgres",
                "eq77s9j4j4sa5a3m9iymzi9e2m8e68sj"
        ).withAutoCommit();
```


---

# 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/source-code-disclosure-via-backup-files.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.
