Rating: 1.0

I was not able to solve it in the remaining time during the CTF. 

Found this, (obviously not mine):https://github.com/cstanfill/accounting-writeup Original writeup. Contains the original source for the problem.

It was initially a bit hard to understand, so rewrote it in order to better understand it and step through the code.
I posted it here: https://github.com/Caesurus/bkp2017_accounting_simulator/blob/master/exploit.py