DOS while dealing with erc20 when value(i.e amount*decimals) is high but less than type(uint112).max #228
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
hack3r-0m
Vulnerability details
Impact
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L229
reverts due to overflow for higher values (but strictly less than type(uint112).max) and hence when user calls
exit
orwithdraw
function it will revert and that user will not able to withdraw funds permanentaly.Proof of Concept
Attaching diff to modify tests to reproduce behaviour:
Tools Used
Manual Review
Recommended Mitigation Steps
Consider doing arithmetic operations in two steps or upcasting to u256 and then downcasting. Alternatively, find a threshold where it breaks and add require condition to not allow total stake per user greater than threshhold.
The text was updated successfully, but these errors were encountered: