The rather harsh requirement of `tokenAmount` makes it inapplicable for certain tokens
The contract requires the token amount to be at least the stream duration in seconds, which is unsuitable for tokens with high per-wei value like WBTC and EURS. This makes the system inapplicable for those tokens because the minimum amount becomes prohibitively expensive.
rvierdiiev Follow with WATCHPUG
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2022-11-nounsdao-judging/issues/63
Found by
rvierdiiev, WATCHPUG
Summary
The requirements for tokenAmount >= stopTime - startTime will not be suitable for all tokens and therefore need to be made less applicable for certain tokens like WBTC and EURS.
Vulnerability Detail
Requiring the tokenAmount >= stopTime - startTime is suitable for USDC and WETH.
However, such requirements will be a bit too harsh for other popular tokens, eg, WBTC (decimals: 8) and EURS (decimals: 2). Therefore, make the system less applicable for those tokens.
For WBTC, it must be 0.31536 WBTC per year (worth about $5,400) to meet this requirement, and for EURS, it must be at least 315,360 EURS per year (worth about $315,000).
Impact
The system will be inapplicable for certain tokens with higher per wei value, eg, WBTC and EURS.
Code Snippet
https://github.com/sherlock-audit/2022-11-nounsdao/blob/main/src/StreamFactory.sol#L200
Tool used
Manual Review
Recommendation
Consider changing to tokenAmount * RATE_DECIMALS_MULTIPLIER >= stopTime - startTime.
Discussion
eladmallel
Fix PR: https://github.com/nounsDAO/streamer/pull/12
jack-the-pug
Fix confirmed!
Notice: The fix should be merged together with https://github.com/nounsDAO/streamer/pull/7, otherwise, ratePerSecond() can be 0.
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 enforces a minimum token amount equal to the stream duration in seconds without adjusting for the token's decimals or value, making it unsuitable for tokens with high per-wei value.
Impact
The system will be inapplicable for certain tokens with higher per wei value, such as WBTC and EURS, because the minimum required amount becomes prohibitively expensive.
What the attacker needed
None
The fix
The fix was to change the requirement to `tokenAmount * RATE_DECIMALS_MULTIPLIER >= stopTime - startTime`, and it was confirmed fixed.
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.
This is a smart contract that streams tokens over time. It required the total amount of tokens to be at least the number of seconds in the stream, which works for tokens like USDC but not for tokens with high value per smallest unit, like WBTC. So for WBTC, you would need to stream at least 0.31536 WBTC per year, which is about $5,400, making it impractical.
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.