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

# Divulgação do código-fonte via arquivos de backup

Notas sobre divulgação do código-fonte via arquivos de backup para os laboratórios do PortSwigger Web Security Academy, incluindo fluxo de exploração, teste de payload, validação no Burp Suite e contexto de remediação.

### Divulgação do Código-Fonte por meio de Arquivos de Backup

**Descrição do laboratório**

Este laboratório expõe o código-fonte da aplicação por meio de **arquivos de backup** armazenados em um diretório oculto. / O objetivo é identificar e enviar a **senha do banco de dados**, que está codificada diretamente no código-fonte divulgado.

**Etapas da operação**

**Descoberta de conteúdo**/ Usando **Burp Suite** (função Discover Content ), analisamos os caminhos acessíveis da aplicação.

<figure><img src="https://783634792-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>

**Identificação de um diretório sensível**/ A análise revela a existência de um diretório oculto chamado **backup**.

<figure><img src="https://783634792-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://783634792-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>

**Acesso a arquivos de backup**/ Neste diretório, um arquivo de backup com uma extensão `.bk` está acessível. / Ele contém \*\*código Java\*\* explicado.

<figure><img src="https://783634792-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>

**Análise do código divulgado**/ O arquivo revela informações de login para um **PostgreSQL** banco de dados, com credenciais codificadas diretamente.

<figure><img src="https://783634792-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/pt-br/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.
