Skip to content
This repository was archived by the owner on Mar 3, 2024. It is now read-only.
This repository was archived by the owner on Mar 3, 2024. It is now read-only.

0xbepresent - Lender can block loan repayments using malicious Callback contract causing the collateral lost #97

Description

@sherlock-admin2

0xbepresent

high

Lender can block loan repayments using malicious Callback contract causing the collateral lost

Summary

The lender can block the loan repayment using malicious Callback contract causing the borrower to lost the collateral.

Vulnerability Detail

The Cooler::repayLoan() function helps to repay the loan and get the collateral back. Additionally, when a loan request is accepted the lender can implement a CollateralCallback contract.

The problem is that when there is a repayment using the repayLoan() function, the function will call the lender callback (code line 185).

File: Cooler.sol
151:     function repayLoan(uint256 loanID_, uint256 repaid_) external returns (uint256) {
...
183: 
184:         // If necessary, trigger lender callback.
185:         if (loan.callback) CoolerCallback(loan.lender).onRepay(loanID_, repaid_);
...

Malicious lender can implement a malicious CoolerCallback::onRepay() function which consumes all the gas forwarded to it exhausting all the available gas causing to be unable to repay the loan.

Impact

The borrower will lost the collateral.

Code Snippet

Tool used

Manual review

Recommendation

Implements a fixed gas consumption to the lender's CoolerCallback contract.

Duplicate of #187

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions