Alter velo receptions computation
The initializeReceiverWith function uses a flag that can be bypassed by passing address(0), allowing the deployer to re-initialize the contract and set arbitrary values for redeemableVELO and redeemableUSDC. This could let the deployer mint extra VELO and manipulate redemption calculations to receive more tokens than expected.
Submitted by 0x1f8b, also found by hansfriese
The deployer can modify the values to obtain different values than expected.
Proof of Concept
The flag used in initializeReceiverWith to prevent re-initialization is fantomSender == address(0), however the provided address for that value is not checked to be different from address(0), so it could be initialized multiple times to establish that value.
This could allow minting multiple Velos into Velo.mintToRedemptionReceiver and setting the wrong value in redeemableVELO and redeemableUSDC to affect the calculations of the previewRedeem method and later receive larger amounts of tokens in lzReceive than expected.
Affected source code:
Recommended Mitigation Steps
- Ensure that the provided addresses are not
address(0).
pooltypes (Velodrome) acknowledged
Alex the Entreprenerd (judge) commented:
The warden has shown how, through a combination of misconfiguration and admin privilege, more tokens than expected could be transfered.
In looking at
VeloandMinterwe can see thatRedemtionReceiverhas to be set byminterwhich at deployment time will be the deployer.I don’t believe the exploit can be applied after a correct configuration as
Minteris unable to set a newRedemptionReceivermeaning only the original deployer could pull of the exploit only until they setmintertoMinter.sol.Because of the external requirements, Medium Severity is appropriate; however, I believe the likelihood of this attack being pulled off is minimal.
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 initialization guard checks a state variable that can be set to address(0), allowing repeated initialization.
What the attacker needed
Deployer privilege; before minter is set to Minter.sol
The fix
Ensure that the provided addresses are not address(0).
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 smart contract has a setup function that should only run once. It checks a value to see if setup already happened, but that check can be tricked by passing a special empty address. The person who deployed the contract could run setup again and change important numbers, potentially getting more tokens than they should.
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.