VE3DRewardPool allows the same reward address to be added multiple times to the extraRewards array
The reward manager can add the same reward address multiple times to the extraRewards array, causing the pool to stake the same amount twice with that reward contract. This could lead to rewards being disbursed twice, breaking protocol invariants.
Submitted by Ruhum
https://github.com/code-423n4/2022-05-vetoken/blob/main/contracts/VE3DRewardPool.sol#L134-L139
https://github.com/code-423n4/2022-05-vetoken/blob/main/contracts/VE3DRewardPool.sol#L214-L216
https://github.com/code-423n4/2022-05-vetoken/blob/main/contracts/BaseRewardPool.sol#L121
Impact
When the same address is included twice it might cause issues depending on the contract. I checked the current convex contract to see which addresses were added to the extraRewards array. For cvxCRV Rewards there’s only 0x7091dbb7fcbA54569eF1387Ac89Eb2a5C9F6d2EA which is the VirtualBalanceRewardPool contract.
Proof of Concept
rewardManageradds the same address twice throughaddExtraReward()- VE3DRewardPool calls
stake()twice with the same amount:
function stake(uint256 _amount) public updateReward(msg.sender) {
require(_amount > 0, "RewardPool : Cannot stake 0");
//also stake to linked rewards
uint256 length = extraRewards.length;
for (uint256 i = 0; i < length; i++) {
IRewards(extraRewards[i]).stake(msg.sender, _amount);
}
//add supply
_totalSupply = _totalSupply.add(_amount);
//add to sender balance sheet
_balances[msg.sender] = _balances[msg.sender].add(_amount);
//take tokens from sender
stakingToken.safeTransferFrom(msg.sender, address(this), _amount);
emit Staked(msg.sender, _amount);
}
Recommended Mitigation Steps
Prevent the same addresses from being added multiple times to the extraRewards array.
jetbrain10 (vetoken Finance) disagreed with severity and commented:
Will add code to check if this is same reward address.
Alex the Entreprenerd (judge) commented:
The warden has shown how, due to a misconfiguration, rewards could be disbursed twice, breaking protocol invariants.
Because this is contingent on admin privilege, I believe Medium Severity to be appropriate.
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 addExtraReward function does not check whether the reward address is already in the extraRewards array, allowing duplicates.
Impact
Rewards could be disbursed twice, breaking protocol invariants, but this is contingent on admin privilege.
What the attacker needed
RewardManager privilege
The fix
The code should be changed to check whether the reward address is already present before adding it to the extraRewards array.
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 reward pool lets users stake tokens and earn extra rewards from other contracts. The manager can accidentally add the same reward contract twice, so when a user stakes, the pool tells that reward contract to stake the same amount twice. This could double-count rewards, which is unfair and breaks the system's rules.
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.