Submitted by sseefried, also found by TrungOre
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Buyout.sol#L39
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Buyout.sol#L66-L68
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Buyout.sol#L235
A user can start a perpetual buyout that cannot be stopped except by making the buyout succeed. This can be done by creating a malicious contract that will call back to start when it receives ETH via its receive function. The user then starts the perpetual buyout by calling start from the malicious contract.
Assume the rejection period has passed and the auction pool is not large enough (i.e. < 50%). If end is called then the method _sendEthOrWeth will attempt to send ETH to the malicious contract. The contract will simply call back to start sending the ETH it has just received.
The impact is that end can never be called on this buyout proposal if the buyout auction has failed. Worse, no new buyout proposal can be made since the current one is still live, and it is never in a state where it is not live.
The others users will either need to accept that assets are locked inside the vault, or that they will need to sellFractions in order to make the buyout succeed.
A foundry test exhibiting this attack has been written in a private fork of the contest repo.
Note that onERC1155Received needs to be implemented in the malicious contract.
Manual inspection + Foundry
Prevent re-entrancy in the start function by using the nonReentrant modifier provided by OpenZeppelins ReentrancyGuard contract, or use an equivalent custom solution.
aklatham (Fractional) marked as duplicate and commented:
sseefried (warden) commented:
stevennevins (Fractional) commented:
HardlyDifficult (judge) commented:
