The calculation of the redeemPercent
in the KittyPool::purrgeBadPawsition
function is incorrect, leading to an inaccurate percentage that can cause significant financial discrepancies when purging a user's bad debt.
In the KittyPool::purrgeBadPawsition
function, the redeemPercent
is intended to represent the proportion of the user's collateral that should be redeemed based on their total debt. However, the calculation incorrectly multiplies the debt by a precision constant (PRECISION
) before dividing by the user's collateral in euros. This results in an incorrect and excessively large percentage value.
The problematic code is as follows:
POC
Add the following to KittyFiTest.t.sol
test file:
Incorrect Debt Repayment: The incorrect redeemPercent
could lead to over-redeeming the user's collateral, resulting in substantial financial discrepancies.
Potential Exploitation: An attacker could potentially exploit this flaw to manipulate the system and extract more value than they are entitled to.
Manual review
Foundry (Testing Framework)
Correct the Calculation: Modify the calculation to correctly compute the redeemPercent
without unintentionally inflating the value
Add Validation Checks: Implement additional checks to ensure that the redeemPercent
falls within a reasonable range.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.