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

Kow - Lenders can arbitrarily increase borrowers' owed amount forcing default #138

Closed
sherlock-admin opened this issue Aug 28, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Aug 28, 2023

Kow

high

Lenders can arbitrarily increase borrowers' owed amount forcing default

Summary

Since anyone can roll any loan, a lender can craft new loan parameters to arbitrarily increase the borrower's owed amount without providing extra collateral.

Vulnerability Detail

Cooler allows lenders to call provideNewTermsForRoll to set new parameters (with no restrictions) for a loan they own, and also allows anyone to call rollLoan to apply these new parameters on any existing loan. This can be exploited to increase a borrower's loaned amount without providing extra collateral.

Consider the following example for a Cooler with debt token DAI, collateral token gOHM:

  • Alice makes loan request with the following parameters:
    amount_ = 3000e18
    interest_ = 25e15 (2.5% per annum)
    loanToCollateral_ = 3000e18
    duration_ = 73 days (1/5 of 365 days)
    She deposits 1e18 gOHM as collateral
  • Bob clears the request, sending 3000e18 DAI to Alice (Assume that Alice does not repay anything from here on)
  • Bob calls provideNewTermsForRoll on the loan with the following parameters:
    interest = 365e18 (this could be much higher for more severe effect)
    loanToCollateral = 3015e18 (this could be much higher for more severe effect)
    duration = 1 days
  • Bob calls rollLoan on the loan. New terms calculated are:
    newCollateral = 3015e18 * 1e18 / 3015e18 = 1e18 <= loan.collateral so newCollateral = 0 (so Bob does not transfer any extra collateral)
    newDebt = (365e18 * 1 days / 365 days) * 3015e18 / 1e18 = 3015e18
    loan.amount = 3015e18 + 3015e18 = 6030e18
    loan.collateral = 1e18 + 0 = 1e18
    loan.expiry = 73 days + 1 days = 74 days

(For the sake of this example, assume that 1 gOHM is worth 3500 DAI (no precision) and the value of the tokens is constant)
Alice's owed amount has doubled while collateral is unchanged, so if she is to repay the loan she is paying double to get back her collateral. She would lose significantly more by repaying, so is forced to default. After the 74 days is up, Bob claims 1e18 gOHM worth 3250 DAI and loses the 3000 DAI he lent, profiting 250 DAI.

Note that the lender can be selective about what loans they clear and can accordingly craft their parameters to make guaranteed profit.

Impact

Borrower is forced to default to avoid greater loss of funds and lender essentially steals collateral.

Code Snippet

https://github.com/sherlock-audit/2023-08-cooler/blob/6d34cd12a2a15d2c92307d44782d6eae1474ab25/Cooler/src/Cooler.sol#L192-L217
https://github.com/sherlock-audit/2023-08-cooler/blob/6d34cd12a2a15d2c92307d44782d6eae1474ab25/Cooler/src/Cooler.sol#L282-L300

Tool used

Manual Review

Recommendation

Consider validating that the caller of rollLoan is owner().

Duplicate of #26

@github-actions github-actions bot closed this as completed Sep 1, 2023
@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Sep 1, 2023
@sherlock-admin2 sherlock-admin2 changed the title Old Chili Starling - Lenders can arbitrarily increase borrowers' owed amount forcing default Kow - Lenders can arbitrarily increase borrowers' owed amount forcing default Sep 12, 2023
@sherlock-admin2 sherlock-admin2 added the Reward A payout will be made for this issue label Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

2 participants