No slippage check for liquidators when they burn USG from their account without Swapping first
When a liquidator repays debt using their own USG balance without swapping collateral, the contract burns USG without checking a maximum burn amount, so the liquidator can lose funds if the collateral valuation drops. The minUSGOut slippage check only applies when the zapping proxy is used.
Source: https://github.com/sherlock-audit/2025-08-usg-tangent-judging/issues/178
Found by
3rdeye, BADROBINX, Bigsam, Brene, Pro_King, Tigerfrake, VCeb, X0sauce, tobi0x18
Summary
Loss of funds by the liquidator when they liquidate a position, because of no slippage check during the liquidator's USG balance usage.
Root Cause
function _preLiquidate(address account) internal returns (uint256, uint256, uint256, uint256) {
uint256 newDebtIndex = _checkpointIR();
uint256 userDebtShares_ = userDebtShares[account];
@audit>> return (newDebtIndex, collateralBalances[account], userDebtShares_, _convertToAmount(userDebtShares_, newDebtIndex));
}
function _liquidate(LiquidateInput memory liquidateInput, ZapStruct calldata liquidateCall) internal returns (uint256, uint256, uint256, uint256) {
uint256 collatAmountToLiquidate = liquidateInput.collatToLiquidate;
_verifyCollatInputNotZero(liquidateInput.collatToLiquidate);
uint256 debtSharesToRemove;
uint256 USGToRepay;
// Liquidate all
@audit>> if (collatAmountToLiquidate >= liquidateInput._collateralBalance) {
@audit>> collatAmountToLiquidate = liquidateInput._collateralBalance;
USGToRepay = liquidateInput.userDebt;
debtSharesToRemove = liquidateInput._userDebtShares;
}
// Liquidate partial
else {
@audit>> USGToRepay = (collatAmountToLiquidate * liquidateInput.userDebt) / liquidateInput._collateralBalance;
@audit>> debtSharesToRemove = _convertToShares(USGToRepay, liquidateInput.newDebtIndex);
// Ensure that the remaining debt is bigger than a minimum to leave profitable liquidation
_verifyMinimumDebt(liquidateInput.userDebt - USGToRepay);
}
uint256 newUserDebtShares = liquidateInput._userDebtShares - debtSharesToRemove;
// Modify the collateral balance, the user debt and the total debt
_updateCollatAndDebts(
liquidateInput.account,
liquidateInput._collateralBalance - collatAmountToLiquidate,
liquidateInput._totalCollateral - collatAmountToLiquidate,
newUserDebtShares,
liquidateInput._totalDebtShares - debtSharesToRemove
);
uint256 fee = _mulDiv(USGToRepay, liquidationFee, DENOMINATOR);
_postLiquidate(collatAmountToLiquidate, USGToRepay + fee, liquidateInput.minUSGOut, liquidateCall);
if (fee != 0) {
_mintUSG(usg, controlTower.feeTreasury(), fee);
}
return (collatAmountToLiquidate, USGToRepay, fee, newUserDebtShares);
}
When a liquidator liquidates with an account, they state the amount of collateral to seize and the minimum USG to receive. But this is only enforced when using ZAP ( COLLATERAL to USG).
But Liquidators who liquidate with their balance cannot enforce the maximum USG to be burned from their account for a token valuation.
Collateral worth $990 debt worth $960 plus a fee of 20 Liquidator sets $981 as minUSG
At the point of liquidation execution, call to execution price, the valuation reads Collateral $978 and debt plus fee $980, slippage not enforced with Zap path, this would have failed.
/**
* @dev Internal function called at the end of 'liquidate' and 'selfLiquidate' external function.
* Withdraw the collateral from the underlying protocol
* Transfer the collateral to the caller or to the zapping proxy
* When the collateral is sent to the zapping proxy, the 'liquidationCall' handles the selling of the collateral
* @param collateralAmountToLiquidate Amount of collateral to sell during the liquidation
* @param USGToBurn Amount of USG to burn from the sender
* @param minUSGOut Slippage, Minimum amount of USG to receive after the selling of the collateral
* @param liquidationCall Contains address and bytes of the contract selling the collateral for USG
*/
function _postLiquidate(uint256 collatAmountToLiquidate, uint256 USGToBurn, uint256 minUSGOut, ZapStruct calldata liquidationCall) internal {
IZappingProxy _zappingProxy = zappingProxy;
// Withdraw the collateral from the underlying protocol if needed and
// Transfer it to the caller when there is no liquidator passed in the parameter
// If a liquidator is passed, we send the collateral to the Zapping Proxy that will handle the selling of the collateral.
_transferCollateralWithdraw(liquidationCall.router != address(0) ? address(_zappingProxy) : msg.sender, collatAmountToLiquidate);
// When the liquidator is not zero, it allows the LiquidatorProxy to receive the collateral.
// Then, if needed, the liquidator will allow the custom Liquidator to sell the collateral for USG in the same transaction.
if (liquidationCall.router != address(0)) {
@audit>> _zappingProxy.zapProxy(collatToken, usg, minUSGOut, msg.sender, liquidationCall);
}
// Burns USG from the sender.
// The debt has to be on the caller of the transaction.
// In case a liquidator is passed in parameter, it needs to send it back to the sender of the tx.
@audit>> _burnUSG(msg.sender, USGToBurn);
}
Zapping ensures we check collateral valuation after swapping against minOUT, but when using Msg. Sender, we fail to do the same.e
* @notice Liquidate a position that has a health ratio < 1.
* @dev Two liquidation modes are possible
* - Buy USG with a flashloan, repay the debt, get the collateral and do whatever you want with it.
- Selling the collateral for USG directly through ZappingProxy by providing a route to repay the debt and keeping the difference in USG
* @param account Account of the position to liquidate
* @param collatToLiquidate Amount of collateral to liquidate from the position.
* @param minUSGOut Minimum amount of USG to receive on the sale of the collateral.
* @param liquidationCall Contract and data allowing to sell the collateral for USG.
*/
function liquidate(address account, uint256 collatToLiquidate, uint256 minUSGOut, ZapStruct calldata liquidationCall) external nonReentrant updateRewards(account) {
(uint256 newDebtIndex, uint256 collatBalance, uint256 _userDebtShares, uint256 userDebt_) = _preLiquidate(account);
// Can liquidate only if the health ratio is below 1
require(_healthRatio(userDebt_, collatBalance, true) < 1 ether, NotLiquidablePosition());
(uint256 collatLiquidated, uint256 debtRepaid, uint256 fee, uint256 newUserDebtShares) = _liquidate(
LiquidateInput({
account: account,
collatToLiquidate: collatToLiquidate,
minUSGOut: minUSGOut,
newDebtIndex: newDebtIndex,
_collateralBalance: collatBalance,
_totalCollateral: totalCollateral,
_userDebtShares: _userDebtShares,
_totalDebtShares: totalDebtShares,
userDebt: userDebt_
}),
liquidationCall
);
emit Liquidate(account, debtRepaid, newUserDebtShares, fee, collatLiquidated, liquidationCall.router);
}
Internal Pre-conditions
External Pre-conditions
......
Attack Path
Liquidation lacks protection for the Liquidator when Zap is not used.
Impact
The Liquidator can receive less Collateral in the valuation for their USG token for debt and fees.
PoC
No response
Mitigation
Allow slippage check against the amount the liquidator is willing to burn from their USG for that collateral, ensuring that liquidators can specify the max amount to burn plus the fee for the collateral taken.
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/Tangent-labs/tangent-contracts/pull/117
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the liquidation function only enforces the minUSGOut slippage parameter inside the zapping proxy path, and when no router is provided it burns USG from the caller without any maximum-burn check.
Impact
A liquidator could receive less collateral value than the USG they burn for debt and fees, leading to a loss of funds.
What the attacker needed
Liquidator uses own USG balance; no zapping proxy used; collateral value drops
The fix
The protocol team fixed this issue by allowing a slippage check against the maximum USG the liquidator is willing to burn.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In a lending protocol, a liquidator repays a borrower's debt and receives their collateral at a discount. Here, if the liquidator pays with their own USG tokens instead of swapping the collateral first, the contract does not let them set a limit on how much USG can be taken. If the collateral's value falls, they can end up paying more USG than the collateral is worth.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.