# Fiché JS

**Category:** Web - **Points:** 100 - **Difficulty :** Intro - **Solves :** 391

**Description:**\
Après plusieurs mois de recherches à fouiller dans le passé de **Hallebarde**, nous avons mis la main sur une vieille plateforme d'hébergement de fichiers qu'ils utilisaient jusqu'en 2010. Cela remonte à 12 ans maintenant ! Les pratiques en termes de sécurité ont radicalement changé depuis et ce qui semblait alors incassable ne l'est peut-être plus du tout maintenant.\
À vous de jouer : trouvez un moyen d'outrepasser le système de protection existant et récupérez les fichiers encore hébergés sur ce site !&#x20;

[https://fiche-js.404ctf.fr](https://fiche-js.404ctf.fr/)

**Solution:**\
To solve this challenge you need to find a way to bypass the PIN code screen or another way by analysing the source code.\
![website](https://user-images.githubusercontent.com/91023285/173235765-42215f24-3ce4-4ecf-b4ad-d3bd4a41da10.png)\
When we analyse the source code, we can see that he call many .css and .js files.\
![code](https://user-images.githubusercontent.com/91023285/173235788-aa91c576-419f-4cf0-ae3f-0e3bb465f236.png)\
By search in all these files, we can see that there is a veeeeeerrrrrrry long "code" block in the index.js file :&#x20;

{% file src="/files/WEe24jNnuFfmF47lQQRe" %}

When we "execute" this function (or replace manually) we found this :&#x20;

{% file src="/files/ual8Pt3bGDG1EV39Iz14" %}

This result is a JSFuck code. To decode them, we can use this [website](https://www.dcode.fr/langage-jsfuck) who return this JavaScript code :

```
/* FONCTIONNEMENT */
var key = $(".keypad").keypad(
    function (pin) { 
        if (pin == "240801300505131273100172") { 
            document.location.href = "./nob03y_w1lL_Ev3r_fiNd_th15_PaGe.html"; 
        } 
    }
);
```

So now we just need to go on this webpage <https://fiche-js.404ctf.fr/nob03y_w1lL_Ev3r_fiNd_th15_PaGe.html> and we get the flag :\
![flag](https://user-images.githubusercontent.com/91023285/173235808-9cb138e6-18ea-4c62-a9f0-45ae8245ba81.png)

<details>

<summary>🚩 FLAG</summary>

```
 404CTF{Haha_J3_5ui$_f4N_dObfu5c4tIoN_en_JS}  
```

</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/2022/404ctf/web/fiche-js.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.
