58635 sc high cumulativeearmarked is not subtracted in forcerepay
Description
Brief/Intro
Vulnerability Details
function _forceRepay(uint256 accountId, uint256 amount) internal returns (uint256) {
if (amount == 0) {
return 0;
}
_checkForValidAccountId(accountId);
Account storage account = _accounts[accountId];
// Query transmuter and earmark global debt
_earmark();
// Sync current user debt before deciding how much is available to be repaid
_sync(accountId);
uint256 debt;
// Burning yieldTokens will pay off all types of debt
_checkState((debt = account.debt) > 0);
uint256 credit = amount > debt ? debt : amount;
uint256 creditToYield = convertDebtTokensToYield(credit);
_subDebt(accountId, credit);
// Repay debt from earmarked amount of debt first
uint256 earmarkToRemove = credit > account.earmarked ? account.earmarked : credit;
account.earmarked -= earmarkToRemove;
...
Impact Details
References
Proof of Concept
Proof of Concept
Previous56706 sc medium stargateethpoolstrategy incomplete eth wrapping causes withdrawal dosNext57067 sc low overstated per account locked collateral due to global clamp in subdebt
Was this helpful?