Approved spender can not withdraw or merge #154
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate
This issue or pull request already exists
Lines of code
https://github.com/code-423n4/2022-05-velodrome/blob/7fda97c570b758bbfa7dd6724a336c43d4041740/contracts/contracts/VotingEscrow.sol#L517-L528
Vulnerability details
In the current implementation,
withdraw()
andmerge()
veNFT can be called by approved spender or token owner.https://github.com/code-423n4/2022-05-velodrome/blob/7fda97c570b758bbfa7dd6724a336c43d4041740/contracts/contracts/VotingEscrow.sol#L844-L845
https://github.com/code-423n4/2022-05-velodrome/blob/7fda97c570b758bbfa7dd6724a336c43d4041740/contracts/contracts/VotingEscrow.sol#L1084-L1088
However,
_burn()
always usesmsg.sender
as_from
in_removeTokenFrom()
, makes the transaction revert whenmsg.sender
is not the current owner of veNFT.As a result,
withdraw()
andmerge()
actually can not be called by the approved spender.https://github.com/code-423n4/2022-05-velodrome/blob/7fda97c570b758bbfa7dd6724a336c43d4041740/contracts/contracts/VotingEscrow.sol#L517-L528
https://github.com/code-423n4/2022-05-velodrome/blob/7fda97c570b758bbfa7dd6724a336c43d4041740/contracts/contracts/VotingEscrow.sol#L506-L515
Recommendation
Change to:
The text was updated successfully, but these errors were encountered: