-
Notifications
You must be signed in to change notification settings - Fork 22
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
Refinancing in the same pool requires it to have a higher balance than needed because of a flawed check #2108
Comments
I think this would cause it to revert. Will check with sponsor.
|
Moved to LOW since the impact is LOW and likelihood is MEDIUM. To explain to me for later:
The debt is == pool.poolBalance |
I believe the issue should be of medium severity as it demonstrates how protocol functionality and availability for a user get disrupted, which is directly how medium severity issues are explained in the documentation. https://docs.codehawks.com/rewards-and-judging#What-is-a-finding?
|
I think it's still a low, because they can refinance to another pool, or just repay their debt. If my funds are in my wallet, they are A user who wants to refinance isn't really at that much of a risk of their funds being taken. I think you're right though, we should update the docs to be more clear, and talk about the matrix of likelihood vs impact instead of a hard "funds at risk" or "not at risk". If we take a hard line of "funds are at risk" then one could argue anytime someone has to make a transaction that's at least a medium severity vulnerability since they have to pay gas fees. Keeping it as a low. Thank you for your escalation. |
Refinancing in the same pool requires it to have a higher balance than needed because of a flawed check
Severity
Medium Risk
Relevant GitHub Links
https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L616
Summary
Refinancing a loan into the same pool it is in requires the pool to have
the original loan amount +- the difference
because it doesn't check whether the pool already has the original amount as outstanding debt.Vulnerability Details
Lender.sol
'srefinance()
has a check, which makes sure the pool we are refinancing into has enough liquidity to cover the new debt of the loan.The issue arises when the loan is getting refinanced in the same pool it is already in. Then it will require the pool to have the amount of the loan again instead of just the difference between the old debt and the new debt. This makes it harder for a loan to be refinanced in the same pool as the pool may not have enough liquidity to pass this check.
Impact
Some loans will not be able to be properly refinanced.
Tools Used
Manual Review
Recommendations
Consider checking whether the loan's old pool is the new pool as well first and doing additional checks accordingly.
The text was updated successfully, but these errors were encountered: