Skip to content
This repository was archived by the owner on Mar 2, 2025. It is now read-only.

ravikiran.web3 - PointTokenVault::execute() function does not check the status of the delegate call and revert on failure #2

Closed
sherlock-admin3 opened this issue Aug 30, 2024 · 2 comments
Labels
Excluded Excluded by the judge without consulting the protocol or the senior Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed

Comments

@sherlock-admin3
Copy link
Contributor

sherlock-admin3 commented Aug 30, 2024

ravikiran.web3

Medium

PointTokenVault::execute() function does not check the status of the delegate call and revert on failure

Summary

PointTokenVault::execute(...) makes a delegate call and the status of the delegate call is returned to the caller as boolean. It is essentially transferring the responsibility to check the status of the delegate call to the caller itself. This is risk if the caller does not perform the necessary check and executes other logic assuming PointTokenVault::execute(...) ran fine.

It is recommended to revert incase the delegate call was not successful blocking the whole transaction.

Root Cause

In the below code snippet, the status for delegate call is read and passed back to the caller.
The recommendation is to revert in the PointTokenVault::execute(...) if the delegate function fails.

https://github.com/sherlock-audit/2024-07-sense-points-marketplace/blob/main/point-tokenization-vault/contracts/PointTokenVault.sol#L365-L373

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

As PointTokenVault::execute(...) is an external function and hence might not be able to enforce a revert return, it is recommended that the PointTokenVault::execute(...) reverts incase the delegate call fails.

PoC

No response

Mitigation

Revise the execute function as below.

 function execute(address _to, bytes memory _data, uint256 _txGas)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
        returns (bool success)
    {
        assembly {
            success := delegatecall(_txGas, _to, add(_data, 0x20), mload(_data), 0, 0)
        }
        require(success,"Delegate Call Failed");
    }
@sherlock-admin3 sherlock-admin3 added Sponsor Disputed The sponsor disputed this issue's validity Won't Fix The sponsor confirmed this issue will not be fixed labels Aug 30, 2024
@github-actions github-actions bot closed this as completed Sep 1, 2024
@github-actions github-actions bot added the Excluded Excluded by the judge without consulting the protocol or the senior label Sep 1, 2024
@sherlock-admin2 sherlock-admin2 changed the title Petite Taffy Yeti - PointTokenVault::execute() function does not check the status of the delegate call and revert on failure ravikiran.web3 - PointTokenVault::execute() function does not check the status of the delegate call and revert on failure Sep 3, 2024
@sherlock-admin2 sherlock-admin2 added the Non-Reward This issue will not receive a payout label Sep 3, 2024
@sherlock-admin2
Copy link
Contributor

The protocol team fixed this issue in the following PRs/commits:
sense-finance/point-tokenization-vault#42

@sherlock-admin3 sherlock-admin3 added Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed and removed Sponsor Disputed The sponsor disputed this issue's validity Won't Fix The sponsor confirmed this issue will not be fixed labels Sep 4, 2024
@sherlock-admin2
Copy link
Contributor

The Lead Senior Watson signed off on the fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Excluded Excluded by the judge without consulting the protocol or the senior Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed
Projects
None yet
Development

No branches or pull requests

2 participants