Closed howlbot-integration[bot] closed 1 month ago
Duplicate (ish) of https://github.com/code-423n4/2024-08-wildcat-findings/issues/27
The purpose of the check in the constructor is more as a sanity check (since having an end date in the past would make this hooks template useless). If the borrower is updating the date after deployment, setting the end date in the past just means that lenders can immediately withdraw, which would be the desired result in that instance.
Marking as invalid - intended behavior
3docSec marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/main/src/access/FixedTermLoanHooks.sol#L188-L192 https://github.com/code-423n4/2024-08-wildcat/blob/main/src/access/FixedTermLoanHooks.sol#L238-L240
Vulnerability details
Proof of Concept
The
FixedTermLoanHooks.setFixedTermEndTime
function is used to update thefixedTermEndTime
of theHookedMarket
. The input validation of thenewFixedTermEndTime
value before the update is as follows:As it is evident from the above code snippet there is no check to ensure that
newFixedTermEndTime > block.timestamp
. But this is a neccesary check to ensure that the meaningfulfixedTerm
is set in theHookedMarket
and that withdrawals can not beimmediately queued
by the lender before the end of thefixedTermEndTime
. This is evident in the logic how thefixedTermEndTime
is validated in theFixedTermLoanHooks._onCreateMarket
function as shown below:As it is obvious from the above code snippet the
fixedTermEndTime < block.timestamp
check is performed to ensure thatfixedTermEndTime
is not less than the current timestamp.Since the above check is missing in the
FixedTermLoanHooks.setFixedTermEndTime
function anewFixedTermEndTime
could be set which is less than the current timestamp (block.timestamp). As a result thelenders
can immediatelyqueue the withdrawals
which is not the intended behavior of thefixedTerm hook contract
.https://github.com/code-423n4/2024-08-wildcat/blob/main/src/access/FixedTermLoanHooks.sol#L188-L192
https://github.com/code-423n4/2024-08-wildcat/blob/main/src/access/FixedTermLoanHooks.sol#L238-L240
Recommended Mitigation Steps
Hence it is recommended to update the
FixedTermLoanHooks.setFixedTermEndTime
function to include the following check.Assessed type
Invalid Validation