58768 sc high mytsharesdeposited is not updated during liquidations breaking core accounting
Description
Brief/Intro
Vulnerability Details
function _forceRepay(uint256 accountId, uint256 amount) internal returns (uint256) {
// ...
if (account.collateralBalance > protocolFeeTotal) {
account.collateralBalance -= protocolFeeTotal;
// Transfer the protocol fee to the protocol fee receiver
TokenUtils.safeTransfer(myt, protocolFeeReceiver, protocolFeeTotal); // myt transferred out
}
if (creditToYield > 0) {
// Transfer the repaid tokens from the account to the transmuter.
TokenUtils.safeTransfer(myt, address(transmuter), creditToYield); // myt transferredout
// @audit: `_mytSharesDeposited` is not decremented for MYT transferred out
}
return creditToYield;
}Root cause
Impact Details
References
Proof of Concept
Proof of Concept
Previous56561 sc insight fee amount is recomputed multiple times when the initial value has already been cachedNext58751 sc medium setminimumcollateralization allows for increasing the current minimumcollateralization instantly exposing users to risk of liquidation
Was this helpful?