ConvexStakingWrapper.enterShelter()
May Erroneously Overwrite amountInShelter
Leading To Locked Tokens
#109
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-02-concur/blob/shelter-client/contracts/ConvexStakingWrapper.sol#L107-L119
https://github.com/code-423n4/2022-02-concur/blob/shelter-client/contracts/ConvexStakingWrapper.sol#L132-L135
Vulnerability details
Impact
The shelter mechanism provides emergency functionality in an effort to protect users' funds. The
enterShelter
function will withdraw all LP tokens from the pool, transfer them to the shelter contract and activate the shelter for the target LP token. If this function is called again on the same LP token, theamountInShelter
value is overwritten, potentially by the zero amount. As a result its possible that the shelter is put in a state where no users can withdraw from it or only a select few users with a finite number of shares are able to. Once the shelter has passed its grace period, these tokens may forever be locked in the shelter contract.Proof of Concept
https://github.com/code-423n4/2022-02-concur/blob/shelter-client/contracts/ConvexStakingWrapper.sol#L107-L119
https://github.com/code-423n4/2022-02-concur/blob/shelter-client/contracts/ConvexStakingWrapper.sol#L132-L135
Tools Used
Manual code review.
Recommended Mitigation Steps
Consider adding to the
amountInShelter[lpToken]
mapping instead of overwriting it altogether. This will allowenterShelter
to be called multiple times with no loss of funds for the protocol's users.The text was updated successfully, but these errors were encountered: