Skip to content
Business logic Audit finding Intermediate

Many unbounded and under-constrained variables in the system can lead to unfair price or DoS

Several sale parameters in the NFT minter contract are unbounded and can be changed by the team during a sale. This could shift the price curve, make the price function revert, or reorder sale phases so that the public sale happens before other phases.

throttle Follow

Originally disclosed on Code4rena

Submitted by throttle, also found by 0xDjango, BowTiedWardens, defsec, dipp, fatherOfBlocks, gzeon, hake, reassor, shung, unforgiven, and WatchPug

Unbounded and under-constrained variables.

Proof of Concept

  1. dsStartTime | daPriceCurveLength | daDropInterval

The team can change the above variables during sale. It will either increase or decrease the price of an NFT. Or it can make currentDaPrice() revert.

uint256 dropPerStep = (startPrice - lowestPrice) / (daPriceCurveLength / daDropInterval);

uint256 elapsed = block.timestamp - daStartTime;
uint256 steps = elapsed / daDropInterval;
uint256 stepDeduction = steps * dropPerStep;

// don't go negative in the next step
if (stepDeduction > startPrice) {
    return lowestPrice;
}
uint256 currentPrice = startPrice - stepDeduction;

ForgottenRunesWarriorsMinter.sol#L275-L297

  1. dsStartTime | mintlistStartTime | publicStartTime | claimsStartTime selfRefundsStartTime

The team can change the above variables. It can result in the wrong sale phases order. For example, the public sale can end up being before every other phase due to accidentally setting it to 0.

Recommended Mitigation Steps

Possible mitigation:

  1. Bound and constrain variables. For example, daDropInterval should be less than daPriceCurveLength Another example: The total sum of each supply phase should not be bigger than MAX_SUPPLY in the NFT smart contract.

wagmiwiz (Forgotten Runes) commented:

This is true but is a low operational risk and can be undone.

gzeon (judge) commented:

Decided to consolidate all issues regarding missing validation of the listed variables here (M-04).


The original report as published on Code4rena, by throttle. 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 contract does not validate or bound the sale timing and price-curve parameters, so they can be set to inconsistent values.

Impact

The team could accidentally or deliberately change prices during a sale, cause the price function to revert, or put the public sale before other phases; the project considers this a low operational risk that can be undone.

What the attacker needed

Team controls sale parameters; parameters changed during sale

The fix

The variables should be bounded and constrained, for example by requiring the drop interval to be shorter than the price curve length and by ensuring the sum of phase supplies does not exceed the maximum supply.

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 is a program that runs on a blockchain and cannot be changed after deployment. This report says some settings in that program have no limits, so the people running it can change them mid-sale and accidentally break the pricing or the order of sale stages.

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 throttle

View all

5 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.