Any number of 0 amount loans can be created on the proposal that is fully filled and not expired
Summary
The missing check in loan creation flow enables user to create 0 amount loans on any proposal that is fulfilled 100% but is still valid. These 0 amount loans can be repay(), call(),auction() & seize() without any cost. As the interested acquired on them is also 0.
Root Cause
In method _assertFulfillAmountNotTooLow() if the proposal is 100% filled the loanAmount = fulfilledAmount. So the checkfulfillAmount != loanAmount - fulfilledAmount will be false for fulfillAmount = 0.
function _assertFulfillAmountNotTooLow(
uint256 fulfillAmount,
uint256 fulfilledAmount,
uint256 loanAmount
) private pure {
if (fulfillAmount != loanAmount - fulfilledAmount) {
if (fulfillAmount < loanAmount / 10) {
revert FulfillAmountTooLow();
}
}
}
phoenixv110
Medium
Any number of 0 amount loans can be created on the proposal that is fully filled and not expired
Summary
The missing check in loan creation flow enables user to create 0 amount loans on any proposal that is fulfilled 100% but is still valid. These 0 amount loans can be
repay()
,call()
,auction()
&seize()
without any cost. As the interested acquired on them is also 0.Root Cause
In method
_assertFulfillAmountNotTooLow()
if the proposal is 100% filled theloanAmount = fulfilledAmount
. So the checkfulfillAmount != loanAmount - fulfilledAmount
will be false forfulfillAmount = 0
.https://github.com/sherlock-audit/2024-09-predict-fun/blob/main/predict-dot-loan/contracts/PredictDotLoan.sol#L1269C1-L1279C6
Internal pre-conditions
External pre-conditions
No response
Attack Path
No response
Impact
On Blast the gas fee is very low. Which can lead to user creating any number of such 0 amount loans with minimal cost.
PoC
Add the following test in
PredictDotLoan.acceptBorrowRequest.t.sol
Mitigation
Add a
fulfillAmount = 0
amount check in_assertFulfillAmountNotTooLow()
check will fix the issue.