Setting Factory.bondPercentDiv to zero cause Denial of Service in Auction.bondForRebalance()
The owner can set a divisor to zero, causing a division-by-zero revert in a bond calculation. This blocks the bondForRebalance function, leading to a denial of service.
Submitted by pants.
The function Factory.setBondPercentDiv() allows the owner to set the state variable Factory.bondPercentDiv to zero.
Impact
If Factory.bondPercentDiv equals zero then the function Auction.bondForRebalance() will always revert due to a division by zero:
bondAmount = basketToken.totalSupply() / factory.bondPercentDiv();
Tool Used
Manual code review.
Recommended Mitigation Steps
Add an appropriate require statement to the function Factory.setBondPercentDiv() to disallow setting Factory.bondPercentDiv to zero.
frank-beard (Kuiper) acknowledged
Alex the Entreprenerd (judge) commented:
Similarly to #24 agree with finding and raising to medium
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 setter function lacks a check to prevent setting the divisor to zero, and the calculation does not guard against division by zero.
Impact
The bondForRebalance function always reverts, causing a denial of service for that functionality.
What the attacker needed
Owner privileges
The fix
Add a require statement in setBondPercentDiv to disallow setting the value to zero.
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 has a setting that controls how a bond amount is calculated. If that setting is set to zero, the calculation tries to divide by zero, which is not allowed, so the function always fails. This means a key action in the contract cannot be performed.
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.