Proxy Upgrade Attack

🧬 PROXY UPGRADE ATTACK

📌 Definition

A Proxy Upgrade Attack is a type of fraud in upgradeable smart contracts. It occurs when the admin modifies the logic behind a proxy contract for malicious purposes.

Modern DeFi projects use upgradeable patterns like UUPS, Transparent Proxy, or Beacon Proxy to allow contract updates. However, if upgrade control is held by a single wallet, this becomes a centralized security risk.

đź”§ How It Works

Three-Stage Proxy Upgrade Scam:

  1. Deploy: The project launches with a clean and investor-friendly implementation. Users interact through a proxy that forwards all calls.

  2. Attract Investors: As the project grows, total value locked (TVL) increases. Users gain trust.

  3. Upgrade (Attack): The admin calls the upgrade function and assigns a new malicious implementation contract. This new code might:

    • Transfer all funds

    • Move user tokens

    • Change contract ownership

    • Redirect the proxy to attacker-controlled logic

From the user’s perspective, the contract address remains the same. Behind the scenes, however, the behavior in the contract codes is now completely controlled by the attacker.

đź“‹Smart Contract Components Used

Component / Function
Description

upgradeTo(address newImplementation)

Changes the contract logic the proxy points to.

onlyOwner or onlyProxyAdmin

Upgrade functions are usually protected but may be controlled by a single admin.

delegatecall

Proxy uses delegatecall to execute the logic of the current implementation, preserving state data.

beacon system

In Beacon Proxy setups, the attacker can change the beacon to redirect to malicious logic.

⚠️ Risks

  • Funds can be drained without warning

  • Existing audits become invalid once logic changes

  • Users unknowingly interact with new, malicious behavior

🛡️ Ways to Protect Yourself

Protection Strategy
Description

Multisig Admin Control

Ensure the upgradeTo() function is only executable by a multi-signature wallet.

Timelock + Upgrade Delay

Require a time delay between upgrade proposal and execution, giving users time to react.

Upgrade Event Logging

All upgrades should emit on-chain events for transparency and traceability.

Verify Proxy + Implementation Code

Both proxy and implementation contracts should be verified on Etherscan or equivalent platforms.

Use OpenZeppelin Defender

A security tool like OpenZeppelin Defender can manage and monitor upgrade permissions safely.

Last updated

Was this helpful?