The Lender::giveLoan()
can be used by a rogue lender to force a borrower to pay a huge debt to repay their loan. Otherwise, their loan's collateral tokens will be seized.
Even if allowing a lender to give a loan to another pool (via the giveLoan()
) is a feature, a rogue lender can execute the giveLoan()
to force the loan's principal debt to compound with the loan's interests (lenderInterest
+ protocolInterest
).
After executing the giveLoan()
, the loan's debt will become bigger. Specifically, the old debt will be compounded with the loan's interests to become the new bigger debt.
Old debt will be compounded with the loan's interests
: https://github.com/Cyfrin/2023-07-beedle/blob/658e046bda8b010a5b82d2d85e824f3823602d27/src/Lender.sol#L381
New bigger debt
: https://github.com/Cyfrin/2023-07-beedle/blob/658e046bda8b010a5b82d2d85e824f3823602d27/src/Lender.sol#L420
Let's do a simple math for demonstration. Assume that:
Debt
: $5
InterestRate
: 0.1 (10%) per second
BorrowingLength
: 10 seconds
Scenario 1: a borrower borrows the debt for 10 seconds and repays their loan
Scenario 2: a borrower borrows the debt for 10 seconds and repays their loan but at the 5th second, a lender executes the giveLoan()
As you can see, a borrower must pay more debt to repay their loan. Imagine the case that an attacker (rogue lender) executes the giveLoan()
multiple times; the borrower will be forced to pay a huge debt to repay their loan. Otherwise, their loan's collateral tokens will be seized.
An attacker (rogue lender) can execute the giveLoan()
multiple times through the same pool or other Sybil pools (the pools generated by different lender addresses, but the same attacker controls them).
As a result, a borrower will be forced to pay a huge debt to repay their loan. Otherwise, their loan's collateral tokens will be seized. Hence, this issue is considered high severity.
Manual Review
Since an attacker (rogue lender) can exploit the issue through their controllable Sybil pools, we cannot address the issue by disallowing a lender to execute the giveLoan()
on the same pool.
Thus, a borrower should have choices for mitigating the issue when borrowing a loan.
Two example choices:
A borrower can disallow giving their loan to another pool via the giveLoan()
. In this case, a lender could execute the startAuction()
only.
A borrower can allow giving their loan to another pool via the giveLoan()
. In this case, a borrower should be able to limit the maximum times the giveLoan()
can execute on their loan.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.