Skip to content
Business logic Audit finding Intermediate

Critical variables shouldn’t be changed after they are set

Several setter functions for the Dutch auction parameters could be called more than once, so the owner could change the start price, lowest price, curve length or drop interval during the sale. This could let the owner stop the auction or manipulate the price, undermining the integrity of the auction.

pedroais Follow

Originally disclosed on Code4rena

Submitted by pedroais, also found by AuditsAreUS, BowTiedWardens, defsec, GimelSec, gzeon, IllIllI, leastwood, and WatchPug

ForgottenRunesWarriorsMinter.sol#L564 ForgottenRunesWarriorsMinter.sol#L571 ForgottenRunesWarriorsMinter.sol#L557 ForgottenRunesWarriorsMinter.sol#L571

The price for the dutch auction could be altered.

Proof of Concept

I previously sent an issue about start time being settable more than once. This also happens for many other variables. Since they are many I will send them all in a single issue.

The following functions should only be called once to ensure trustlessness and integrity of the dutch auction: setDaPriceCurveLength setStartPrice setLowestPrice setDaDropInterval

The price in the dutch auction is computed by this formula: uint256 dropPerStep = (startPrice - lowestPrice) / (daPriceCurveLength / daDropInterval);

By making dapriceCurveLength or daDropInterval equal to 0 the owner could stop the auction. This could benefit the owner since the price lowers with time and everyone pays the final lower price. If the auction does well at the beginning the owner could stop the auction to stop the price from being lower. This works against the integrity of the dutch auction.

Also changing the Start Price or the Lowest price in the middle of the auction could allow the owner to manipulate the price.

Recommended Mitigation Steps

To each of these setter functions add require (variable == 0) to ensure they are set once in a permanent way. Also, the Lowest price < startPrice should be required.

gzeon (judge) commented:

While centralization risk is acknowledged by the team, I agree that these variable should not be able to be changed during sale since it may lead to loss of functionality. Consolidating all similar issue for different variables here.


The original report as published on Code4rena, by pedroais. 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 setter functions for the auction parameters lacked a check that each value is only set once, so they remained callable after the auction started.

Impact

The owner could stop the auction early or change the start or lowest price mid-sale, which could let them manipulate what buyers pay and breaks the trustlessness of the auction.

What the attacker needed

Owner controls the contract; auction already running

The fix

Each setter should require that the variable is still zero so it can only be set once, and the contract should also require that the lowest price is below the start 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 Dutch auction starts at a high price and drops over time until someone buys. The contract had functions that let the owner change the auction settings at any moment, even after the sale began. Because the owner controls those settings, buyers cannot trust that the price will follow the rules they saw at the start.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by pedroais

View all

6 more disclosed reports, best first.

More from Forgotten Runes Warrior Guild contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.