GroupBuy does not check return value of call
The GroupBuy contract sends ETH using a low-level call but does not check whether the call succeeded. If the recipient contract reverts, the ETH remains in GroupBuy while the contract still zeroes the user's contribution, causing a loss of funds for the recipient.
Submitted by Lambda, also found by Trust and IllIllI
Impact
Both usages of call do not check if the transfer of ETH was succesful:
payable(msg.sender).call{value: contribution}("");
...
payable(msg.sender).call{value: balance}("");
This can become very problematic when the recipient is a smart contract that reverts (for instance, temporarily) in its receive function. Then, GroupBuy still assumes that this ETH was transferred out and sets the balance to 0 or deletes userContributions[_poolId][msg.sender], although no ETH was transferred. This leads to a loss of funds for the recipient.
Proof Of Concept
We assume that the recipient is a smart contract that performs some logic in its receive function. For instance, it can be a nice feature for some people to automatically convert all incoming ETH into another token using an AMM. However, it can happen that the used AMM has too little liquidity at the moment or the slippage of a swap would be too high, leading to a revert in the receing contract. In such a scenario, the GroupBuy contract still thinks that the call was succesful, leading to lost funds for the recipient.
Recommended Mitigation Steps
require that the call was successful.
Keeping as High severity because of valid use case and resulting loss of funds if the receiving contract reverts, but the tx doesn’t.
stevennevins (Tessera) confirmed and mitigated:
https://github.com/fractional-company/modular-fractional/pull/204
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
Impact
If the recipient contract reverts in its receive function, the ETH stays in GroupBuy while the user's contribution is zeroed, leading to a loss of funds for the recipient.
What the attacker needed
Recipient is a contract that reverts on receive
The fix
The contract should require that the call was successful, and this was fixed according to the report.
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.
When a smart contract sends Ether to another contract, it uses a low-level call that returns a success flag. If the receiving contract rejects the payment, the call fails but the sending contract continues as if it worked. Here, GroupBuy ignored that flag, so it recorded the payment as done even though the Ether never left, and the user lost their claim to the funds.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.