20,000 USDC
View results
Submission Details
Severity: high

`loans` is array. It 's dangerous

Summary

loans is array. It 's dangerous because of it may cause borrower to repay wrong loan

Vulnerability Details

For example:
Alice have a loan and loan ID is 15,and the loans.length = 16
Bob have a loan and loan ID is 14,and the loans.length = 16

Now Bob repay his loan,and his loans[14] will delete.
So now Alice loan ID will change be 14 rather than 15.

If Alice repay loan[15], it will cause error and revert.
More seriously,if init loans.length = 20, now Alice repaying loan[15] , this is ridiculous,because the loan[15] is another one 's loan.

Impact

It may cause borrower to repay wrong loan

Tools Used

manual

Recommendations

change loans as mapping such like pools

Support

FAQs

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