Resources

People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!

The Grim Finance Hack- 871

Rob BehnkePosted 3 Years Ago
  • Grim fianance is a compounding yield optimizer built on top of the Fantom Opera blockchain. The code for safeTransferFrom of ERC20 had a reentrancy vulnerability in it. Once the transfer occurred, a callback to the address (contract) was made.
  • The reentrancy attack could only occur 5 times, because of the limited amount of gas. On each call, the _pool amount is set the current balance of the pool, not what has been taken out by the recursive call beforehand. Additionally, it would mint 5 times the expected shares as well.
  • The attacker was able to perform this attack many times in order to steal 30 million dollars. A simple reentrancy attack made this possible, even if the amount transactions was limited by the gas.