Closed code423n4 closed 10 months ago
Perhaps the warden mis-understood the comment: the unclaimed fee is included in the sense that it is consumed if the vault is under-collateralized. It's not about the value being used in the calculation, but rather that the fee is ignored so that the liquidity is consumed to cover any missing deposits.
asselstine marked the issue as sponsor disputed
Note that "function incorrect as to spec, issues with comments" is of Low severity according to the rules.
Picodes changed the severity to QA (Quality Assurance)
Lines of code
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L1176-L1184 https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L1163-L1164
Vulnerability details
Impact
The
Vault._currentExchangeRate
function, is used to calculate the exchange rate between the amount of assets withdrawable from the YieldVault and the amount of shares minted by this Vault. In the Natspec comment the below function beharviour is explained as follows:The function implementation for the above expected behaviour is depicted below:
The undercollateralization happens when
_withdrawableAssets < _totalSupplyToAssets
. But in this case thecurrent exchange rate
is calculated normally without accounting for theunclaimed yield fee
in the calculation as shown above.Hence the function execution does not follow the expected functionality of the protocol. As a result the calculated
currentExhangeRate
will be errorneous.Proof of Concept
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L1176-L1184
https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L1163-L1164
Tools Used
Manual Review and VSCode
Recommended Mitigation Steps
Hence it is recommended to update the
Vault._currentExchangeRate
function, so that in case of undercollateralization,unclaimed yield fee
will be included in the calculation of theVault._currentExchangeRate
by adding that amount to_withdrawableAssets
amount as mentioned in theNatspec
comments above.Assessed type
Other