The time constraint of selling fractions can be bypassed by directly transferring fraction tokens to the buyout contract
The Buyout contract's end function checks the contract's fraction token balance to decide if a buyout succeeded, without distinguishing tokens deposited through the intended sellFractions function from tokens sent directly. An attacker could start a buyout with almost no tokens, then transfer enough fraction tokens directly to the contract just before calling end, so the buyout is treated as successful and the attacker acquires the NFTs for far less than their value.
Originally disclosed on Code4rena
Submitted by PwnedNoMore, also found by Treasure-Seeker
The end function in the Buyout contract uses IERC1155(token).balanceOf(address(this), id) to determine the amount of deposited fraction tokens without distinguishing whether those fraction tokens are depositied by the sellFractions function or by direct transferring. Note that only the sellFractions function is constrained by PROPOSAL_PERIOD.
This vulnerability lets a 51-holder gain the whole batch of NFTs without paying for the rest 49% fractions.
Assume a vault X creates 100 fraction tokens and the market-decided price of a fraction token is 1 ether (i.e., the ideal value of the locked NFTs in vault X is 100 ether). Let’s also assume that Alice holds 51 tokens (maybe by paying 51 ether on opensea).
Followings are two scenarios, where the benign one follows the normal workflow and the malicious one exploits the vulnerability.
Benign Scenario
-
Alice starts a buyout by depositing her 51 fraction tokens and 49 ether, making the
fractionPrice1 ether -
Other users are satisfied with the provided price, and hence no one buys or sells their fraction tokens
-
The buyout succeeds:
- Alice gets the locked NFTs
- Other fraction holders can invoke
cashto redeem their fraction tokens with a price of 1 ether
-
As a result, Alice paid 100 ether in total to get the locked NFTs.
Malicious Scenario
-
Alice starts a buyout by depositing 0 fraction tokens and 1 wei, making the
fractionPrice0.01 wei.- Note that Alice can create a separated account whose balance for the fraction token is 0, to start the buyout
-
No one is satisfied with the price (0.01 wei v/s 1 ether) and hence they will try to buy fraction tokens to reject the buyout
- Since there is not any fraction tokens locked in the
Buyoutcontract from Alice, other users do not need to do anything
- Since there is not any fraction tokens locked in the
-
Alice invokes the
endfunction- But before invoking the
endfunction, Alice directly invokesIERC1155(token).safeTransferFromto send the rest 51 fraction token to theBuyoutcontract - The
endfunction will treat the buyout successful, since theIERC1155(token).balanceOf(address(this), id)is bigger than 50% - The above two message calls happen in a single transaction, hence no one can front-run
- But before invoking the
-
As a result
- Alice only paid 51 ether to get the locked NFTs whose value is 100 ether
- Other fraction holders get nothing (but they had paid for the fraction token before)
In short, a malicious users can buy any NFT by just paying half of the NFT’s market price.
Recommended Mitigation Steps
For each buyout, add a new field to record the amount of fraction tokens deposited by sellFractions. And in the end function, use the newly-added field to determine whether the buyout can be processed or not.
Ferret-san (Fractional) confirmed
HardlyDifficult (judge) commented:
Assets can be transferred in after a failed buyout to treat it as successful. Agree this is High risk.
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
The contract uses its raw fraction token balance to judge buyout success instead of tracking only tokens deposited through the intended sellFractions function, so direct transfers are counted.
Impact
An attacker could acquire the locked NFTs for roughly half their market value, while other fraction holders receive nothing for tokens they had paid for.
What the attacker needed
Attacker holds or can obtain over 50% of fraction tokens; attacker can send a transaction to the Buyout contract
The fix
The contract should record the amount of fraction tokens deposited through sellFractions for each buyout and use that recorded amount, not the raw balance, when deciding whether a buyout succeeds.
How it was found
- Attacker starts a buyout by depositing zero fraction tokens and a tiny amount of ether, setting a very low fraction price.
- Other holders are unhappy with the low price but have nothing to reject because the attacker deposited no tokens.
- Before calling end, the attacker directly transfers enough fraction tokens to the Buyout contract to exceed 50%.
- The attacker calls end in the same transaction, so the contract sees a balance over 50% and treats the buyout as successful.
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.
Fractional ownership splits a valuable item, like an NFT, into many small tokens that people can buy and sell. A buyout lets someone offer to buy all the remaining tokens to take the whole item. The contract checked how many tokens it held, not how they got there, so an attacker could send tokens directly at the last moment and trick it into thinking a low offer had been accepted.
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.