Skip to content
DoS Audit finding Intermediate

Validations

Several setter functions in the smart contract lack input validation, allowing the owner to set values that cause division by zero errors or create empty bounties. An attacker with owner privileges could exploit these to disrupt protocol operations.

pauliax Follow

Originally disclosed on Code4rena

Submitted by pauliax.

Impact

function setBondPercentDiv should validate that newBondPercentDiv is not 0, or bondForRebalance will experience division by zero error otherwise. If you want to allow 0 values, then bondForRebalance should accommodate for such a possibility.

function addBounty should check that amount > 0 to prevent empty bounties.

function setMinLicenseFee should validate that it is not over 100%: newMinLicenseFee <= BASE.

function mintTo should validate that ‘to’ is not an empty address (0x0) to prevent accidental loss of tokens.

function validateWeights should validate that token is not this basket erc20: require(\_tokens\[i] != address(this));

function proposeBasketLicense could validate that tokenName and tokenSymbol are not empty.

function setBondPercentDiv should validate that newBondPercentDiv > 1, otherwise it may become impossible to bondBurn because then bondAmount = totalSupply and calculation of newIbRatio will produce division by zero runtime error. Of course, this value is very unlikely but still would be nice to enforce this algorithmically.

Recommended Mitigation Steps

Consider applying suggested validations to make the protocol more robust.

frank-beard (Kuiper) acknowledged and disagreed with severity

Alex the Entreprenerd (judge) commented:

I agree with the warden, adding these checks will provide additional safety guarantees to protocol users (by limiting owner privileges)

Additionally, some of these setters can be used to DOS the protocol, as such this is a valid medium severity finding

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

Impact

An attacker with owner privileges could cause division by zero errors or create empty bounties, potentially disrupting the protocol.

What the attacker needed

Owner privileges

The fix

The report recommends adding validation checks to the mentioned functions to prevent zero or invalid values.

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.

This report is about a smart contract where some functions that change settings do not check their inputs. For example, a function that sets a divisor does not ensure the new value is not zero, which would cause a division-by-zero error when used later. This could let someone with special permissions break parts of the contract.

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 pauliax

View all

16 more disclosed reports, best first.

More from Kuiper 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.