# 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="<https://4219205392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fybn4btwQnvitOl9uXz9p%2Fuploads%2F6IM6hdkivvd6BqsPRtNm%2Fsource_code.txt?alt=media&token=d875e10e-7c56-4296-ab64-cfa7a61dbc0b>" %}

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

{% file src="<https://4219205392-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fybn4btwQnvitOl9uXz9p%2Fuploads%2FQ40Vb3yLEZQa3tDqfEe2%2Freplaced_code.txt?alt=media&token=aa45bc8d-46c4-4a3d-8969-1f426594341f>" %}

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>
