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

getReward incorrectly sets msg.sender as receiver instead of owner. #91

Open
c4-bot-7 opened this issue Oct 11, 2024 · 0 comments
Open
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 🤖_27_group AI based duplicate group recommendation sufficient quality report This report is of sufficient quality

Comments

@c4-bot-7
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2024-10-ramses-exchange/blob/236e9e9e0cf452828ab82620b6c36c1e6c7bb441/contracts/CL/gauge/GaugeV3.sol#L452

Vulnerability details

Proof of Concept

getReward calls _getAllRewards passing in msg.sender as recevier. Since, not only the owner can call the function for a tokenId, the rewards are incorrectly sent to the caller instead of the owner which is a security breach. In cases where the interactions are done through a contract, the rewards might be lost in the contract instead.

    function getReward(uint256 tokenId, address[] memory tokens) public lock {
// ...
        _getAllRewards(
            address(_nfpManager),
            tokenId,
            tickLower,
            tickUpper,
            tokens,
            msg.sender
        );
    }

Recommended Mitigation Steps

Send the rewards to the token owner instead.

        _getAllRewards(
            address(_nfpManager),
            tokenId,
            tickLower,
            tickUpper,
            tokens,
-           msg.sender
+           owner
        );
    }

Assessed type

Context

@c4-bot-7 c4-bot-7 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 11, 2024
c4-bot-2 added a commit that referenced this issue Oct 11, 2024
howlbot-integration bot added a commit that referenced this issue Oct 13, 2024
@howlbot-integration howlbot-integration bot added the sufficient quality report This report is of sufficient quality label Oct 13, 2024
@c4-bot-12 c4-bot-12 added 🤖_27_group AI based duplicate group recommendation and removed 🤖_04_group labels Oct 29, 2024
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 🤖_27_group AI based duplicate group recommendation sufficient quality report This report is of sufficient quality
Projects
None yet
Development

No branches or pull requests

2 participants