
Dark scholar of web3. Delving into the abyss, ensuring smart contract security, and optimizing gas in the face of the void. 🌑 ☠️ 🔗
Joined July 2022
- Tweets562
- Following579
- Followers673
- Likes482
Pinned Tweet
Introducing #DedEthAudits:
Empowering the security of your Solidity contracts.
Our experienced auditors (@DedOhwale, @Arzdev, @Solidityauditor), nurtured by contests and private audits, are your blockchain guardians 🛡️.
DM 📩 me for a quote today!
📝 Solidity Quiz Time
What can go wrong with `createPrivatePool()`?
⚠️ Note: `cloneDeterministic()` is from Solady.
@X3agleX @MalikAremu1 @bitamg2021 @nizhunt
The more extended testing script returns 42, x, x, x where x is the memory location.
Within execute, the memory persists and the `temp=ops` line assigns the ops memory location to temp. So, when we change temp, we change ops.
(1/6) ⚔️Solidity Attack Vector⚔️
Piece-wise functions
When calculating a piece-wise function, there is almost always a point of vulnerability.
Let's take a look at a similar example from my recent medium finding.
👇🧵
📚 Solidity Quiz #1📚
What happens if we call `updateData` from the `CallerContract`?
Quick run-down of this in 24hrs. ⌛️
(1/10)⚔️Solidity Attack Vector⚔️
Forcibly Sending Ether
Suppose we have some contract which uses
`address(this).balance` within the logic.
The first thing to consider is what would happen if we could forcibly send ether to this contract?
Could you break the attached?
👇🧵
(1/4) ⚔️Solidity Attack Vector⚔️
Contract Check
A protocol may want to check if the sender is a contract or EOA.
To do so, they may look at the code size, as EOA's will return 0.
What is wrong with the below implementation?
👇🧵
(1/7) ⚔️Solidity Attack Vector⚔️
1 Wei Attack
Suppose we have a vault, where users can deposit assets & in turn receive shares.
Then, they can exchange those shares for assets, usually with some interest rate bonus.
What is wrong with the below implementation?
Answer 👇🧵
(1/2) ⚔️Solidity Atk Vectors⚔️
Let me share 2 more attack vectors with you:
1. Access Control - make sure it is done right & cannot be passed incorrect values
2. Account Existence - do 0 address checks. Check account state if necessary.
🧵👇
(2/2) Account Existence is especially important when conducting low-level calls such as `call`, `delegatecall`, and `staticcall`.
These return true if the account called does not exist. See the warning here ⚠️:
docs.soliditylang.org/en/dev…
1
3
376
🚨 Solidity Security Tip 🚨
Be careful with your boolean revert checks!
If function 1 & 2 should always have differing behavior, make sure that occurs.
If a = false, and b = c, what happens with the attached?
How would you fix it?
H-03 👇
code4rena.com/reports/2022-1…
(1/8) Solidity Attack Vectors ⚔️
I have completed my second audit - let me share with you two method of attacks I have used so far, and how you can apply them to your next audit.
1) Reentrancy
2) Math
🧵👇
(2/8) Reentrency:
If you are unfamiliar with this type of attack, here is a summary: teapawt.net/dedohwale/status/16307…
So, we need to look for low-level calls which do not follow the checks, effects, interactions pattern.
While you are looking at these calls, find the uncheck returns.
(1/6) 🚨 Solidity Security Tip 🚨
Reentrancy attacks broken down:
1️⃣ What is a fallback function?
2️⃣ How can it be used in an attack?
3️⃣ How can we prevent it?
Let's dive in 🧵👇
1
2
439
💡Solidity + Networks💡
Auditing tool #2
Visualize the function breakdown in a clear and intuitive way.
I will be adding metrics to size nodes based on "importance" for focused efforts while auditing.
Again, free with the course.
🔜 🎓
💡Solidity + Terminal💡
Never scoff at the low-level tools as your disposal.
I have written a script specifically for solidity auditing that uses `awk`, `grep`, `echo`, and a few other standard terminal commands.
Free for everyone who takes the course. Sneak peak.
👇
(1/12) ⛽️ Gas Optimization
I have a mapping between uint8 and bool. With uint8, we have the maximum number representable being 255.
That is, we have 256 different slots to store boolean values. In this mapping, each slot stores a boolean.
What would you do?
Answer 👇
⛽️ Gas optimization
♻️ Loops
Loops are an expensive process in general, make sure they are optimized for some significant gas savings.
Attached is an unoptimized loop contract. What is done right?
Try to optimize this on your own. The answer is next.
👇
⛽️ Gas Optimization Tip
Whenever applicable, use 'bytes32' instead of 'bytes memory' or 'string memory'.
Generally, memory is cheaper than storage.
However, 'bytes' has dynamically allotted space, meaning each use the EVM creates a new memory slot.
(1/14) Having a strong foundation is a must to building anything worthwhile.
The foundation of all crypto is Bitcoin, with the proof of work consensus mechanism at the heart of it. Lets go through it part by part.
Grab something to drink, this may take awhile.
👇🧵






















