Submitted by KIntern_NA, also found by KupiaSec
The _currentExchangeRate of the Vault contract can not increase and will always be lower than or equal to _assetUnit. Therefore, when the vault is under-collateralized (_currentExchangeRate < _assetUnit), it cant be further collateralized.
The _totalSupplyAmount != 0 && _withdrawableAssets != 0, _currentExchangeRate function will return a value _withdrawableAssets * _assetUnit / _totalSupplyAmount. However, _withdrawableAssets can not exceed _totalSupplyToAssets, which is equal to _totalSupplyAmount * _lastRecordedExchangeRate / _assetUnit. Therefore, _currentExchangeRate will always be lower than or equal to _lastRecordedExchangeRate.
Add this assert line and run forge test; all tests will pass.
Remove the lines of code that limit the _withdrawableAssets:
Context
asselstine (PoolTogether) confirmed and commented:
Picodes (judge) commented:
PierrickGT (PoolTogether) commented:
PierrickGT (PoolTogether) commented:
Picodes (judge) commented:
PoolTogether mitigated:
Status: Mitigation confirmed. Full details in reports from 0xStalin, dirk_y and rvierdiiev.
