unstreamed is a public variable, and it's been actively managed in stake(), updateStreamInternal(). However, since users can also withdraw unstreamed depositToken, the global variable unstreamed should be updated in withdraw() as well.
For example:
Alice deposits 10,000 depositToken;
Alice withdraws 10,000 depositToken right after step 1.
Handle
WatchPug
Vulnerability details
unstreamed
is a public variable, and it's been actively managed instake()
,updateStreamInternal()
. However, since users can also withdraw unstreamed depositToken, the global variableunstreamed
should be updated inwithdraw()
as well.For example:
10,000
depositToken;10,000
depositToken right after step 1.unstreamed
to be0
;unstreamed
to be10,000
.https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L455-L479
Recommendation
Change to: