tl;dr:1. Notice that gethostbyname2 is not thread safe and overwrites the results each time it's called2. Notice race condition between threads calling gethostbyname23. Block one thread on IPv6 request, and in the meantime overwrite the IPv4 address it will query later for localhost
Full writeup: https://github.com/p4-team/ctf/tree/master/2019-09-21-dragonctf/rms