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

Immediate critical Addresses Update by owner in GmxProxy Create Significant Security Risk leading to users funds been at risk

Immediate critical Addresses Update by owner in GmxProxy Create Significant Security Risk leading to users funds been at risk

vulnerability details

The GmxProxy contract allows the owner to instantly update critical GMX integration addresses through the updateGmxAddresses function without any timelock mechanism. This creates significant risk as malicious or compromised owners could redirect user funds by pointing to malicious contract implementations.

Vulnerability Details

In GmxProxy.sol, the updateGmxAddresses function allows immediate changes to GMX integration points:

function updateGmxAddresses(
address _orderHandler,
address _liquidationHandler,
address _adlHandler,
address _gExchangeRouter,
address _gmxRouter,
address _dataStore,
address _orderVault,
address _reader,
address _referralStorage
) external onlyOwner {
orderHandler = _orderHandler;
liquidationHandler = _liquidationHandler;
adlHandler = _adlHandler;
gExchangeRouter = IExchangeRouter(_gExchangeRouter);
gmxRouter = _gmxRouter;
dataStore = IDataStore(_dataStore);
orderVault = _orderVault;
gmxReader = IGmxReader(_reader);
referralStorage = _referralStorage;
}

These addresses control critical protocol functions:

  • Order execution

  • Fund transfers

  • Position management

  • Market data access

If these addresses were updated to point to malicious implementations, the owner could:

  1. Redirect order flows to malicious handlers

  2. Drain funds when users attempt order execution

  3. Manipulate position data

  4. Prevent withdrawals

Impact

If exploited, this could lead to:

  • Complete loss of user funds

  • Manipulation of order execution

  • Subversion of protocol security

This represents a high-severity issue as it breaks security assumptions and introduces central points of failure.

Recommendations

  1. Implement a timelock mechanism for address updates:

mapping(bytes32 => address) public pendingAddressUpdates;
mapping(bytes32 => uint256) public updateTimestamps;
uint256 public constant UPDATE_DELAY = 2 days;
function proposeGmxAddressUpdate(bytes32 addressType, address newAddress) external onlyOwner {
pendingAddressUpdates[addressType] = newAddress;
updateTimestamps[addressType] = block.timestamp + UPDATE_DELAY;
emit GmxAddressUpdateProposed(addressType, newAddress, updateTimestamps[addressType]);
}
function executeGmxAddressUpdate(bytes32 addressType) external onlyOwner {
require(updateTimestamps[addressType] > 0, "Update not proposed");
require(block.timestamp >= updateTimestamps[addressType], "Timelock not expired");
address newAddress = pendingAddressUpdates[addressType];
if (addressType == keccak256("orderHandler")) {
orderHandler = newAddress;
} else if (addressType == keccak256("liquidationHandler")) {
liquidationHandler = newAddress;
}
// Additional address types...
delete pendingAddressUpdates[addressType];
delete updateTimestamps[addressType];
emit GmxAddressUpdated(addressType, newAddress);
}
Updates

Lead Judging Commences

n0kto Lead Judge 9 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.

Give us feedback!