Hi, my name is Nonseodion. I am an advanced security engineer with 20 years of experience. I have worked in the traditional cybersecurity space and transferred my expertise to the Web3 world. In Web3, I have helped secure a long list of protocols from vulnerabilities in their smart contract code. I want to share my knowledge and help you become a security engineer like me, so I am starting this newsletter.
Did you believe that? Please tell me you didn't. Lolz. The only correct information there is my name. I don’t have a quarter of that experience. I started learning about smart contract security and auditing smart contract code less than a month ago. But yes, it would be great to be as experienced as whoever it was in the first paragraph.
Now that I have told you my name and little experience, why do you think I am starting a newsletter? I don’t have the experience or knowledge to teach you about security. The truth is, I am not starting this newsletter to teach you anything. I am doing it to teach myself about smart contract security. As I learn about smart contract security and participate in contests like Code4rena, I also want to understand how real hacks were executed. I can learn about smart contract hacks and how they happened on my own but explaining it to you is a different ball game. To explain it to you, I have to explain how the hacker came up with the hack and not just how he did it. Sometimes the difference between knowing about a vulnerability and knowing how to exploit it can be more than one order of magnitude.
reHackt is a security-focused newsletter focused on getting into the mind of smart contract hackers and how they executed their hacks. We will understand the vulnerability that caused the exploit, the hacker's thought process in coming up with the hack and how he eventually exploited it. Each issue will focus on a particular hack and will be published every 2-3 weeks depending on how complex the hack is and the time on my hands. Do not forget that I am learning how to audit smart contracts. I initially wanted it to be every 2 weeks, but I am currently writing the first one, which will be published tomorrow and I have to confess, it is a lot of work 😩.
For a start, each issue will have 8 sections, namely:
Introduction
This will be a short section with metadata about the hack like the protocols affected, amount of money lost, date of hack and other relevant information.
Vulnerability
This section will focus on the vulnerability that gave way to the exploit. This can be reentrancy, logic errors, price oracle manipulation or misuse/loss of admin keys. This is not a limited list.
Vulnerability Side-Effects
This section will allow us to understand how the vulnerability affects the smart contract.
Exploitation Strategy
In this section, we will draw up a strategy to exploit the vulnerability in the contract to make it perform an unintended action and give us an advantage. We will try to be the hacker and see how he came up with it. This is the most difficult section to understand. I know black hat hackers do wrong by stealing, but you cannot ignore their ingenuity. In other words, prepare for your minds to be blown 🤯.
Hack Timeline
We will see a timeline of the original hack and how it was pulled off. We will use Etherscan, Tenderly and maybe evm.storage here.
Re-Hacking
This is where we will write the Solidity code to complete the hack. In this section, we will fork the blockchain at a block before the hack happened using Foundry and run our code on the vulnerable protocol before the hacker does his thing. We will basically be front-running the hacker in our small fantasy world. The code will be available on Github.
Mitigation
As smart contract security engineers or developers, we should not just be able to break but build, repair and maintain. So we will apply a fix to the smart contract and test it in this section.
Conclusion
Finally, we will talk about how we can avoid it as developers and how to spot it as auditors.
That is all we will do for each issue. The 8 sections above are not rigid they can change as more issues are produced but we will start with this.
Thanks for joining me in this short introduction. By the way, the first issue comes out tomorrow. I cannot wait to see the amount of knowledge we will gain as we study multiple protocol hacks.
Written with malice😈 by nonseodion.