Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Invalid

[H-1] Centralized Upgrade Control Allows Total Protocol Takeover (Access Control + Fund Drain)

Summary

The ZlpVault contract inherits upgradeability via OpenZeppelin’s UUPSUpgradeable pattern but grants exclusive upgrade rights to the contract owner. This centralization introduces a single point of failure, enabling malicious logic replacement that could drain funds, disable withdrawals, or manipulate LP rewards.

Vulnerability Details

Affected Code:

function _authorizeUpgrade(address) internal override onlyOwner { }

The UUPS upgrade pattern is implemented with critical flaws:

  1. Single-Point Failure: onlyOwner modifier grants unilateral upgrade rights

  2. No Timelock: Immediate execution of upgrades

  3. No Governance Oversight: Complete owner discretion

Exploit Scenario:

  1. Attacker compromises owner's private key (phishing/social engineering)

  2. Deploys malicious implementation contract with selfdestruct or transferAll logic

  3. Calls upgradeToAndCall() with malicious contract address

  4. Drains all vault assets in one transaction

Proof of Concept:

// Malicious Implementation
contract AttackVault is ZlpVault {
function drainFunds(address attacker) external {
IERC20(asset()).transfer(attacker, totalAssets());
}
}
// Attack Script
vm.startPrank(compromisedOwner);
zlpVault.upgradeTo(address(new AttackVault()));
AttackVault(address(zlpVault)).drainFunds(attacker);

Impact

High Impact: All LP funds can be stolen (~$X million TVL at risk)

High Likelihood: Single-owner compromise is common attack vector

Critical Risk: Permanent protocol shutdown possible via selfdestruct

Tools Used

Manual Review, Slither, Foundry

Recommendations

  1. Implement TimelockController for upgrade delays:

// Use OZ Timelock
function _authorizeUpgrade(address) internal override onlyTimelock { }
  1. Transition to DAO governance using OpenZeppelin Governor

  2. Remove onlyOwner pattern entirely

Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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