Closed code423n4 closed 1 year ago
minhquanym marked the issue as primary issue
cryptotechmaker (sponsor) confirmed
dmvt marked issue #1425 as primary and marked this issue as a duplicate of 1425
dmvt changed the severity to 2 (Med Risk)
dmvt marked the issue as satisfactory
Lines of code
https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/05ba7108a83c66dada98bc5bc75cf18004f2a49b/contracts/convex/ConvexTricryptoStrategy.sol#L272-L284
Vulnerability details
Impact
ConvexTriCryptoStrategy
does not take into account that rewards from Convex can be claimed directly on behalf of any address. All rewards that get into the strategy contract this way will get stuck and compounding of yield will be denied.Proof of Concept
The
ConvexTriCryptoStrategy
allows the claim and conversion of Convex rewards in itscompound
function:The
_executeClaim
function performs the claim and then checks the balance difference of the contract before and after to calculate the rewards:The
ClaimZap
contract (Link) called here is from Convex and allows a batch claim of rewards fromrewardContracts
,extraRewardContracts
andtokenRewardContracts
:Looking at the
getReward
functions (here and here), it can be seen that anyone is allowed to claim for any address:So, if anyone claims directly on behalf of the strategy, the funds will get locked in the strategy contract, since the swap after the claim only accounts for balance differences within the
compound
call and no other function exists to handle unswapped rewards.Tools Used
Manual Review
Recommended Mitigation Steps
Dont check for balance difference and take the whole balance in the contract for reward tokens after the claim. Add any input validation if necessary.
Assessed type
Other