Pool.getMinTimeBetweenWithdrawalQueues current calculations may not be sufficient
The minimum time between withdrawal queues in the Pool contract is calculated as MaxDuration plus a seven-day buffer, but auction bidding can be extended by a no-action margin, so the buffer may be too short. This could cause pendingQueues to be overwritten before a loan is repaid, leaving the loan unable to find its corresponding queues.
Submitted by bin2chen
getMinTimeBetweenWithdrawalQueues is very important for Pool. If getMinTimeBetweenWithdrawalQueues is too small, pendingQueues will be overwritten too early, and when Loan pays off, it won’t be able to find the corresponding queues.
So we will calculate getMinTimeBetweenWithdrawalQueues by MaxDuration + _LOAN_BUFFER_TIME to make sure it won’t be overwritten too early.
Currently: _LOAN_BUFFER_TIME = 7 days Similarly: LiquidationHandler.MAX_AUCTION_DURATION = 7 days
So getMinTimeBetweenWithdrawalQueues is sufficient if the bidding is done within the time period. However, less consideration is given to the presence of AuctionLoanLiquidator._MIN_NO_ACTION_MARGIN and the bidding can be delayed.
function placeBid(address _nftAddress, uint256 _tokenId, Auction memory _auction, uint256 _bid)
external
nonReentrant
returns (Auction memory)
{
...
uint256 currentTime = block.timestamp;
uint96 expiration = _auction.startTime + _auction.duration;
uint96 withMargin = _auction.lastBidTime + _MIN_NO_ACTION_MARGIN;
@> uint96 max = withMargin > expiration ? withMargin : expiration;
if (max < currentTime && currentHighestBid > 0) {
revert AuctionOverError(max);
}
If the bidding is intense, it may be delayed > _MIN_NO_ACTION_MARGIN =10 minutes, or even longer. So getMinTimeBetweenWithdrawalQueues may not be enough. Suggest adding an extra day: MaxDuration + _LOAN_BUFFER_TIME + 3 days.
Impact
getMinTimeBetweenWithdrawalQueues is not large enough causing pendingQueues to be overwritten prematurely.
Recommended Mitigation
contract Pool is ERC4626, InputChecker, IPool, IPoolWithWithdrawalQueues, LoanManager, ReentrancyGuard {
...
/// @dev Used in case loans might have a liquidation, then the extension is upper bounded by maxDuration + liq time.
- uint256 private constant _LOAN_BUFFER_TIME = 7 days;
+ uint256 private constant _LOAN_BUFFER_TIME = 10 days;
Assessed type
Context
Limit auction extensions.
Status: Unmitigated. Full details in reports from bin2chen, and also included in the Mitigation Review section below.
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 buffer time added to the maximum loan duration does not account for auction extensions allowed by the no-action margin, so the total window can be shorter than the real worst-case settlement time.
Impact
pendingQueues could be overwritten prematurely, so a loan that pays off later may not find its corresponding queues.
What the attacker needed
A loan enters liquidation; auction bidding extends past the buffer
The fix
The report recommends increasing the loan buffer time from seven days to ten days, though the project's mitigation of limiting auction extensions was later marked unmitigated.
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.
A smart contract keeps a list of withdrawal requests, and it assumes a loan will be settled within a certain window before it reuses that list. If a loan auction runs longer than expected, the list can be replaced while the loan still needs it. The report suggests making the safety window longer.
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.