Skip to content
DoS Audit finding Beginner

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.

robee Follow

Originally disclosed on Code4rena

Submitted by robee, also found by georgypetrov, cmichel, and IllIllI

Deviation.sol#L23

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.


The original report as published on Code4rena, by robee. 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 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.

More by robee

View all

6 more disclosed reports, best first.

More from Volt Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.