Nothing much important in code that we can use. Having a look at the webm file from the challenge note, showed us a funny spoof video of a scene from American Psycho. The important part from the video is shown below asking us to check the second card. Video also mentioned a file path traversal in that code.
Lets understand the right hand side (second card) code a bit here in order to exploit it.
a character array is defined using char a[69]
the scanf function retrieves the part after GET / using %s identifier and assigns it to a array
Next printf will output HTTP 200 \r\n\r\n on the stdout
fflush will clear the stdout
execlp will execute cat on a. The syntax seems a bit confusing but it works somehow with a as argument repeated twice.
comment at the end stating to run this code in /home/ctf/web/
Having understood this much from the code, now we know that the source code displayed when viewing the challenge URL was due the fact that index.html was supplied as input to cat in that C program. When I supplied the payload of /etc/passwd in the GET request as below, it worked as expected. Note the the // after 31337.
So now we gather the flag using the comment from the last line of the code and the hint from the challenge note. ~/ signifies the home directory from the challenge note and we see a user ctf mentioned in the code comments as well as output of /etc/passwd. So we make the final request to get the flag.