crvRewardsContract getReward can be called directly, breaking vaults claimRewards functionallity
The Convex reward contract allows anyone to call getReward on behalf of the Vault, which can be triggered by a malicious user to claim rewards before the Vault's claimRewards function runs. This breaks the Vault's claimRewards functionality, preventing it from minting AMPH tokens from those rewards.
Submitted by said, also found by minhtrng
crvRewardsContract of convex can be called by anyone on behalf of Vault, this will allow malicious users to call getReward and break the Vault claimRewards functionality.
Proof of Concept
Convex rewarded allow anyone to call getReward on behalf of any users:
https://github.com/convex-eth/platform/blob/main/contracts/contracts/BaseRewardPool.sol#L263-L279
This will break Vault claimRewards functionality that depends on this getReward:
function claimRewards(address[] memory _tokenAddresses) external override onlyMinter {
uint256 _totalCrvReward;
uint256 _totalCvxReward;
IAMPHClaimer _amphClaimer = CONTROLLER.claimerContract();
for (uint256 _i; _i < _tokenAddresses.length;) {
IVaultController.CollateralInfo memory _collateralInfo = CONTROLLER.tokenCollateralInfo(_tokenAddresses[_i]);
if (_collateralInfo.tokenId == 0) revert Vault_TokenNotRegistered();
if (_collateralInfo.collateralType != IVaultController.CollateralType.CurveLPStakedOnConvex) {
revert Vault_TokenNotCurveLP();
}
IBaseRewardPool _rewardsContract = _collateralInfo.crvRewardsContract;
uint256 _crvReward = _rewardsContract.earned(address(this));
if (_crvReward != 0) {
// Claim the CRV reward
_totalCrvReward += _crvReward;
_rewardsContract.getReward(address(this), false);
_totalCvxReward += _calculateCVXReward(_crvReward);
}
...
}
This will allow malicious users to call getReward on behalf of Vaults, and basically prevent them to mint get the rewards and get the deserved AMPH tokens.
Recommended Mitigation Steps
Create another functionality inside Vault that similar to claimRewards, but used CVX, CRV balance inside the contract, to perform the AMPH claim and claim the rewards.
0xShaito (Amphora) confirmed and commented:
True! We will fix this.
Impact of the attack would be the loss of the rewards. No user deposits at risk.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the external Convex reward contract permits any caller to invoke getReward for another address, and the Vault's claimRewards logic assumes it will be the one to trigger that call.
Impact
The attack could cause the loss of the rewards that would have been converted into AMPH tokens, but no user deposits are at risk.
What the attacker needed
A Vault with accrued CRV rewards on Convex; ability to call the public Convex reward contract
The fix
The Vault should be changed to claim AMPH using the CVX and CRV balances already held by the contract, rather than relying on triggering getReward itself.
How it was found
- Identify a Vault that has accrued CRV rewards on Convex.
- Call getReward on the Convex reward contract, specifying the Vault's address as the recipient.
- Observe that the Vault's subsequent claimRewards call no longer finds a non-zero reward balance and fails to mint AMPH.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A vault is a smart contract that holds user deposits and earns rewards. The vault expects to collect those rewards itself and convert them into its own token, but the reward contract lets anyone trigger the collection on the vault's behalf. An attacker can do this first, so the vault's own collection step finds nothing left and fails to give out the expected tokens.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.