Skip to content
Business logic Audit finding Beginner

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.

Solidity
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

Solidity
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

https://github.com/Vectorized/solady/blob/db4857b4a1e17ad035668b588b41a1c90139b99d/src/utils/LibClone.sol#L193-L204

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!

The original report as published on Sherlock, by KingNFT. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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

  1. Deploy a Stream instance through the factory.
  2. Give the payer some ether and send one ether to the Stream address.
  3. 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.

More by KingNFT

View all

25 more disclosed reports, best first.

More from NounsDAO

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.