Most smart contract developers are well aware of security issues and hacking cases, and how to prevent them.
- Re-entrancy Attack
- Fallback Risk
- Underflow/Overflow
- Flash Loan Attack
- …
However, sometimes it is necessary to consider how to deal with accidents and hacks that occur and minimize the damage.
A few months ago, I helped a client who lost ownership of his smart contract accidentally because of a codebase bug.
Another way was needed because the function to set the new owner was blocked by the OnlyOwner
modifier set to an invalid address.
The smart contract was manually manipulating the size of a dynamic array to reduce the amount of computation.
Through hundreds of researches and experiments, I could manipulate the size of the dynamic array to be the same as the size of the storage, and after calculating the location of the owner variable, a new address was finally set.
It was impossible to me if I hadn’t played this solidity game before – Alien Codex.
In the game, you will uncover an Alien’s smart contract, and claim ownership.
No one of external
functions exists to set the owner, is the challenge.
Can you win the game?
Sorry, the comment form is closed at this time.