Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Well collateralized loans can be locked forever #9

Closed
c4-bot-2 opened this issue Apr 29, 2024 · 10 comments
Closed

Well collateralized loans can be locked forever #9

c4-bot-2 opened this issue Apr 29, 2024 · 10 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-10 🤖_09_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@c4-bot-2
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2024-04-lavarage/blob/9e8295b542fb71b2ba9b4693e25619585266d19e/libs/smart-contracts/programs/lavarage/src/processor/swap.rs#L12

Vulnerability details

Impact

Borrowed funds might never be returned, and collateral can be stuck inside the position, potentially forever.

This happens when the borrower doesn't repay the loan and if it remains collateralized to the extent that it can never be liquidated, as there aren't any time limits for the loan.

Proof of Concept

Borrowers can borrow well collaterilazed loans that can't be liquidated anytime soon as they have an infinite duration. Lenders cannot extract the collateral (supposing a healthy LTV), no matter how much time passes.

Borrowers might have no incentive to do so, but this scenario can easily happen anyway: for example, borrowers might lose access to their wallets or they might even die.

If this happens, funds are stuck inside the position until the LTV is high enough to liquidate the position (potentially never).

Tools Used

Manual review

Recommended Mitigation Steps

Consider implementing a maximum duration for the loan: if this time passes and the borrower doesn't repay it, the lender should be able to liquidate it.

Assessed type

Timing

@c4-bot-2 c4-bot-2 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Apr 29, 2024
c4-bot-7 added a commit that referenced this issue Apr 29, 2024
@c4-bot-12 c4-bot-12 added the 🤖_09_group AI based duplicate group recommendation label Apr 29, 2024
@c4-judge
Copy link
Contributor

alcueca marked the issue as duplicate of #10

@c4-judge
Copy link
Contributor

c4-judge commented May 1, 2024

alcueca marked the issue as satisfactory

@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label May 1, 2024
@c4-judge
Copy link
Contributor

c4-judge commented May 1, 2024

alcueca changed the severity to 3 (High Risk)

@c4-judge c4-judge added 3 (High Risk) Assets can be stolen/lost/compromised directly upgraded by judge Original issue severity upgraded from QA/Gas by judge and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels May 1, 2024
@DadeKuma
Copy link

DadeKuma commented May 2, 2024

Not a dup. What I'm saying here is that loans have no time limits. Even if #10 is fixed, this won't be fixed for loans with a low interest. Funds can be locked for years, and lenders have no way to extract the collateral. Loans with zero interest can be locked forever. Please re-check.

@Arabadzhiew
Copy link

Arabadzhiew commented May 2, 2024

I agree, this issue is not a dup of #10. However, given that there is no incentive for users to not close their borrow positions for long periods of time, since their loans will always be over-collateralized and they will be accruing more interest fees the more they keep their borrowed SOL, and also that them loosing access to their private key is a very unlikely scenario, I believe that the severity of this issue is borderline Medium/Low.

@alcueca
Copy link

alcueca commented May 3, 2024

The design includes borrowing rates, which is the usual mechanism to ensure that loans are repaid. Refactoring the protocol to include fixed terms seems out of scope to me. I'm accepting this issue as a duplicate of #10 as it rightly points out the issue that loans can stay open forever, even if the remediation suggested is not optimal.

@c4-judge c4-judge added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue and removed 3 (High Risk) Assets can be stolen/lost/compromised directly upgraded by judge Original issue severity upgraded from QA/Gas by judge labels May 10, 2024
@c4-judge
Copy link
Contributor

alcueca changed the severity to 2 (Med Risk)

@c4-judge c4-judge added 3 (High Risk) Assets can be stolen/lost/compromised directly upgraded by judge Original issue severity upgraded from QA/Gas by judge and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue labels May 10, 2024
@c4-judge
Copy link
Contributor

alcueca changed the severity to 3 (High Risk)

@c4-judge c4-judge added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value downgraded by judge Judge downgraded the risk level of this issue and removed 3 (High Risk) Assets can be stolen/lost/compromised directly upgraded by judge Original issue severity upgraded from QA/Gas by judge labels May 10, 2024
@c4-judge
Copy link
Contributor

alcueca changed the severity to 2 (Med Risk)

@thebrittfactor
Copy link

Based on the Appellate Court Decision here, this issue has been upgraded to High severity.

@thebrittfactor thebrittfactor added 3 (High Risk) Assets can be stolen/lost/compromised directly and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working downgraded by judge Judge downgraded the risk level of this issue duplicate-10 🤖_09_group AI based duplicate group recommendation satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

7 participants