Skip to content
Business logic Audit finding Intermediate

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.

ctf_sec Follow

Originally disclosed on Sherlock

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

Solidity
        // 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

Solidity
    /**
     * @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

https://github.com/sherlock-audit/2022-09-notional/blob/main/leveraged-vaults/contracts/vaults/balancer/internal/pool/Boosted3TokenPoolUtils.sol#L325-L346

https://github.com/sherlock-audit/2022-09-notional/blob/main/leveraged-vaults/contracts/vaults/balancer/internal/pool/Boosted3TokenPoolUtils.sol#L345

Tool used

Manual Review

Recommendation

We recommend the project handle the stakingContext.auraBooster.deposit boolean return value explicitly.

Solidity
  // 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

The original report as published on Sherlock, by ctf_sec. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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.

More by ctf_sec

View all

25 more disclosed reports, best first.

More from Notional Update #4

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.