Skip to content
Business logic Audit finding Intermediate

All the scxMinted is at risk of being burnt.(Limbo.sol)

A zero value in a variable used to calculate adjustedRectangle would make excessSCX equal all scxMinted, and since adjustedRectangle is zero, nothing is deducted from scxMinted, putting all minted SCX at risk of being burnt. The check on line 224 would also fail for high-value migrations, preventing SCX from being sent to the AMM helper and LP from being minted.

Hawkeye Follow

Originally disclosed on Code4rena

Submitted by Hawkeye

If one of the variables that calculate adjustedRectangle is a zero value,it will impair the calculation of excessSCX which would equal to all of the scxMinted on line 219.Nothing will be deducted from scxMinted on line 229 since adjustedRectangle =0 putting all of the former at risk of being burnt(line 230).

Also, the check on line 224 would not pass for high value migrations since scxMinted would always be greater than the adjustedRectangle.No scx would be avaliable to be sent to the AMM helper nor would there be any LP minted.

Furthermore, since SCX is needed to ensure the proper functioning of the protocol,ie, to provide liquidity and influence the value of Flan, it would be imperative that the correct value of excessScx is accounted for.

Recommended Mitigation Steps

Insert a require statement on line 222:

require (AdjustedRectangle! =0, “ err”)

gititGoro (Behodler) acknowledged and commented:

I really appreciate how deeply you’ve thought about this. Requires a thorough understanding of Limbo. Indeed your handle is apt (unless you’re just naming yourself after the marvel hero in which case I would have to see your archery skills).

The RectangleOfFairness is hardcoded as a constant 30 eth in Limbo.sol (line 269) so that can’t be zero. The only way it could be zero is if the inflation factor is zero which is a community set variable. However, there might be some funny community edge case where they want it set to zero. For instance, suppose the community feels in some distant future that flan is sufficiently liquid but that SCX is still a bit dilute. Maybe they’d want to bring on new tokens while burning all new scx.

I’m marking this as acknowledged, rather than disputed because your reasoning is really good.


The original report as published on Code4rena, by Hawkeye. 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 a missing validation that adjustedRectangle is non-zero before using it in calculations that determine how much SCX to deduct.

Impact

All minted SCX could be burnt, and for high-value migrations no SCX would be available for the AMM helper and no LP would be minted.

What the attacker needed

Inflation factor set to zero by community

The fix

The report recommends inserting a require statement to ensure adjustedRectangle is not zero; the project acknowledged the issue but noted the main variable is hardcoded and only a community-set inflation factor could be 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.

This report is about a smart contract that handles a token called SCX. If a certain number used in a calculation becomes zero, the contract could mistakenly think all the SCX ever created should be removed, which would destroy them. The author suggests adding a check to stop the number from being zero.

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 from Behodler 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.