_buyoutLien() does not properly validate the liquidationInitialAsk
The _buyoutLien function validates the liquidationInitialAsk against the old lien stack instead of the new stack after replacement, allowing a buyer to set an insufficient liquidationInitialAsk. This could result in bids that do not cover the debt.
Submitted by bin2chen, also found by chaduke
Illegal liquidationInitialAsk, resulting in insufficient bids to cover the debt.
Proof of Concept
_buyoutLien() will validate against liquidationInitialAsk, but incorrectly uses the old stack for validation
function _buyoutLien(
LienStorage storage s,
ILienToken.LienActionBuyout calldata params
) internal returns (Stack[] memory newStack, Stack memory newLien) {
....
uint256 potentialDebt = 0;
for (uint256 i = params.encumber.stack.length; i > 0; ) {
uint256 j = i - 1;
// should not be able to purchase lien if any lien in the stack is expired (and will be liquidated)
if (block.timestamp >= params.encumber.stack[j].point.end) {
revert InvalidState(InvalidStates.EXPIRED_LIEN);
}
potentialDebt += _getOwed(
params.encumber.stack[j],
params.encumber.stack[j].point.end
);
if (
potentialDebt >
params.encumber.stack[j].lien.details.liquidationInitialAsk //1.****@audit use old stack
) {
revert InvalidState(InvalidStates.INITIAL_ASK_EXCEEDED);
}
unchecked {
--i;
}
}
....
newStack = _replaceStackAtPositionWithNewLien(
s,
params.encumber.stack,
params.position,
newLien,
params.encumber.stack[params.position].point.lienId //2.****@audit replace newStack
);
Recommended Mitigation Steps
Replace then verify, using the newStack[] for verification.
SantiagoGregory (Astaria) confirmed
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 validation loop uses the old stack (params.encumber.stack) instead of the newly created stack after replacing the lien.
Impact
A buyer could set an insufficient liquidationInitialAsk, leading to bids that do not cover the debt.
What the attacker needed
A lien to buy out
The fix
The validation should be performed after replacing the lien, using the new stack.
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.
When a loan is bought out, the new loan's starting price (liquidationInitialAsk) must be high enough to cover the debt. The code checks this price against the old loan details instead of the new ones, so a buyer can set a price that is too low. This means if the loan later needs to be liquidated, the sale might not raise enough to repay the debt.
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.