The ````Stream```` contract is designed to receive ETH but not implement function for withdrawal
The Stream contract can accept ETH sent to it, but it has no function to move that ETH out again. Any ETH sent to a Stream instance by mistake would be permanently stuck in the contract.
KingNFT Follow with rvierdiiev
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2022-11-nounsdao-judging/issues/47
Found by
KingNFT, rvierdiiev
Summary
The Stream contract instances can receive ETH but can not withdraw, ETH occasionally sent by users will be stuck in those contracts.
Vulnerability Detail
Shown as the test case, it can receive ETH normally.
contract StreamReceiveETHTest is StreamTest {
function setUp() public override {
super.setUp();
}
function test_receiveETH() public {
s = Stream(
factory.createStream(
payer, recipient, STREAM_AMOUNT, address(token), startTime, stopTime
)
);
vm.deal(payer, 10 ether);
vm.prank(payer);
(bool success, ) = address(s).call{value: 1 ether}("");
assertEq(success, true);
assertEq(address(s).balance, 1 ether);
}
}
Result
Running 1 test for test/Stream.t.sol:StreamReceiveETHTest
[PASS] test_receiveETH() (gas: 167691)
Test result: ok. 1 passed; 0 failed; finished in 1.25ms
Impact
See Summary
Code Snippet
Tool used
Manual Review
Recommendation
Add a rescueETH() function which is similar with the existing rescueERC20()
Discussion
eladmallel
Fix PR: https://github.com/nounsDAO/streamer/pull/10
jack-the-pug
Fix confirmed!
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 the contract has a payable receive function but no rescue or withdrawal function for native ETH, unlike the existing ERC20 rescue.
Impact
ETH sent to a Stream contract by users would be stuck there with no way to recover it.
What the attacker needed
Stream contract deployed; user sends ETH to the contract
The fix
A rescue function for native ETH, similar to the existing ERC20 rescue, was added and the fix was confirmed.
How it was found
- Deploy a Stream instance through the factory.
- Give the payer some ether and send one ether to the Stream address.
- Observe that the call succeeds and the Stream balance becomes one ether.
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 is a program on a blockchain that can hold money. This one was built to accept ether (the currency on Ethereum) when someone sends it, but it has no way to send that ether back out. So if a user accidentally sends ether to it, the money is trapped there forever.
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.