]> git.somenet.org - pub/jan/ctf-seminar.git/blob - writeups/smashing/asis19.md
added writeups
[pub/jan/ctf-seminar.git] / writeups / smashing / asis19.md
1 # Retrospective
2 Sadly i was not able to spend that much time on this CTF and therefore i was only able to work on one challenge actively. This challenge was somewhat okay-ish due to the fact that some guessing was needed to get the structure of the filesystem without the second version. Due to his the challenge took way longer that it should have been.
3
4 Time spent: ~10 hours
5 # protected area (solved)
6 ## Overview
7 The website shows a welcome text and another line of text which looks like a todo list.
8
9 ## Approach
10 First we checked the source of the website which revealed some methods to interact with an api to read files from a server. The two most important functions for us in this case are `file_check(file)` which checks if a file exists and `file_read(file)` which eventually reads a file and returns its contents.
11
12 Since `file_check` internally checks if the returned value equals `True` we assumed that the backend was written in Python which turned out to be true later. 
13
14 Trying some stuff we found out that it is possible to traverse the path. The backend seems to replace `../` only once so we can bypass this by nesting another `../` resulting in `....//`. Also the backends response was `security` if the file did not end with `.txt` which later turned out to be wrong since its only checking if the whole query ends with `.txt`.
15
16 Unfortunately we were still missing the structure of the filesystem therefore we did not know where we should look for our flag. After some time a second version of the challenge was revealed which provided the used docker template and we were able to extract the source code of the backend.
17
18 Knowing the basic structure of flask apps we were able to find an endpoint called `/protected_area_0098` which hold the flag. This page was protected with a password which we were able to extract from the config.
19
20 Eventually we were able to access the endpoint which revealed the flag: `ASIS{f70a0203d638a0c90a490ad46a94e394}`