# Have I Been Pwned

**Category:** Web - **Points:** 49 - **Solves:** 7\
**Description:** Find the Flag in the files of the website

**Infos:** To preserve the health of the server, brute-force tools such as Gobuster are not allowed. <http://davincicode.fr:5000/>

**Solution:**\
To solve this challenge you need to find the file who contains the FLAG.\
If you inspect the response header, you can see that the website is built with Werkzeug/2.0.1 and Python/3.9.5 When we connect to the website, we have been offered a basic homepage with just a simple input.\
So when you do a few researches you rapidly find that you can use the SSTI attack.\
The SSTI consist to use native template syntax to inject a malicious payload into a template, which is then executed server-side.\
One article who helped me to make an SSTI attack is published here : [SSTI attack writeup](https://anasblp.medium.com/tamu-ctf-2019-web-writeups-science-41f173ba3203). The author explains all steps to finish the attack. So after a few explanations, we start to view the results on our website. So we do a lot of commands who are update step by step. The command who gives the FLAG is :

```
{{url_for.__globals__.os.popen('cat ls cd ChallengeWeb1/flag.txt').read()}}
```

This command displays the FLAG on the web page.

<details>

<summary>🚩 FLAG</summary>

```
DVC{n0_sh4refl4g_pls}
```

</details>


---

# Agent Instructions: 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:

```
GET https://writeups.ayweth20.com/2021/dvctf-to-join-davincicode/web/have-i-been-pwned.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
