-
Notifications
You must be signed in to change notification settings - Fork 2
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
Small loans will never be liquidated, generating bad debt for lenders #11
Comments
piske-alex (sponsor) confirmed |
alcueca marked the issue as satisfactory |
alcueca changed the severity to 2 (Med Risk) |
alcueca marked the issue as primary issue |
alcueca marked the issue as selected for report |
Can I get an explanation about why this was downgraded? Note that this is not about the borrowing fees not being paid like the QA report that was duped. This issue has the same impact as #10, but a different mitigation: borrowers are able to steal the borrowed funds and they will never repay these loans (liquidating these loans would be a loss for the lender as the TX cost will be higher than the loaned amount), please re-check. |
Sorry, but I don't understand how this exploit is supposed to work. Can't a bunch of liquidation instructions be executed in one transaction just like with the borrow instructions? Also, based on the fact that with the current state of protocol the borrowers will have to deposit a rent exemption amount of SOL into each of their borrow position PDAs, this will make the exploit non-profitable for them to perform (see #14 for more information about that, but the TL;DR is that this issue will actually act as a protection against that one). Therefore, based on those two things, I actually believe that this issue should be downgraded to QA, as there is currently no financial incentive to perform it. |
No, because the oracle needs to sign the
This is false, since Anchor 0.24.x there's no need to send the rent exemption amount, and the protocol is using Anchor 0.29.0, you can find more info here; so #14 is inaccurate |
So you mean to tell me that the oracle can't sign more than one instruction? This sounds like a pretty strong external assumption to me.
That is not true. Rent is a core concept of the Solana blockchain and creating an account without paying rent for it will lead to it being instantly closed. You can read more about it in this resource from the Solana docs. The comment from Stackexchange that you have linked to seems to be referring to a |
While i am new to Solana, but during the audit i have read docs that all new accounts now should be rent for 2 years. Paying by epochs will work only for older accounts. Also think this will be expensive to pay for each data account. |
I'm not entirely sure about this as I'm new to Solana, but I think it depends on which Solana version is used to compile the program. The latest Solana version enforces rent-exempt accounts, but older versions permit users to pay rent every epoch; Anchor has the |
As in Ethereum we have nodes, which are Ethereum clients(geth for example) in same way in Solana they have smth similar. And in the docs we see that now their execution clients are updated, so they will not allow tx to create data accounts that are not rent exempt. |
I see, thank you for your explanation, TIL. If this is the case, the attack is not economically profitable. |
The attack is not economically profitable. If it were, this would be a critical. However, it can be used as a means of hurting the lenders, and the protocol as a whole, at a cost. As a griefing attack, it is a Medium. |
@alcueca What i don't understand how it can be medium if no one will do that? What do you mean griefing here? |
like making the lender lose money without profiting him/herself financially |
As the sponsor said, malicious users (or rival protocols) would be willing to spend money to hurt the protocol. |
Lines of code
https://github.com/code-423n4/2024-04-lavarage/blob/9e8295b542fb71b2ba9b4693e25619585266d19e/libs/smart-contracts/programs/lavarage/src/processor/swap.rs#L12
https://github.com/code-423n4/2024-04-lavarage/blob/9e8295b542fb71b2ba9b4693e25619585266d19e/libs/smart-contracts/programs/lavarage/src/processor/liquidate.rs#L19
Vulnerability details
Impact
There isn't a minimum position requirement for borrowers when they start a loan.
Malicious borrowers might abuse this to create a large amount of small loans that will be unprofitable to liquidate. This results in a total loss of funds for lenders as they will get only bad debt.
Proof of Concept
borrow - add_collateral - borrow - ...
with different positions on the same pool). They get the same amount of funds as they would have got with a single big loan AND they pay just for a single transaction.Tools Used
Manual review
Recommended Mitigation Steps
Consider implementing a minimum amount to start a loan.
Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: