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

# Divulgation du code source via des fichiers de sauvegarde

Notes sur la divulgation du code source via des fichiers de sauvegarde pour les laboratoires de la PortSwigger Web Security Academy, incluant le workflow d’exploitation, les tests de payloads, la validation dans Burp Suite et le contexte de remédiation.

### Divulgation du code source via des fichiers de sauvegarde

**Description du laboratoire**

Ce laboratoire expose le code source de l'application via **des fichiers de sauvegarde** stockés dans un répertoire caché. / L'objectif est d'identifier et de soumettre le **mot de passe de la base de données**, qui est codé en dur dans le code source divulgué.

**Étapes de l’opération**

**Découverte du contenu**/ À l'aide de **Burp Suite** (fonction Discover Content), nous analysons les chemins accessibles de l'application.

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

**Identification d'un répertoire sensible**/ L'analyse révèle l'existence d'un répertoire caché nommé **backup**.

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

**Accès aux fichiers de sauvegarde**/ Dans ce répertoire, un fichier de sauvegarde avec une extension `.bk` est accessible. / Il contient du \*\*code Java\*\* expliqué.

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

**Analyse du code divulgué**/ Le fichier révèle des informations de connexion à une **PostgreSQL** base de données, avec des identifiants codés en dur.

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