PoliCTF 2015 - Hanoi as a Service

Hanoi as a Service

Pwnable - 50 Points

Check out our shiny new HaaS platform!nc haas.polictf.it 80

Writeup

We started playing with the Hanoi service:

thezero:~$ nc haas.polictf.it 80
Welcome to the Hanoi-as-a-Service cloud platform!
How many disks does your tower have?
3
* Move top disk from a to b
* Move top disk from a to c
* Move top disk from b to c
* Move top disk from a to b
* Move top disk from c to a
* Move top disk from c to b
* Move top disk from a to b
thezero:~$ nc haas.polictf.it 80
Welcome to the Hanoi-as-a-Service cloud platform!
How many disks does your tower have?
-1
ERROR: Prolog initialisation failed:
ERROR: Out of local stack

Yeah, Prolog.
Typing random input in prolog we landed on a Python exception talking about a /home/ctf/haas/haas-proxy.py file.
We wanted to read that file so bad that we asked to ocean (the CTF organizer) if it was Open Source :D