If the recipient is added to the USDC blacklist, then cancel() does not work
The cancel() function in a token streaming contract transfers the vested USDC to the recipient before cancelling future payments. If the recipient is blacklisted by USDC, the transfer fails, preventing the payer from cancelling the stream and withdrawing future payments.
Source: https://github.com/sherlock-audit/2022-11-nounsdao-judging/issues/37
Found by
Zarf, cccz, bin2chen, joestakey
Summary
cancel() will send the vested USDC to the recipient, if the recipient is added to the USDC blacklist, then cancel() will not work
Vulnerability Detail
When cancel() is called, it sends the vested USDC to the recipient and cancels future payments. Consider a scenario where if the payer intends to call cancel() to cancel the payment stream, a malicious recipient can block the address from receiving USDC by adding it to the USDC blacklist (e.g. by doing something malicious with that address, etc.), which prevents the payer from canceling the payment stream and withdrawing future payments
function cancel() external onlyPayerOrRecipient {
address payer_ = payer();
address recipient_ = recipient();
IERC20 token_ = token();
uint256 recipientBalance = balanceOf(recipient_);
// This zeroing is important because without it, it's possible for recipient to obtain additional funds
// from this contract if anyone (e.g. payer) sends it tokens after cancellation.
// Thanks to this state update, `balanceOf(recipient_)` will only return zero in future calls.
remainingBalance = 0;
if (recipientBalance > 0) token_.safeTransfer(recipient_, recipientBalance);
Impact
A malicious recipient may prevent the payer from canceling the payment stream and withdrawing future payments
Code Snippet
https://github.com/sherlock-audit/2022-11-nounsdao/blob/main/src/Stream.sol#L237-L249
Tool used
Manual Review
Recommendation
Instead of sending tokens directly to the payer or recipient in cancel(), consider storing the number of tokens in variables and having the payer or recipient claim it later
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!
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 cancel() function performs an external token transfer before completing the cancellation, so a failure in that transfer (due to a blacklist) reverts the whole cancellation.
Impact
A malicious recipient could prevent the payer from cancelling the payment stream and withdrawing future payments.
What the attacker needed
Recipient is blacklisted by USDC; payer wants to cancel the stream
The fix
The fix was to store the tokens in variables and let the payer or recipient claim them later, rather than transferring directly in cancel().
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 lets someone pay another person over time. The person paying can cancel the stream, but the contract first sends the already-earned money to the recipient. If the recipient's address is blocked by the USDC stablecoin (for example, because it was involved in something bad), that transfer fails, so the cancellation also fails. This means the payer cannot stop future payments.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.