Skip to content
Smart contracts Audit finding Intermediate

Users can lose fractions to precision loss during migraction if _newFractionSupply is set very low

When the new fraction supply is set very low, the migration calculation rounds small contributors' shares down to zero, so they receive nothing. In some cases the vault could become permanently frozen because too few fractions can be redeemed to buy it out.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52, also found by 0x29A, hansfriese, and MEP

Precision loss causing loss of user value and potentially cause complete loss to vault.

Proof of Concept

https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Migration.sol#L471-L472

If the supply of the fraction is set to say 10 then any user that uses migrateFractions with less than 10% of the contributions will receive no shares at all due to precision loss. Under certain conditions it may even cause complete loss of access to the vault. In this same example, if less than 5 fractions can be redeemed (i.e. not enough people have more than 10% to overcome the precision loss) then the vault would never be able to be bought out and the vault would forever be frozen.

Recommended Mitigation Steps

When calling propose require that \_newFractionSupply is greater than some value (i.e. 1E18).

stevennevins (Fractional) confirmed

HardlyDifficult (judge) commented:

Rounding can lead to loss of assets. Agree with severity.


The original report as published on Code4rena, by 0x52. 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 integer division in the migration share calculation truncates small holders' results to zero when the new fraction supply is very low.

Impact

Small contributors could lose their entire share, and the vault could become permanently frozen if too few fractions can be redeemed to buy it out.

What the attacker needed

New fraction supply set very low; contributor holds a small share

The fix

The propose function should require the new fraction supply to be above a minimum value, such as 1E18.

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 splits ownership of a vault into many small units called fractions. When the vault is migrated to a new supply, each person's share is recalculated by dividing, and whole-number maths throws away the remainder. If the new total is tiny, small holders' results round down to zero and they lose their stake entirely.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by 0x52

View all

211 more disclosed reports, best first.

More from Fractional v2 contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.