Skip to content
DoS Audit finding Intermediate

Auction bid that partially pays back an expired lien will revert

Auction bids that only partially repay an expired lien cause a revert because the lien's last payment timestamp is updated to the current time, which is later than the lien's end time, leading to a subtraction underflow. This prevents partial bids and can cause loss of funds to liquidity providers.

0xRajeev Follow with Prefix and sorrynotsorry

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-10-astaria-judging/issues/179

Found by

0xRajeev, Prefix, sorrynotsorry

Summary

Auction bids will revert for a bid amount that does not fully pay back an expired lien.

Vulnerability Detail

The value of lien.last is updated to block.timestamp in several parts of the code, even for expired liens. Payments made as part of liquidations will set lien.last to block.timestamp > lien.start + lien.duration causing a revert in the flow shown below at step 3 when it is subtracted from end:

  1. IPublicVault(lienOwner).afterPayment(lienId);
  2. slope += LIEN_TOKEN().calculateSlope(lienId);
  3. return (owedAtEnd - lien.amount).mulDivDown(1, end - lien.last);

Impact

Auction bids will revert for a bid amount that does not fully pay back an expired lien. If a lien is only partially paid back, it will reach the if branch in LienToken._payment, which sets lien.last to the current timestamp (which itself is > lien.start + lien.duration, hence the liquidation) and then revert.

This affects the economic efficiency of auctions because it DoS's partial bids and therefore results in loss of funds to LPs.

Code Snippet

  1. https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/LienToken.sol#L444
  2. https://github.com/sherlock-audit/2022-10-astaria/blob/main/src/LienToken.sol#L625

Tool used

Manual Review

Recommendation

Revisit the logic that updates lien.last in the protocol to ensure no reverts in expected flows.

The original report as published on Sherlock, by 0xRajeev. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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 code updates lien.last to the current timestamp even for expired liens, causing a subtraction underflow when calculating the slope because end - lien.last becomes negative.

Impact

Partial auction bids for expired liens revert, causing a denial of service that reduces auction efficiency and may lead to loss of funds for liquidity providers.

What the attacker needed

A lien that has expired; a partial payment attempt

The fix

The logic that updates lien.last should be revisited to ensure no reverts occur in expected flows, likely by not updating it to a timestamp beyond the lien's end or by handling expired liens differently.

How it was found

  1. A lien expires (current time exceeds lien.start + lien.duration).
  2. A partial payment is made as part of a liquidation, which sets lien.last to the current timestamp.
  3. The function calculateSlope is called, which computes (owedAtEnd - lien.amount).mulDivDown(1, end - lien.last).
  4. Because end - lien.last is negative, the subtraction underflows and the transaction reverts.

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 this auction system, a lien is a debt tied to a specific time period. When someone tries to bid an amount that only partly pays off an expired debt, the code tries to calculate a value using the time since the last payment, but because the last payment time is set to now (which is after the debt's end time), the calculation goes wrong and the transaction fails. This means partial payments are blocked, which can hurt the people who lent the money.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0xRajeev

View all

61 more disclosed reports, best first.

More from Astaria

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.