Gamers will not receive rewards for allocating to Aave and Beta vaults, while the vaults do generate yield
The Aave and Beta provider contracts return incorrect exchange rates (always 1 and 0 respectively), so the reward calculation for gamers who allocate funds to these protocols always yields zero. As a result, gamers receive no rewards even though the vaults generate yield that is distributed only to depositors.
Source: https://github.com/sherlock-audit/2023-01-derby-judging/issues/313
Found by
Ch_301, Jeiwan, c7e7eff, cergyk, hyh, psy4n0n
Summary
Since AaveProvider and BetaProvider don't track the exchange rate of respective protocol tokens, gamer rewards will always be 0 for these protocols. The protocols, however, will generate yield that will be distributed only to depositors.
Vulnerability Detail
Gamers are participants who allocate funds to yield generating protocols; as a reward, they receive a share of the yield. Depositing and withdrawing of funds, as well as accruing of rewards, happens during rebalancing of vaults. Vaults can be rebalanced once in two weeks, and, between rebalancings, funds generate yield in third-party protocols.
The yield generated by protocols is tracked during rebalnacings using the exchange rate of a protocol: since protocol generate yield, the exchange rate always increases, and the difference in exchange rates between two rebalancings is used to calculated to amount of yield generated between the rebalancings.
However, AaveProvider.exchangeRate and BetaProvider.exchangeRate return wrong exchange rates:
If the exchange rate is always 1, then the numerator of the gamer rewards calculation formula will always be 0, and gamer rewards will always be 0. If the exchange rate is 0, gamer rewards won't be calculated at all.
Impact
Gamers who allocate tokens to Aave and Beta vaults (while these vaults may generate high yield, compared to other protocols) will not receive rewards. The entire yield generated by the vaults will be distributed only among vault depositors.
Code Snippet
- The change in protocol token price determines gamer rewards:
AaveProvideralways return the exchange rate of 1:
BetaProvideralways returns the exchange rate of 0:
Tool used
Manual Review
Recommendation
Consider correctly tracking the exchange rate of Aave and Beta tokens in the respective providers.
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
What the attacker needed
Gamer allocates to Aave or Beta vault
The fix
The providers should correctly track and return the exchange rate of Aave and Beta tokens.
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.
In this system, 'gamers' are people who choose which investment protocols receive funds and earn a share of the profit. The profit is calculated by comparing the value of a protocol token before and after a period. Two of the protocol adapters always report the same value (1 or 0), so the profit calculation gives zero and gamers get nothing, while the actual profit goes only to those who deposited money.
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.