Skip to content
Business logic Audit finding Intermediate

A user can ‘borrow’ dMute balance for a single block to increase their amplifier APY

The amplifier's APY is based on the user's dMute delegation balance, but the contract only checks this balance at the staking block. An attacker could borrow dMute delegation for a single block to stake and earn a higher APY without holding the tokens long-term.

0xA5DF Follow

Originally disclosed on Code4rena

Submitted by 0xA5DF

The amplifier’s APY is calculated based on the user’s dMute balance (delegation balance to be more accurate) - the more dMute the user holds the higher APY they get.

However, the contract only checks the user’s dMute balance at staking, the user doesn’t have to hold that balance at any time but at the staking block.

This let’s the user bribe somebody to delegate them their dMute for a single block and stake at the same time.

Since the balance checked is the delegation balance (getPriorVotes) this even makes it easier - since the ‘lender’ doesn’t even need to trust the ‘borrower’ to return the funds, all the ‘lender’ can cancel the delegation on their own on the next block.

The lender can also create a smart contract to automate and decentralize this ‘service’.

Impact

Users can get a share of the rewards that are supposed to incentivize them to hold dMute without actually holding them.

In other words, the same dMute tokens can be used to increase simultaneous staking of different users.

Proof of Concept

The following code shows that only a single block is being checked to calculate the accountDTokenValue at calculateMultiplier():

        if(staked_block != 0 && enforce)
          accountDTokenValue = IDMute(dToken).getPriorVotes(account, staked_block);
        else
          accountDTokenValue = IDMute(dToken).getPriorVotes(account, block.number - 1);

The block checked when rewarding is the staked block, since enforce is true when applying reward:

        reward = lpTokenOut.mul(_totalWeight.sub(_userWeighted[account])).div(calculateMultiplier(account, true));

Recommended Mitigation Steps

Make sure that the user holds the dMute for a longer time, one way to do it might be to sample a few random blocks between staking and current blocks and use the minimum balance as the user’s balance.

mattt21 (Mute Switch) disputed and commented:

dMute is a soulbound token that cannot be transferred. You can only receive it via burning mute for dmute with a minimum timelock for 7 days. This issue does not work as you cannot borrow dmute. You can borrow mute, and burn it for dmute, but you will be holding those dmute tokens for at least 7 days until you can redeem them back to mute.

Please look at how the dMute token functions.

0xA5DF (warden) commented:

Indeed, it can’t be transferred. However it can be delegated, and since the amplifier checks for the delegation balance I think this attack path is still valid.

Picodes (judge) commented:

@mattt21 - I do agree with @0xA5DF on this one. Unless I am missing something there is no restriction on delegations here, so the attack would work.


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

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

Likely the contract uses a single-block snapshot of the delegation balance to determine the multiplier, without requiring the balance to be held over time.

Impact

Users could earn a larger share of rewards without holding dMute, and the same dMute could be used to boost multiple users' staking simultaneously.

What the attacker needed

DMute can be delegated; lender agrees to delegate for one block; borrower stakes in the same block

The fix

The contract should require users to hold the dMute balance over a longer period, for example by sampling multiple blocks and using the minimum balance.

How it was found

  1. The lender delegates their dMute to the borrower for a single block.
  2. The borrower stakes at the same block, so the contract checks the delegated balance.
  3. After staking, the lender cancels the delegation on the next block.
  4. The borrower keeps the higher APY based on the borrowed balance.

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.

The amplifier rewards users with higher interest if they hold more dMute tokens. But it only checks the balance at the moment of staking, so someone could temporarily get a large delegation of dMute for that one block, stake, and then return it, earning rewards as if they held it all along.

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

View all

35 more disclosed reports, best first.

More from Mute Switch - Versus contest

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.