Light ModeLight
Light ModeDark

One Bug Per Day

One H/M every day from top Wardens

Checkmark

Join over 445 wardens!

Checkmark

Receive the email at any hour!

Ad

FixedTermLoanHook looks at block.timestamp instead of expiry

mediumCode4rena

Lines of code

https://github.com/code-423n4/2024-08-wildcat/blob/main/src/access/FixedTermLoanHooks.sol#L848

Vulnerability details

Impact

FixedTermLoanHook looks at block.timestamp instead of expiry

Proof of Concept

The idea of FixedTermLoanHook is to only allow for withdrawals after a certain term end time. However, the problem is that the current implementation does not look at the expiry, but instead at the block.timestamp

solidity
function onQueueWithdrawal( address lender, uint32 /* expiry */, uint /* scaledAmount */, MarketState calldata /* state */, bytes calldata hooksData ) external override { HookedMarket memory market = _hookedMarkets[msg.sender]; if (!market.isHooked) revert NotHookedMarket(); if (market.fixedTermEndTime > block.timestamp) { revert WithdrawBeforeTermEnd(); }

This creates inconsistencies such as forcing users not only to wait until term's end, but also having to wait an extra withdrawalBatchDuration before they're able to withdraw their funds.

Tools Used

Manual review

Recommended Mitigation Steps

Check the expiry instead of block.timestamp

Assessed type

Context