
On August 1st, 2024, Convergence Finance (Convergence_fi) — a Curve-based yield-enhancing protocol fell victim to an attack due to lack of proper input validation; which resulted in loss of 58M CVG — nearly amounting to 210K USD.
The root cause of this exploit lies in the claimMultipleStaking function of the CvxRewardDistributor contract. This function is designed to handle reward claims from multiple staking contracts. However, it fails to validate the user inputs, specifically the cvxRewardCount parameter and the contracts listed in the claimContracts array.
1. A user wants to claim rewards from multiple staking contracts.
2. The user calls the claimMultipleStaking function.
3. The user provides a list of legitimate staking contracts in the claimContracts array.
4. The function processes these contracts to accumulate and distribute rewards to the user.
The attacker called the claimMultipleStaking function
function claimMultipleStaking(
ICvxStakingPositionService[] calldata claimContracts,
address _account,
uint256 _minCvgCvxAmountOut,
bool _isConvert,
uint256 cvxRewardCount
) external {
require(claimContracts.length != 0, "NO_STAKING_SELECTED");
/// @dev To prevent an other user than position owner claims through swapping and grief the user rewards in cvgCVX
if (_isConvert) {
require(msg.sender == _account, "CANT_CONVERT_CVX_FOR_OTHER_USER");
}
/// @dev Accumulates amounts of CVG coming from different contracts.
uint256 _totalCvgClaimable;
/// @dev Array merging & accumulating rewards coming from different claims.
ICommonStruct.TokenAmount[] memory _totalCvxClaimable = new ICommonStruct.TokenAmount[](cvxRewardCount);
2. It did not validate the staking contracts provided in the claimContracts array. This allowed the attacker to exploit the function by manipulating the reward distribution process.
3. The attacker deployed a malicious contract that had a function with the same signature as claimCvgCvxMultiple. and it was intended to process reward claims
4. The attacker included the address of their malicious contract in the claimContracts array when invoking the claimMultipleStaking function.
5. Since the function did not validate the contracts in the array, it called the attacker's malicious contract as if it were a legitimate staking contract.
6. The malicious contract’s claimCvgCvxMultiple function was executed, which was designed to mint CVG tokens and transfer Convex rewards. This allowed the attacker to mint a significant amount of CVG tokens — specifically, 58M CVG tokens meant for staking emissions.
/** @dev Claims Cvg & Cvx
* Returns the amount of CVG claimed on the position.
* Returns the array of all CVX rewards claimed on the position.
*/
(uint256 cvgClaimable, ICommonStruct.TokenAmount[] memory _cvxRewards) = cvxStaking.claimCvgCvxMultiple(
_account
);
/// @dev increments the amount to mint at the end of function
_totalCvgClaimable += cvgClaimable;
The claimMultipleStaking function is meant to handle rewards from multiple staking contracts, collecting CVG tokens and Convex rewards from these contracts.
The malicious contract’s claimCvgCvxMultiple function was executed.
The malicious function was designed to mint a large number of CVG tokens and transfer Convex rewards. As a result, the attacker successfully minted 58 million CVG tokens, which were intended for legitimate staking rewards, and effectively stole them.

Convex Finance tried to contact the attacker through on-chain messages and explored all possible recovery options to mitigate the impact of the breach.

Always validate user inputs to ensure they are legitimate. This includes checking parameters and verifying the authenticity of provided contracts.
Regular security audits can help identify and fix vulnerabilities before they are exploited.
Implement monitoring systems to detect unusual activities and respond quickly to potential threats.
Read more About Deep Analysis of the $230M WazirX Exploit Incident
Author : Piyush shukla