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

Flashloan fees are distributed unfairly #126

Closed
code423n4 opened this issue Oct 18, 2022 · 5 comments
Closed

Flashloan fees are distributed unfairly #126

code423n4 opened this issue Oct 18, 2022 · 5 comments
Labels
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 duplicate-136 satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-10-traderjoe/blob/main/src/LBPair.sol#L420-L456

Vulnerability details

Impact

Flash loan fees are distributed only to the participants of active bin(and protocol). This is unfair. Liquidity providers do not earn when they liquidity is used by flashloan.

Proof of Concept

In LBPair.flashLoan function fees for the loan are distributed only to the pair's active bin. Only liquidity providers of this bin are paid for using their liquidity.

When flash loaner takes a huge loan he uses the liquidity not only of active bin, but some other bins as well. All providers of this liquidity should be compensated.

I understand why this is done. Because if they will calculate all bins that should participate in fees distribution it will take more gas and flash loans will be expensive. However, i just want to point to the fact that such distribution is not correct.

Tools Used

VsCode

Recommended Mitigation Steps

Think about another flash loan fee distribution mechanism. Or distribute such fees only to protocol when the flashloan amount is more then active bin reserves.

@code423n4 code423n4 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 Oct 18, 2022
code423n4 added a commit that referenced this issue Oct 18, 2022
@Shungy
Copy link

Shungy commented Oct 23, 2022

I believe this finding to be valid.

However, I think this report is of informational severity. Because the report have not identified an attack vector unlike the other reports mentioning the potential of value leak out of the protocol by way of stealing fees. Such as my report: #136.

Disclaimer: Reduction of severity of this report would benefit me.

@GalloDaSballo
Copy link
Collaborator

Dup of #136

@GalloDaSballo GalloDaSballo added the duplicate This issue or pull request already exists label Oct 26, 2022
@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as satisfactory

@c4-judge c4-judge reopened this Nov 13, 2022
@c4-judge c4-judge added the satisfactory satisfies C4 submission criteria; eligible for awards label Nov 13, 2022
@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as not a duplicate

@c4-judge c4-judge removed the duplicate This issue or pull request already exists label Nov 16, 2022
@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as duplicate of #136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 duplicate-136 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

4 participants