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

The fee parameters are all messed up when setting operation #203

Closed
code423n4 opened this issue Oct 21, 2022 · 6 comments
Closed

The fee parameters are all messed up when setting operation #203

code423n4 opened this issue Oct 21, 2022 · 6 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-384 edited-by-warden satisfactory satisfies C4 submission criteria; eligible for awards

Comments

@code423n4
Copy link
Contributor

code423n4 commented Oct 21, 2022

Lines of code

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

Vulnerability details

Impact

The '_setFeesParameters' function of LBPair.sol is not properly implemented, the static and dynamic fee parameters are overlapped due to missing of 114 bits shift for dynamic parameters. It will messes up the parameters and make the LBPair contract unavailable。

Proof of Concept

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

Tools Used

VS Code

Recommended Mitigation Steps

    function _setFeesParameters(bytes32 _packedFeeParameters) internal {
        // ...
        assembly {
            sstore(_feeParameters.slot, or(_newFeeParameters, shl(_OFFSET_VARIABLE_FEE_PARAMETERS, _varParameters)))
        }
    }
@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Oct 21, 2022
code423n4 added a commit that referenced this issue Oct 21, 2022
@trust1995
Copy link

Dup of #425

@GalloDaSballo
Copy link
Collaborator

Definitely would have liked to see a quick coded POC here

@GalloDaSballo
Copy link
Collaborator

Dup of #384

@GalloDaSballo GalloDaSballo added the duplicate This issue or pull request already exists label Oct 26, 2022
@c4-judge c4-judge reopened this Nov 23, 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 23, 2022
@c4-judge
Copy link
Contributor

GalloDaSballo marked the issue as duplicate of #384

@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
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-384 edited-by-warden satisfactory satisfies C4 submission criteria; eligible for awards
Projects
None yet
Development

No branches or pull requests

5 participants