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

Admin can set arbitrary Flash Loan Fees #3

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

Admin can set arbitrary Flash Loan Fees #3

code423n4 opened this issue Oct 14, 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-139 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/79f25d48b907f9d0379dd803fc2abc9c5f57db93/src/LBFactory.sol#L474

Vulnerability details

Impact

The factory owner has power to set Flash Loan fees to any arbitrary amount . This can be potentially dangerous for users , especially if they don't check the amount of flash loan fees before calling the LBPair flashLoan function (by calling the factory contract flashLoanFee variable directly to send the fees to the protocol in there callback function logic).

Example:
FlashLoanFee = 500000000000000000

Contract A calls flashLoan function .

Unknowingly Sends 50% of flash loan as fees, as the contract transferred tokens by calling the factory contract directly instead of manually entering the fees to send.
Clearly the User is at a loss.

Proof of Concept

https://github.com/code-423n4/2022-10-traderjoe/blob/79f25d48b907f9d0379dd803fc2abc9c5f57db93/src/LBFactory.sol#L474

Tools Used

VsCode

Recommended Mitigation Steps

I recommend creating a sensible lower and upper limit in case of flash loan fees set by the owner.

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

Shungy commented Oct 24, 2022

I believe this finding to be technically valid but of lower severity.

My reasoning is stated in a similar finding: #472 (comment)

@GalloDaSballo
Copy link
Collaborator

Dup of #138

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

GalloDaSballo marked the issue as not a duplicate

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

GalloDaSballo marked the issue as duplicate of #139

@Simon-Busch Simon-Busch added the satisfactory satisfies C4 submission criteria; eligible for awards label Dec 5, 2022
@Simon-Busch
Copy link
Contributor

Marked this issue as Satisfactory as requested by @GalloDaSballo

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-139 satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

5 participants