Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

GimelSec - TimeLock.execute lacks payable #387

Closed
sherlock-admin opened this issue Mar 27, 2023 · 7 comments
Closed

GimelSec - TimeLock.execute lacks payable #387

sherlock-admin opened this issue Mar 27, 2023 · 7 comments
Labels
Escalation Resolved This issue's escalations have been approved/rejected Low/Info A valid Low/Informational severity issue Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid

Comments

@sherlock-admin
Copy link
Contributor

GimelSec

high

TimeLock.execute lacks payable

Summary

TimeLock.execute lacks payable. If _value in TimeLock.execute is not zero, it could always revert.

Vulnerability Detail

TimeLock.execute lacks payable. The caller cannot send the value.
https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/TimeLock.sol#L113

    function execute(
        address _target,
        uint256 _value,
        string calldata _func,
        bytes calldata _data,
        uint256 _timestamp
    ) external onlyOwner returns (bytes memory) {
        …

        // call target
        (bool ok, bytes memory res) = _target.call{value: _value}(data);
        …
    }

And the contract is modified from https://solidity-by-example.org/app/time-lock/ . The example code has the payable receive function. But TimeLock doesn’t have one.

Impact

TimeLock.execute cannot work if _value != 0.

Code Snippet

https://github.com/sherlock-audit/2023-03-Y2K/blob/main/Earthquake/src/v2/TimeLock.sol#L113

Tool used

Manual Review

Recommendation

Add payable on TimeLock.execute. Also add a check to ensure msg.value == _value.

    function execute(
        address _target,
        uint256 _value,
        string calldata _func,
        bytes calldata _data,
        uint256 _timestamp
    ) external payable onlyOwner returns (bytes memory) {
        …

        // call target
        (bool ok, bytes memory res) = _target.call{value: _value}(data);
        …
    }
@3xHarry
Copy link

3xHarry commented Apr 5, 2023

valid issue

@3xHarry 3xHarry added the Sponsor Confirmed The sponsor acknowledged this issue is valid label Apr 5, 2023
3xHarry added a commit to Y2K-Finance/Earthquake that referenced this issue Apr 10, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Apr 11, 2023
@Jiaren-tang
Copy link

Escalate for 10 USDC. Valid low. Definitely not medium. there is no admin function that needs msg.value.

@sherlock-admin
Copy link
Contributor Author

Escalate for 10 USDC. Valid low. Definitely not medium. there is no admin function that needs msg.value.

You've created a valid escalation for 10 USDC!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

@sherlock-admin sherlock-admin added the Escalated This issue contains a pending escalation label Apr 11, 2023
@3xHarry
Copy link

3xHarry commented Apr 11, 2023

fix PR: Y2K-Finance/Earthquake#134

@dmitriia
Copy link
Collaborator

dmitriia commented Apr 18, 2023

execute does use native funds.

Update: but it looks like currently there is no onlyTimeLocker function that uses native funds (and there is whitelistController() that not onlyTimeLocker, but can be run by TimeLock, but it doesn't use native funds either), so the issue is best classified as a valid low.

@hrishibhat
Copy link

Escalation accepted

Valid low
Based on the above comments considering this issue as a valid low

@sherlock-admin
Copy link
Contributor Author

Escalation accepted

Valid low
Based on the above comments considering this issue as a valid low

This issue's escalations have been accepted!

Contestants' payouts and scores will be updated according to the changes made on this issue.

@sherlock-admin sherlock-admin added Escalation Resolved This issue's escalations have been approved/rejected and removed Escalated This issue contains a pending escalation labels Apr 25, 2023
@hrishibhat hrishibhat removed Medium A valid Medium severity issue Reward A payout will be made for this issue labels Apr 28, 2023
@sherlock-admin sherlock-admin added Low/Info A valid Low/Informational severity issue Non-Reward This issue will not receive a payout and removed Has Duplicates A valid issue with 1+ other issues describing the same vulnerability labels Apr 28, 2023
3xHarry added a commit to Y2K-Finance/Earthquake that referenced this issue May 10, 2023
3xHarry added a commit to Y2K-Finance/Earthquake that referenced this issue May 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Escalation Resolved This issue's escalations have been approved/rejected Low/Info A valid Low/Informational severity issue Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid
Projects
None yet
Development

No branches or pull requests

5 participants