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

# バックアップファイル経由のソースコード漏えい

バックアップファイル経由のソースコード漏えいの PortSwigger Web Security Academy ラボ向けノート。攻撃フロー、ペイロードテスト、Burp Suite による検証、および是正策の文脈を含みます。

### バックアップファイルを通じたソースコード漏えい

**ラボの説明**

このラボでは、アプリケーションのソースコードが次を通じて公開されています **バックアップファイル** 非表示ディレクトリに保存されています。/ 目的は、次を特定して提出することです **データベースのパスワード**、これは漏えいしたソースコード内にハードコードされています。

**操作手順**

**コンテンツの発見**/ 使用して **Burp Suite** （関数 Discover Content）で、アプリケーションのアクセス可能なパスを分析します。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-39457c6536adb000caa7c922d609813a1604ded0%2Fimage%20(199).png?alt=media" alt=""><figcaption></figcaption></figure>

**機密ディレクトリの特定**/ 解析により、次の名前の非表示ディレクトリの存在が明らかになります **backup**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2a1349c3cac4bf1a37533deb0bcc51374342d288%2Fimage%20(201).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cea45e8c3ed42ec6f3d6540af4503efed2569949%2Fimage%20(200).png?alt=media" alt=""><figcaption></figcaption></figure>

**バックアップファイルへのアクセス**/ このディレクトリには、拡張子が `.bk` のバックアップファイルにアクセス可能です。/ その中には、説明付きの \*\*Javaコード\*\* が含まれています。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0ac705718ecabad6c255880bb91fa0d069dcaa93%2Fimage%20(202).png?alt=media" alt=""><figcaption></figcaption></figure>

**公開されたコードの分析**/ このファイルには、次へのログイン情報が記載されています **PostgreSQL** データベースで、認証情報はハードコードされています。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1daa99c92705dcf3e95aa7050bbe51916d9da32f%2Fimage%20(203).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ja/web/information-disclosure/source-code-disclosure-via-backup-files.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
