DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: low
Invalid

Governance functions should be controlled by time locks in Internalizer.sol

Summary

The Internalizer.sol contract includes governance functions that lack time lock mechanisms. Specifically, the setURI function, which can modify critical parameters, is directly executable by the contract owner without any delay. Implementing time locks on such functions introduces a delay between proposal and execution, giving users time to exit before potentially harmful operations are executed.

Vulnerability Details

Governance functions that allow for significant changes to a contract's behavior or state, such as upgrading contracts or setting critical parameters, should be protected by time locks. A time lock mechanism introduces a delay between when a change is proposed and when it is executed. This delay provides users and stakeholders time to review and react to proposed changes, potentially withdrawing their assets if they disagree with the changes or believe they could be harmful.

In the Internalizer.sol contract, the setURI function can change the URI associated with the contract's tokens. This is a critical function because it affects how the tokens are represented and interacted with externally. Currently, this function is controlled by the onlyOwner modifier, meaning it can be executed immediately by the owner without any delay or oversight.

Code snippet

function setURI(string calldata newuri) public onlyOwner {
_uri = newuri;
}

Impact

Without time locks, governance functions can be executed immediately by the owner, potentially catching users off guard and not giving them adequate time to react. This can lead to:

  • Unexpected Changes: Critical parameters may be modified without user awareness, causing disruptions or loss of trust.

  • Potential Exploits: Immediate changes might be exploited before users can react, especially if the changes introduce vulnerabilities.

  • User Exodus: The lack of a reaction period can cause users to lose confidence and exit the system preemptively.

Tools Used

Manual review

Recommendations

To mitigate this risk, it is recommended to implement a time lock mechanism for governance functions. This will introduce a delay between a proposal and its execution, giving users time to exit or react before the change is applied. Here are the steps to implement a time lock:

  • Introduce a Time Lock Contract:
    Deploy a time lock contract that will hold the governance function calls and execute them after a delay.

  • Modify Governance Functions:
    Update the governance functions to use the time lock contract. For example:

function setURI(string calldata newuri) public onlyOwner {
timelock.schedule(address(this), 0, abi.encodeWithSelector(this._setURI.selector, newuri), bytes32(0), bytes32(0), delay);
}
function _setURI(string calldata newuri) public {
require(msg.sender == address(timelock), "Only timelock can execute");
_uri = newuri;
}
  • Configure the Time Lock:
    Set an appropriate delay period based on the project's requirements and community consensus.

By implementing these changes, the contract will enhance its security and ensure that critical operations are subject to community oversight and sufficient reaction time.

Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational/Gas

Invalid as per docs https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.