30694 - [SC - Low] Users approved for a single token id cannot wit...
Submitted on May 5th 2024 at 00:02:52 UTC by @imsrybr0 for Boost | Alchemix
Report ID: #30694
Report type: Smart Contract
Report severity: Low
Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/VotingEscrow.sol
Impacts:
Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
Users approved for a single token id cannot withdraw
or merge
for that token id.
Vulnerability Details
Both withdraw
and merge
check if the msg.sender
is owner of the given token id or is approved to use it (either for all tokens from the same owner of specifically the one being used).
They will also burn
the token after carrying on their logic and clear its approvals.
Approvals are cleared using approve(address(0), _tokenId)
which will fail if a msg.sender
is only approved for that token id specifically.
Impact Details
User approved for a single token cannot
withdraw
ormerge
.Users need to give permission for all their tokens to another user when they want that user to carry
withdraw
ormerge
operations for them.
Recommendation
Use the _clearApproval(owner, _tokenId)
to clear the approvals in the _burn
function.
References
https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/VotingEscrow.sol#L741-L775
https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/VotingEscrow.sol#L618-L651
https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/VotingEscrow.sol#L826-L832
https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/VotingEscrow.sol#L501-L514
https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/VotingEscrow.sol#L1558-L1574
Proof of Concept
Last updated