Skip to content
Business logic Audit finding Intermediate

YieldSourcePrizePool_canAwardExternal does not work

The canAwardExternal check in the YieldSourcePrizePool compares the external token against the yield source contract address rather than the yield source's interest-bearing token. This could let the prize strategy award the interest-bearing token, which may cause errors and loss of funds when redeeming the underlying asset.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The idea of YieldSourcePrizePool_canAwardExternal seems to be to disallow awarding the interest-bearing token of the yield source, like aTokens, cTokens, yTokens.

“@dev Different yield sources will hold the deposits as another kind of token: such a Compound’s cToken. The prize strategy should not be allowed to move those tokens.”

However, the code checks _externalToken != address(yieldSource) where yieldSource is the actual yield strategy contract and not the strategy’s interest-bearing token. Note that the yieldSource is usually not even a token contract except for ATokenYieldSource and YearnV2YieldSource.

The _canAwardExternal does not work as expected. It might be possible to award the interest-bearing token which would lead to errors and loss of funds when trying to redeem underlying.

There doesn’t seem to be a function to return the interest-bearing token. It needs to be added, similar to depositToken() which retrieves the underlying token.

asselstine (PoolTogether) acknowledged:

This is an interesting one:

  • the yield source interface does not require the deposit be tokenized; the implementation is entirely up to the yield source.
  • the _canAwardExternal is a legacy of older code. Since it had to be included it was set to assume the yield source was tokenized.

Since yield sources are audited and analyzed, I think this is a pretty low risk. Additionally, not all of the yield sources are tokenized (Badger and Sushi are not), so it isn’t a risk for them.

We could have canAwardExternal on the yield source itself, but it would add gas overhead.

aodhgan (PoolTogether) commented:

Could we add an check - function _canAwardExternal(address _externalToken) internal override view returns (bool) { return _externalToken != address(yieldSource) && _externalToken != address(yieldSource.depositToken()) }

asselstine (PoolTogether) commented:

We could add another check, but it’s still arbitrary. The point is that the yield source knows what token the prize pool may or may not hold, so without asking the yield source it’s just a guess.

Let’s leave it as-is

The original report as published on Code4rena, by cmichel. 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 check compares the external token to the yield source contract address instead of the yield source's interest-bearing token address, and no function exists to retrieve that token.

Impact

The interest-bearing token could potentially be awarded, which may lead to errors and loss of funds on redemption; the maintainer judged this a pretty low risk because yield sources are audited and some are not tokenised.

What the attacker needed

Prize strategy can award external tokens; yield source uses a tokenised deposit token

The fix

The maintainer decided to leave it as-is, noting that a proper fix would require asking the yield source which tokens it holds rather than guessing.

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.

A prize pool holds user deposits inside a yield source, which represents those deposits as its own special token (for example a Compound cToken). A guard meant to stop the prize strategy from handing out that special token compares against the wrong address, so the guard does not actually protect it. If the special token were awarded away, the pool could fail or lose money when it tries to convert 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 cmichel

View all

196 more disclosed reports, best first.

More from PoolTogether

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.