stakingContext.auraBooster.deposit boolean return value not handled in Boosted3TokenPoolUtils.sol
The function _joinPoolAndStake in Boosted3TokenPoolUtils.sol calls stakingContext.auraBooster.deposit but does not check the boolean return value. An attacker could cause the deposit to fail silently, leaving tokens unstaked and potentially causing a loss of rewards or funds.
Source: https://github.com/sherlock-audit/2022-09-notional-judging/issues/117
Found by
ctf_sec
Summary
stakingContext.auraBooster.deposit boolean return value not handled in Boosted3TokenPoolUtils.sol
Vulnerability Detail
the function _joinPoolAndStake in Boosted3TokenPoolUtils.sol is used extensively when handling the token stake.
However, when entering the stake and interacting with external contract, the logic does not handle the returned boolean value in the code below
// Transfer token to Aura protocol for boosted staking
stakingContext.auraBooster.deposit(stakingContext.auraPoolId, bptMinted, true); // stake = true
In the AuraBooster implmenetation, a Boolean is indeed returned to acknowledge that deposit is completely successfully.
https://etherscan.io/address/0x7818A1DA7BD1E64c199029E86Ba244a9798eEE10#code#F34#L1
/**
* @notice Deposits an "_amount" to a given gauge (specified by _pid), mints a `DepositToken`
* and subsequently stakes that on Convex BaseRewardPool
*/
function deposit(uint256 _pid, uint256 _amount, bool _stake) public returns(bool){
Impact
Notional -> AuraBooster -> BaseRewardPool
Without handling the boolean value explitily, there is risk that transaction may be fail sliently.
Because there are two layers of external call
Code Snippet
Tool used
Manual Review
Recommendation
We recommend the project handle the stakingContext.auraBooster.deposit boolean return value explicitly.
// Transfer token to Aura protocol for boosted staking
bool staked = stakingContext.auraBooster.deposit(stakingContext.auraPoolId, bptMinted, true); // stake = true
require(staked, 'stake failed');
Discussion
jeffywu
@weitianjie2000
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
The code does not check the boolean return value from the external call to auraBooster.deposit, so a failed deposit goes unnoticed.
Impact
The transaction may fail silently, potentially leaving tokens unstaked and causing a loss of rewards or funds.
What the attacker needed
None
The fix
The project should explicitly check the boolean return value from the deposit call and revert if it is false.
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.
When a smart contract calls another contract, the called function can return a true or false to say if it worked. This code ignores that true/false, so if the deposit fails, the main transaction might still continue as if it succeeded. That could leave tokens stuck or not staked, which is a problem for users.
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.