ConvexSpell is completely broken for any curve LP that utilizes native ETH
The ConvexSpell contract calls balanceOf on each token in a Curve LP, but native ETH is represented by a special address that does not implement balanceOf, causing a revert. This makes the contract incompatible with any Curve pool that uses native ETH.
Source: https://github.com/sherlock-audit/2023-07-blueberry-judging/issues/105
Found by
0x52, 0xjoseph
When a Curve pool utilizes native ETH it uses the address 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee. This is problematic because it will try to call balanceOf on this address which will always revert.
Vulnerability Detail
if (tokens.length == 2) {
uint256[2] memory suppliedAmts;
for (uint256 i; i != 2; ++i) {
suppliedAmts[i] = IERC20Upgradeable(tokens[i]).balanceOf(
address(this)
);
}
ICurvePool(pool).add_liquidity(suppliedAmts, minLPMint);
ConvexSpell#openPositionFarm attempts to call balanceOf on each component of the LP. Since native ETH uses the 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee this call will always revert. This breaks compatibility with EVERY curve pool that uses native ETH which make most of the highest volume pools on the platfrom.
Impact
ConvexSpell is completely incompatible with a majority of Curve pools
Code Snippet
Tool used
Manual Review
Recommendation
I would recommend conversion between native ETH and wETH to prevent this issue.
Discussion
sherlock-admin2
1 comment(s) were left on this issue during the judging contest.
0xyPhilic commented:
invalid because the design of the protocol does not show desire for ETH compatibility so the issue can be classified as informational
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the contract assumes all LP components are ERC20 tokens and calls balanceOf on them, but native ETH is represented by a placeholder address that does not implement balanceOf.
Impact
ConvexSpell is completely incompatible with a majority of Curve pools, specifically those that use native ETH.
What the attacker needed
Curve pool uses native ETH
The fix
The issue should be fixed by converting between native ETH and wETH to avoid calling balanceOf on the native ETH placeholder address.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract tries to check how many tokens it has by asking each token contract for its balance. But for native ETH, there is no token contract at the special address used, so the check fails and the whole transaction reverts. This means the contract cannot work with pools that include ETH.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.