sherlock-audit / 2023-10-aloe-judging

9 stars 6 forks source link

0x007 - Issues would arise as lastBalance or totalSupply hit 2**112 #116

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

0x007

medium

Issues would arise as lastBalance or totalSupply hit 2**112

Summary

There's no cap on total supply or total assets and this would cause a lot of issues when they hit 2**112 which is the max storage allocated for them.

Vulnerability Detail

totalSupply and lastBalance are safe cast to uint112 before storing.

It is possible to reach a total supply or lastBalance that's close to or equal to uint112.max during a deposit. And then at a later time, exceed the max because of interest accrual. This could put the contract in a stalemate because of reverts in _save. This scenario is more likely with tokens of high decimals such as 27 because 1e27 is less than 5.2 millions away from uint112.max.

Impact

Lender could be in stalemate when totalSupply exceeds 2**112 because of interest accrual.

Code Snippet

https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Ledger.sol#L359-L365 https://github.com/sherlock-audit/2023-10-aloe/blob/main/aloe-ii/core/src/Lender.sol#L556-L557

Tool used

Manual Review

Recommendation

uint112 is a small amount and there are multiple recommendations

sherlock-admin2 commented 1 year ago

3 comment(s) were left on this issue during the judging contest.

panprog commented:

invalid, because pools/tokens that can overflow are not supported

tsvetanovv commented:

Information

MohammedRizwan commented:

valid