Skip to content
Business logic Audit finding Intermediate

Two address tokens can be withdrawn by the payer even when the stream has began

DecorativePineapple Follow with rvierdiiev, hansfriese and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-11-nounsdao-judging/issues/52

Found by

DecorativePineapple, rvierdiiev, hansfriese, pashov

Summary

It has been identified that if a stream has begun with a two address token the payer can withdraw the full amount via the rescueERC20 function.

Vulnerability Detail

Two address tokens exists in the blockchain. For example, Synthetix's ProxyERC20 contract is such a token which exists in many forms (sUSD, sBTC...). A stream can be created with such tokens, but the payer can withdraw the full amount via the rescueERC20 function. The only check in the rescueERC20 function is that tokenAddress == address(token(), which is irrelevant in the case of two address tokens.

Impact

This can make the payer be able to withdraw the funds that are deposited in the stream and break the system, because the balance of the stream contract is zero and the recipient() cannot withdraw the fair amount based on the rate and the time elapsed.

Code Snippet

The payer can withdraw the full amount of token via the rescueERC20 function:

Solidity
    function rescueERC20(address tokenAddress, uint256 amount) external onlyPayer {
        if (tokenAddress == address(token())) revert CannotRescueStreamToken();

        IERC20(tokenAddress).safeTransfer(msg.sender, amount);
    }

Tool used

Manual Review

Recommendation

Replace the address check with a balance check - record the balance of the token that's deposited in the stream before and after the transfer and assert that they are equal.

Discussion

eladmallel

Fix PR: https://github.com/nounsDAO/streamer/pull/6

The PR fixes multiple issues because they were touching the same code.

jack-the-pug

Fix confirmed!

The original report as published on Sherlock, by DecorativePineapple. 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.

What is known

A medium-severity business logic bug in NounsDAO. Sherlock made it public on 4 December 2022. Found in the 27 audit contest (finding M-4), also found by 3 other wardens.

About Business logic

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

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 DecorativePineapple

View all

1 more disclosed report, 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.