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!
call() to a function. It has some Yul code that is worth discussing further:
calldata of the program into EVM memory.swapAmount in the calldata via a user controlled index. This is where the fun begins!swapAmountInDataIndex is a 32 bit integer.
ptr + 36 (0x24) + swapAmountInDataIndex * 32 (0x20).
swapAmountInDataIndex variable is a uin256. Unfortantely, there's an integer overflow in this calculation. When performing the multiplication on the index, this can overflow. With a specially crafted value, it's possible to wrap back around to modify the function selector that had previously been verified. An arbitrary call in the context of a Solidity smart contract is effectively game over.