> For the complete documentation index, see [llms.txt](https://writeups.ayweth20.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://writeups.ayweth20.com/2025/404ctf-2025/securite-web/fire-server.md).

# Fire Server

**Catégorie:** Sécurité Web - **Difficulté:** Facile

{% file src="/files/0SfFqK02wfeYVEEFOPKd" %}

**Description:**

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

Solution:

En arrivant sur la page d'accueil, nous avons accès à une liste de plusieurs documents :&#x20;

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

Dès que nous cliquons sur un bouton, l'URL change comme ceci :&#x20;

```
https://fire-server.404ctf.fr/?path=<le nom du document>.txt
```

Il y a donc très clairement une exploitation à tenter via une Path Traversal ici. Pour vérifier cela, nous pouvons analyser le code que nous avons à disposition.\
En regardant rapidement le fichier index.php, nous avons rapidement une info qui nous saute aux yeux :&#x20;

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

Cette fonction `str_replace` va remplacer tout les `../` que nous allons mettre dans notre *path* (pour remonter dans l'arborescence).\
Il faut donc trouver un moyen de bypasser ça, et c'est relativement simple :&#x20;

* Si `../` est retiré, alors `....//` sera partiellement modifié ⇒
  * `....//` va donc trigger la règle et retirer la partie centrale `../`, mais cela nous fait donc le format souhaité : `../` qui est donc ce qu'il nous faut.
  * Par exemple, pour remonter de 2 niveau, voici ce qu'il faut rentrer : `..../..../` car ça devient `../../`

Nous pouvons donc faire de la reconnaissance au fur et à mesure :&#x20;

* <https://fire-server.404ctf.fr/?path=....//....//....//....//> nous donne :<br>

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

Après plusieurs énumérations automatiques de répertoires, voici où nous pouvions trouver notre flag :&#x20;

<https://fire-server.404ctf.fr/?path=....//....//....//....//var/files/classified/selenium><br>

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

<details>

<summary>🚩FLAG</summary>

`404CTF{m0oN_S3cRe7s_4r3_bUr1eD_d33p}`

</details>


---

# 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://writeups.ayweth20.com/2025/404ctf-2025/securite-web/fire-server.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.
