Due to lack of the validation to check whether or not the loan (loanId) was not already bought by a buyer via the Lender#buyLoan(), the transaction of the Lender#seizeLoan() would be reverted in the for-loop if the loan (loanId), which is already bought by a buyer via the Lender#buyLoan().
A lender sieze a loan via the the Lender#seizeLoan() after a failed refinance auction.
Within the Lender#seizeLoan(), the operation would be executed for each loanId in the for-loop like this:
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L548-L586
A lender sieze a loan via the the Lender#seizeLoan() when there was no buyer who bought via the Lender#buyLoan() during the refinance auction and the refinance auction was finished.
So, it is supposed to be checked both below:
whether or not the loan (loanId) was not already bought by a buyer via the Lender#buyLoan()
whether or not the refinance auction was already finished
However, within the Lender#seizeLoan(), there is no validation to check whether or not the loan (loanId) was not already bought by a buyer via the Lender#buyLoan().
This lead to a bad situation that the transaction of the Lender#seizeLoan() would be reverted in the for-loop if the loan (loanId), which is already bought by a buyer via the Lender#buyLoan(). Because this loan (loanId), which is already bought, would be reverted at the line of condition (Lender.sol#L554-L559).
This vulnerability lead to a bad situation that the transaction of the Lender#seizeLoan() would be reverted in the for-loop if the loan (loanId), which is already bought by a buyer via the Lender#buyLoan(). Because this loan (loanId), which is already bought, would be reverted at the line of condition (Lender.sol#L554-L559).
Foundry
Within the Lender#seizeLoan(), consider adding a validation to check whether or not each loan (loanId) in the for-loop was already bought via the Lender#buyLoan()
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.