20,000 USDC
View results
Submission Details
Severity: high

External transfer Calls Inside Loops

Summary

Some methods make external calls within loops, which makes them vulnerable against DOS attacks. These lines are:

Lender.repay(uint256[]) (src/Lender.sol#292-345) has external calls inside a loop: IERC20(loan.collateralToken).transfer(loan.borrower,loan.collateral) (src/Lender.sol#329-332)
Lender.seizeLoan(uint256[]) (src/Lender.sol#548-586) has external calls inside a loop: IERC20(loan.collateralToken).transfer(loan.lender,loan.collateral - govFee) (src/Lender.sol#565-568)

Vulnerability Detail

Methods repay and seizeLoan in Lender.sol make external calls inside loops. If one of the called contracts has a fallback function that reverts, it can cause the entire operation to fail.

Impact

Increased vulnerability to malicious contracts and potential deadlock.

Tools Used

Slither

Recommendation:

Use pull strategy. Instead of directly sending funds, the contract simply records the amount of collateral each user is allowed to withdraw. Then, each user is responsible for initiating a transaction to pull or withdraw their collaterals.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.