Loss of assumed functionality of the Onboarding contract in a highly-sensitive area
The setStaking function in the BlastOnboardingBoot contract does not approve the new staking pool to spend the bootstrap LP tokens, nor does it revoke the old pool's approval. If the owner changes the staking contract, users cannot claim tokens into the new pool because the transfer fails.
Trust Follow with hals and SpicyMeatball
Originally disclosed on Code4rena
Submitted by Trust, also found by hals and SpicyMeatball
The BlastOnboardingBoot contract contains the bootstraping funds. After launch it will start a reward staking pool and allow users to claim tokens into it. This is in the launch sequence:
staking = new LockingMultiRewards(pool, 30_000, 7 days, 13 weeks, address(this));
staking.setOperator(address(this), true);
staking.transferOwnership(owner);
// Approve staking contract
pool.safeApprove(address(staking), totalPoolShares);
Note that the code approves the staking pool towithdraw from the created LP. The code also provisions setting of the staking contract to another one.
// Just in case we need to change the staking contract after
// the automatic bootstrapping process
function setStaking(LockingMultiRewards _staking) external onlyOwner {
if (ready) {
revert ErrCannotChangeOnceReady();
}
staking = _staking;
emit LogStakingChanged(address(_staking));
}
The issue is that this function lacks two actions:
- Resetting the previous staking pool’s approval to zero
- More importantly, approving the new staking pool all the bootstrap pool shares
As a result, owner which assumes changing to a new staking pool is perfectly safe, will in fact cause reverts when users try claiming in the new pool. It is still possible to revert back to the old staking pool, but in fact it will never be possible to migrate to a new pool as no other approve() call exists in the contract.
Impact
Loss of assumed functionality of the Onboarding contract in a highly-sensitive area.
Recommended Mitigation Steps
- Approve the new contract
- Revoke approval from the previous contract for good sanitization
Change staking contract, miss approve update and reset.
0xCalibur (Abracadabra) acknowledged and commented:
we can also upgrade the bootstrapper if we were to use the function. I agree with the finding but we just decided to remove the function setStaking.
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
Impact
If the owner uses setStaking to change the staking contract, users will be unable to claim tokens into the new pool because the transfer will revert; the owner can revert to the old pool, but migration to a new pool is impossible.
What the attacker needed
Owner calls setStaking; users attempt to claim into new pool
The fix
The setStaking function should approve the new staking contract for the bootstrap pool shares and revoke approval from the previous staking contract; alternatively, the function could be removed.
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.
This is a smart contract that lets users claim tokens into a staking pool. The contract gives the staking pool permission to take tokens from it. When the owner switches to a new staking pool, the code forgets to give the new pool that permission, so claims fail. It also forgets to remove permission from the old pool.
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.