See this [article](http://www.scs.stanford.edu/brop/bittau-brop.pdf) for more detail. First bruteforce stack layout, then search for ROP gadgets, then find a write function, leak binary, and then finally get shell and profit.
[https://thekidofarcrania.gitlab.io/2019/03/12/utctf/](https://thekidofarcrania.gitlab.io/2019/03/12/utctf/)