Google CTF 2017: Anonymous Exchange

I've bought some bitcoins with my credit cards, and some of them attracted attention, but I don't know which ones. Could you find out? Challenge running at anon.ctfcompetition.com:1337

Writeup and Solution

Calloc and Thread Safety

During my undergrad, I took a module on High Performance Computing which was taught in C and covered the usual suspects: MPI, OpenMP, CUDA etc. For each assignment, students uploaded their source code which was then automatically tested before being inspected by hand. The content was relatively straightforward, however when the 3rd assignment was returned to us, a number of students had been docked 25% of the mark with the comment:

calloc is NOT guaranteed to be thread safe.

Additionally the lecturer provided demonstration code to 'prove' the function wasn't thread safe on university machines. However, we hadn't had any problems when testing our code. What gives?

Continued