Open c4-submissions opened 1 year ago
raymondfam marked the issue as sufficient quality report
raymondfam marked the issue as primary issue
raymondfam marked the issue as high quality report
I believe this one and https://github.com/code-423n4/2023-09-centrifuge-findings/issues/210 are duplicates.
hieronx (sponsor) confirmed
gzeon-c4 marked the issue as satisfactory
gzeon-c4 marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2023-09-centrifuge/blob/main/src/InvestmentManager.sol#L515 https://github.com/code-423n4/2023-09-centrifuge/blob/main/src/InvestmentManager.sol#L396 https://github.com/code-423n4/2023-09-centrifuge/blob/main/src/InvestmentManager.sol#L591
Vulnerability details
Impact
This is good practice when implementing the EIP-4626 vault standard as it is more secure to favour the vault than its users in that case. This can also lead to issues down the line for other protocol integrating Centrifuge, that may assume that rounding was handled according to EIP-4626 best practices.
Proof of Concept
When calling the
processWithdraw
function, thetrancheTokenAmount
is computed through the_calculateTrancheTokenAmount
function, which rounds DOWN the number of shares required to be burnt to receive thecurrencyAmount
payout/withdrawalAs an additional reason the round UP the amount, the computed amount of shares is also used to
_decreaseRedemptionLimits
, which could potentially lead to a rounded UP remaining redemption limit post withdrawal (note that for the same reason it would we wise to round UP the_currency
amount as well when calling_decreaseRedemptionLimits
).The same function is used in the
previewWithdraw
function, where is should be rounded UP for the same reasons.Tools Used
Visual Studio / Manual Review
Recommended Mitigation Steps
As the we do not always want to round the amount of shares UP in
_calculateTrancheTokenAmount
(e.g. when used inpreviewDeposit
orprocessDeposit
the shares amount is correctly rounded DOWN), the function would actually require an extra argument like below:And be used as
In
previewWithdraw
andprocessWithdraw
And
In
previewDeposit
andprocessDeposit
Assessed type
Math