Div by 0
An internal function in a smart contract divides by a variable that can be zero, causing a revert. An attacker could trigger this to disrupt contract functionality.
Submitted by robee, also found by georgypetrov, cmichel, and IllIllI
Division by 0 can lead to accidentally revert, (An example of a similar issue - https://github.com/code-423n4/2021-10-defiprotocol-findings/issues/84)
https://github.com/code-423n4/2022-03-volt/tree/main/contracts/utils/Deviation.sol#L23 a might be 0
It’s internal function but since it is used in another internal functions that are used in public and neither of them has this protection I thought it can be considered as medium (e.g. isWithinDeviationThreshold).
ElliotFriedman (Volt) confirmed
Jack the Pug (judge) commented:
It’s a real issue but just like many other findings, it’s unlikely to be triggered in practice.
Jack the Pug (judge) commented:
In the particular context of this project, which most of the findings won’t lead to a code update, I’ll keep this as a
Med.
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 function does not check that the divisor is non-zero before dividing.
Impact
The contract could revert, potentially disrupting its operation, but the judge noted it is unlikely to be triggered in practice.
What the attacker needed
None
The fix
The function should check that the divisor is not zero before dividing.
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.
Smart contracts are programs on a blockchain. If a program tries to divide a number by zero, it crashes and stops working. This report says a function could do that, so someone might make it crash on purpose.
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.