58354 sc high forcerepay does not decrement mytsharesdeposited causing a temporal blocking of new deposits
Description
Brief/Intro
Vulnerability Details
function _forceRepay(uint256 accountId, uint256 amount) internal returns (uint256) {
...
// Repay debt from earmarked amount of debt first
uint256 earmarkToRemove = credit > account.earmarked ? account.earmarked : credit;
account.earmarked -= earmarkToRemove;
creditToYield = creditToYield > account.collateralBalance ? account.collateralBalance : creditToYield;
@> account.collateralBalance -= creditToYield;
uint256 protocolFeeTotal = creditToYield * protocolFee / BPS;
emit ForceRepay(accountId, amount, creditToYield, protocolFeeTotal);
if (account.collateralBalance > protocolFeeTotal) {
account.collateralBalance -= protocolFeeTotal;
// Transfer the protocol fee to the protocol fee receiver
TokenUtils.safeTransfer(myt, protocolFeeReceiver, protocolFeeTotal);
}
if (creditToYield > 0) {
// Transfer the repaid tokens from the account to the transmuter.
TokenUtils.safeTransfer(myt, address(transmuter), creditToYield);
}
@> //@audit-missing _mytSharesDeposited -= creditToYield
return creditToYield;
}Impact Details
References
Proof of Concept
Proof of Concept
Previous58408 sc low underflow account rawlocked on subdebt due to rounding inconsistencyNext58320 sc critical incorrect fee return value in resolverepaymentfee enables fund theft under extreme conditions
Was this helpful?