Open hats-bug-reporter[bot] opened 6 months ago
I forgot to add, that getReward
can be manually called for CvsAssetStakerBuffer
and the rewards will be received in the contract, but they cannot be distributed and cannot be manually withdrawn, they will be lost forever in the contract.
//claim
function getReward(address _account) external {
//claim directly in checkpoint logic to save a bit of gas
_checkpointAndClaim([_account, _account]);
}
Once the shutdown is over, another call to pullRewards would restake all rewards accordingly. Marking as medium for sponsor to say, since I could be wrong.
The shutdown is permanent, you can take a look at the contract.
In the case of a shutdown wrapper, this simply means that the staking contract on our side has expired. If this happens, and a new wrapper replaces it, we'll do everything we can to upgrade/migrate the contracts in question. We're getting away from classic usage, and even if PullRewards is blocked - which, by the way, is not an obligatory transaction, as it can be triggered at any time - we're in a position to unblock the situation if need be. We therefore consider this issue to be invalid
Github username: -- Twitter username: @dethSCA Submission hash (on-chain): 0x4e6fed0213efb6d2401ee1282c12fdcdb1a01b7e50c439a2d0717e0bcc9435ef Severity: medium
Description: Description\ The
CvsAssetStakerBuffer
uses acvsAssetBuffer
in order to stake and get rewards.From the deploy scripts we can see some of the wrappers that will be used by the protocol.
For this example, I'll use the CVX_CRV_WRAPPER, but the issue persists in every other wrapper as well.
All wrappers have a variable called
isShutdown
and it can be set totrue
in the rare ocassion that a wrapper needs to be shutdown.Once a wrapper is shutdown, it permanently disables
stake
.getReward
can still be called, as to not block users getting their rewards.This all looks good, but there is a problem with how Convergence uses
pullRewards
.You can see that in order to distribute the rewards received from the
cvxAssetWrapper
first we callstakeAllCvsAsset
which will attempt to stake the entirecvxAsset
balance of the contract.And this is the problem, if the wrapper is shutdown,
stake
will always revert and becausestakeAllCvsAsset
is called inisdepullRewards
, the rewards that the contract has accumulated can never be distributed to therewardReceiver
.This check can very easily be forced to pass, as anyone can simply send 1 wei of
cvsAsset
to the contract and force it to callstake
every time.This effectively bricks the entire rewarding logic of
CvsAssetStakerBuffer
and makes it so all users lose all their rewards, as they will never get distributed to the correct contract.Considering this a Medium severity issue, as the likelihood of the wrapper getting shutdown is low, but the impact is high, as the rewards become completely unclaimable, because they aren't distributed.
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)
The best way to handle a wrapper shutting down is, to add a new parameter to
pullRewards
calledbool stake
, which if true will callstakeAllCvsAsset
or if false will skip it.Another way to fix this would be to add an only owner function which mimics
pullRewards
, but won't callstakeAllCvsAsset
.I also recommend adding a function that will transfer
cvxAsset
to a receiver in case the wrapper is shutdown, as currently if the wrapper is shutdown anycvxAsset
in the contract will be lost forever.