Skip to content
Business logic Audit finding Intermediate

Users are forced to swap all reward tokens with no slippage protection

AuraSpell swaps all reward tokens to a debt token without allowing users to set a minimum output amount, so the swap can be sandwiched and the rewards stolen.

0x52 Follow with Bauer, Breeje and 4 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-04-blueberry-judging/issues/121

Found by

0x52, Bauer, Breeje, J4de, ctf_sec, n1punp, nobody2018

Summary

AuraSpell forces users to swap their reward tokens to debt token but doesn't allow them to specify any slippage values.

Vulnerability Detail

AuraSpell.sol#L193-L203

    for (uint256 i = 0; i < rewardTokens.length; i++) {
        uint256 rewards = _doCutRewardsFee(rewardTokens[i]);
        _ensureApprove(rewardTokens[i], address(swapRouter), rewards);
        swapRouter.swapExactTokensForTokens(
            rewards,
            0,
            swapPath[i],
            address(this),
            type(uint256).max
        );
    }

Above all reward tokens are swapped and always use 0 for min out meaning that deposits will be sandwiched and stolen.

Impact

All reward tokens can be sandwiched and stolen

Code Snippet

AuraSpell.sol#L149-L224

Tool used

Manual Review

Recommendation

Allow user to specify slippage parameters for all reward tokens

The original report as published on Sherlock, by 0x52. 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 contract hardcodes a minimum output of zero for token swaps, providing no slippage protection.

Impact

All reward tokens can be sandwiched and stolen.

What the attacker needed

None

The fix

The contract should allow users to specify slippage parameters for all reward token swaps.

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 contract swaps tokens, it can set a minimum amount to receive to protect against price changes. Here, the contract sets that minimum to zero, so an attacker can manipulate the price and take the difference.

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 0x52

View all

211 more disclosed reports, best first.

More from Blueberry Update #3

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.