You are looking through an old version of the OpenZeppelin implementation of ERC-4626 and notice a vulnerability that requires frontrunning an innocent user. You have been granted a large amount of ETH (say e.g. 1k ETH, but you are free to choose the amount :) ) and want to set up a whitehat bot to execute this exploit and return the funds to the user.
- a) Describe the vulnerability and the payoffs for an attacker.
- b) Produce code that can check if this vulnerability has occurred in the past and determine how much value was lost, if any.
- c) Write code for the bot that can carry out the exploit (don’t worry about returning user funds).