BlueBerryBank#getPositionValue causes DOS if reward token is added that doens't have an oracle
The getPositionValue function in BlueBerryBank calls pendingRewards to fetch a fresh list of reward tokens and then tries to price each one via an oracle. If a reward token lacks an oracle, the call reverts, causing a temporary denial of service for liquidations and other actions.
0x52 Follow with nobody2018
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2023-04-blueberry-judging/issues/115
Found by
0x52, nobody2018
Summary
collToken.pendingRewards pulls the most recent reward list from Aura/Convex. In the event that reward tokens are added to pools that don't currently have an oracle then it will DOS every action (repaying, liquidating, etc.). While this is only temporary it prevents liquidation which is a key process that should have 100% uptime otherwise the protocol could easily be left with bad debt.
Vulnerability Detail
(address[] memory tokens, uint256[] memory rewards) = IERC20Wrapper(
pos.collToken
).pendingRewards(pos.collId, pos.collateralSize);
for (uint256 i; i < tokens.length; i++) {
rewardsValue += oracle.getTokenValue(tokens[i], rewards[i]);
}
Using the pendingRewards method pulls a fresh list of all tokens. When a token is added as a reward but can't be priced then the call to getTokenValue will revert. Since getPostionValue is used in liquidations, it temporarily breaks liquidations which in a volatile market can cause bad debt to accumulate.
Impact
Temporary DOS to liquidations which can result in bad debt
Code Snippet
Tool used
Manual Review
Recommendation
Return zero valuation if extra reward token can't be priced.
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
Impact
Temporary denial of service to liquidations, which could lead to bad debt accumulation in a volatile market.
What the attacker needed
A reward token is added to a pool; That token has no oracle
The fix
The code should be fixed to return a zero valuation for any extra reward token that cannot be priced, instead of reverting.
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 smart contract calculates the value of a user's position by adding up the value of all reward tokens they have earned. If one of those reward tokens has no price feed (oracle), the calculation fails and the whole transaction reverts. This means actions like liquidations cannot happen until the token gets a price feed, which could leave the protocol with bad debt.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.