Null check in pricePerShare
The oracle could return a price of zero for a share, causing division by zero in calculations that use SafeMath, which would revert transactions and lead to a denial of service.
Submitted by hack3r-0m, also found by defsec
oracle can 0 as a price of the share, in that case, 0 will be the denominator in some calculations which can cause reverts from SafeMath (for e.g here: WrappedIbbtc.sol L148) resulting in Denial Of Service.
Recommended Mitigation Steps
Add a null check to ensure that on every update, the price is greater than 0.
dapp-whisperer (BadgerDAO) confirmed:
Agreed. we will implicitly or explicitly add this check.
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 does not check that the price returned by the oracle is greater than zero before using it as a denominator.
Impact
An attacker could cause a denial of service by making the oracle report a zero price, leading to reverts in functions that divide by the price.
What the attacker needed
Oracle reports zero price
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 relies on an outside source (an oracle) to tell it the price of a share. If that price is zero, the contract tries to divide by zero, which is not allowed and makes the transaction fail. This means anyone who can make the oracle report zero can stop the contract from working.
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.