Skip to content
Business logic Audit finding Intermediate

WAuraPools doesn't correctly account for AuraStash causing all deposits to be permanently lost

The WAuraPools contract attempts to transfer stash AURA tokens directly to users when burning wrapped LP tokens, but stash AURA cannot be transferred like a regular ERC20 token, causing all such transfers to revert. As a result, all deposits become permanently unrecoverable.

0x52 Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-07-blueberry-judging/issues/108

Found by

0x52

Some Aura pools have two sources of AURA. First from the booster but also as a secondary reward. This secondary reward is stash AURA that doesn't behave like regular AURA. Although properly accounted for in AuraSpell, it is not properly accounted for in WAuraPools, resulting in all deposits being unrecoverable.

Vulnerability Detail

WAuraPools.sol#L413-L418

    uint256 rewardTokensLength = rewardTokens.length;
    for (uint256 i; i != rewardTokensLength; ) {
        IERC20Upgradeable(rewardTokens[i]).safeTransfer(
            msg.sender,
            rewards[i]
        );

When burning the wrapped LP token, it attempts to transfer each token to msg.sender. The problem is that stash AURA cannot be transferred like an regular ERC20 token and any transfers will revert. Since this will be called on every attempted withdraw, all deposits will be permanently unrecoverable.

Impact

All deposits will be permanently unrecoverable

Code Snippet

WAuraPools.sol#L360-L424

Tool used

Manual Review

Recommendation

Check if reward is stash AURA and send regular AURA instead similar to what is done in AuraSpell.

Discussion

sherlock-admin2

1 comment(s) were left on this issue during the judging contest.

Kral01 commented:

Needs PoC

IAm0x52

Escalate

This was incorrectly excluded.

https://github.com/sherlock-audit/2023-07-blueberry/blob/7c7e1c4a8f3012d1afd2e598b656010bb9127836/blueberry-core/contracts/spell/AuraSpell.sol#L243-L257

    for (uint256 i; i != rewardTokensLength; ) {
        address sellToken = rewardTokens[i];
        if (sellToken == STASH_AURA) sellToken = AURA;

        _doCutRewardsFee(sellToken);
        if (
            expectedRewards[i] != 0 &&
            !PSwapLib.swap(
                augustusSwapper,
                tokenTransferProxy,
                sellToken,
                expectedRewards[i],
                swapDatas[i]
            )
        ) revert Errors.SWAP_FAILED(sellToken);

        /// Refund rest (dust) amount to owner
        _doRefund(sellToken);

        unchecked {
            ++i;
        }

AuraSpell requires the above code to prevent this. WAuraPools uses the exact same reward list and needs the same protections. The result is that funds will be permanently trapped, because the transfer will always fail.

sherlock-admin2

Escalate

This was incorrectly excluded.

https://github.com/sherlock-audit/2023-07-blueberry/blob/7c7e1c4a8f3012d1afd2e598b656010bb9127836/blueberry-core/contracts/spell/AuraSpell.sol#L243-L257

    for (uint256 i; i != rewardTokensLength; ) {
        address sellToken = rewardTokens[i];
        if (sellToken == STASH_AURA) sellToken = AURA;

        _doCutRewardsFee(sellToken);
        if (
            expectedRewards[i] != 0 &&
            !PSwapLib.swap(
                augustusSwapper,
                tokenTransferProxy,
                sellToken,
                expectedRewards[i],
                swapDatas[i]
            )
        ) revert Errors.SWAP_FAILED(sellToken);

        /// Refund rest (dust) amount to owner
        _doRefund(sellToken);

        unchecked {
            ++i;
        }

AuraSpell requires the above code to prevent this. WAuraPools uses the exact same reward list and needs the same protections. The result is that funds will be permanently trapped, because the transfer will always fail.

You've created a valid escalation!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

Shogoki

Seems valid STASH AURA seems to be a valid extraRewardToken but transfer can only be called from the pool, which will actually transfer AURA instead. So if the WAURAPool tries to call transfer it will revert.

hrishibhat

Result: Medium Unique Considering this issue a valid medium

sherlock-admin2

Escalations have been resolved successfully!

Escalation status:

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 does not account for stash AURA being non-transferable and attempts to transfer it directly, unlike AuraSpell which converts it to regular AURA first.

Impact

All deposits in affected WAuraPools become permanently unrecoverable because every withdrawal attempt reverts.

What the attacker needed

Aura pool with stash AURA as reward; User deposits into WAuraPools

The fix

The contract should check if a reward token is stash AURA and send regular AURA instead, similar to the logic in AuraSpell.

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.

Some Aura pools give rewards in a special token called stash AURA, which cannot be sent to another address like normal tokens. The WAuraPools contract tries to send this token directly to users when they withdraw, but that always fails, so users can never get their deposits back.

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.