Contract variable unstreamed is not updated in withdraw function which can lead to unstability
Proof of Concept
Observe the stake function of Stream contract
function stake(uint112 amount) public lock updateStream(msg.sender) {
...
unstreamed += trueDepositAmt;
...
}
As we can see once user stakes the unstreamed variable is increased by user's stake amount
Now lets see the withdraw function. This function does not decrease the unstreamed variable by user withdrawn amount bringing contract variable to instability.
Handle
csanuragjain
Vulnerability details
Impact
Contract variable unstreamed is not updated in withdraw function which can lead to unstability
Proof of Concept
As we can see once user stakes the unstreamed variable is increased by user's stake amount
Now lets see the withdraw function. This function does not decrease the unstreamed variable by user withdrawn amount bringing contract variable to instability.
Recommended Mitigation Steps
Add below statement in withdraw function