DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Centralized Control of Critical Parameters

Summary

The contracts (PerpetualVault.sol, GmxProxy.sol, KeeperProxy.sol) grant the owner exclusive rights to modify critical parameters, creating centralization risks. Key functions include:

Vulnerability Details

PerpetualVault.sol:

setKeeper(address _keeper): Changes the keeper address.

setTreasury(address _treasury): Sets the fee recipient.

setMinMaxDepositAmount(uint256 _min, uint256 _max): Adjusts deposit limits.

setDepositPaused(bool _paused): Halts deposits/withdrawals.

GmxProxy.sol:

updateGmxAddresses(...): Updates GMX-related contracts.

withdrawEth(): Withdraws all ETH from the contract.

KeeperProxy.sol:

setDataFeed(...): Configures price oracles.

setKeeper(...): Modifies authorized keepers.

Validation of the flaws:

  • Lack of Timelocks: Changes take effect immediately (e.g., setDepositPaused).

  • No Multi-Sig: No requirement for multiple approvals for critical changes.

  • Missing Input Validation Example: setMinMaxDepositAmount does not enforce min < max.

For example: PerpetualVault.sol

// Owner can pause deposits (no timelock)
function setDepositPaused(bool _depositPaused) external onlyOwner {
depositPaused = _depositPaused;
}
// Owner can change the treasury address
function setTreasury(address _treasury) external onlyOwner {
require(_treasury != address(0), "zero address");
treasury = _treasury;
}

For example: GmxProxy.sol

// Owner can withdraw all ETH immediately
function withdrawEth() external onlyOwner returns (uint256) {
uint256 balance = address(this).balance;
payable(msg.sender).transfer(balance);
return balance;
}

Impact

  1. Single Point of Failure: A compromised owner account can:

    Drain funds via withdrawEth().

    Disable deposits (setDepositPaused(true)).

    Redirect fees to a malicious address (setTreasury).

    Manipulate pricing or disable keepers (setDataFeed, setKeeper).

  2. Trust Assumption: Users must trust the owner not to act maliciously, contradicting decentralization principles.

Tools Used

Manual Review

Recommendations

Add Timelocks

Implement a delay for critical changes, allowing users to exit or dispute.

// TimelockExample.sol
modifier onlyTimelock() {
require(msg.sender == timelock, "!timelock");
_;
}
uint256 public constant DELAY = 2 days;
mapping(bytes32 => uint256) public pendingActions;
function scheduleSetTreasury(address _treasury) external onlyOwner {
bytes32 actionId = keccak256(abi.encode(_treasury));
pendingActions[actionId] = block.timestamp + DELAY;
}
function executeSetTreasury(address _treasury) external {
bytes32 actionId = keccak256(abi.encode(_treasury));
require(pendingActions[actionId] <= block.timestamp, "delay not passed");
treasury = _treasury;
delete pendingActions[actionId];
}

Use Multi-Sig Governance

Require multiple signatures for sensitive operations.

// MultiSigExample.sol
address[] public signers;
uint256 public requiredSignatures;
function updateGmxAddresses(...) external {
require(hasApproval(msg.sender), "!approver");
approvals[msg.sender] = true;
if (countApprovals() >= requiredSignatures) {
// Execute update
}
}

Add Input Validation

Ensure parameters are within safe bounds.

// PerpetualVault.sol
function setMinMaxDepositAmount(uint256 _min, uint256 _max) external onlyOwner {
require(_min < _max, "min >= max");
minDepositAmount = _min;
maxDepositAmount = _max;
}
Updates

Lead Judging Commences

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

Admin is trusted / Malicious keepers

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point. Keepers are added by the admin, there is no "malicious keeper" and if there is a problem in those keepers, that's out of scope. ReadMe and known issues states: " * System relies heavily on keeper for executing trades * Single keeper point of failure if not properly distributed * Malicious keeper could potentially front-run or delay transactions * Assume that Keeper will always have enough gas to execute transactions. There is a pay execution fee function, but the assumption should be that there's more than enough gas to cover transaction failures, retries, etc * There are two spot swap functionalies: (1) using GMX swap and (2) using Paraswap. We can assume that any swap failure will be retried until success. " " * Heavy dependency on GMX protocol functioning correctly * Owner can update GMX-related addresses * Changes in GMX protocol could impact system operations * We can assume that the GMX keeper won't misbehave, delay, or go offline. " "Issues related to GMX Keepers being DOS'd or losing functionality would be considered invalid."

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

Admin is trusted / Malicious keepers

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point. Keepers are added by the admin, there is no "malicious keeper" and if there is a problem in those keepers, that's out of scope. ReadMe and known issues states: " * System relies heavily on keeper for executing trades * Single keeper point of failure if not properly distributed * Malicious keeper could potentially front-run or delay transactions * Assume that Keeper will always have enough gas to execute transactions. There is a pay execution fee function, but the assumption should be that there's more than enough gas to cover transaction failures, retries, etc * There are two spot swap functionalies: (1) using GMX swap and (2) using Paraswap. We can assume that any swap failure will be retried until success. " " * Heavy dependency on GMX protocol functioning correctly * Owner can update GMX-related addresses * Changes in GMX protocol could impact system operations * We can assume that the GMX keeper won't misbehave, delay, or go offline. " "Issues related to GMX Keepers being DOS'd or losing functionality would be considered invalid."

Support

FAQs

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