Upgrade governance: when one key rewrites the contract
An upgradeable contract (a proxy, a smart-contract wallet, a modular account) holds assets but takes its working logic from a swappable implementation. Upgradeability itself is normal engineering practice: it is how bugs get fixed and features get added. What is dangerous is not the upgrade but its governance: if one key can swap the implementation instantly - with no delay and no second approver - then compromising that single key turns into a hostile upgrade and a full drain in one transaction. This is an advanced, structural vector (a defect on the protocol side), but it bears directly on your own standing approvals - more on that below.
Where the defect is
An upgradeable proxy runs operations through the implementation (via delegatecall or a module
call), and that logic holds full authority over the contract's assets. The vulnerability is not the
delegation itself but who and how triggers the implementation swap. A single admin/owner
key plus no timelock and no guardian means an instant, non-revocable code swap.
This is a structural governance defect, not a code bug and not a UX attack: a hostile upgrade is a formally legitimate call made by a legitimately authorized (but compromised) key. The frame is the same as in the CREATE2 story: what you trust is not the address as such, but who can change the code behind it, and under what conditions.
How the attack goes
- The contract holds the assets and runs operations through its
implementation- which therefore has full authority over the funds. - A privileged key (owner / admin / management) is compromised: a phished seed phrase, a leaked hot key, a malicious or coerced signer.
- The attacker, acting as owner, calls
upgradeTo(hostile)- the upgrade takes effect immediately - and with the next call performs the withdrawal. The new logic ignores the stated intent and sweeps the balance.
There is no delay and no second approval between "I hold the key" and "the code changed" - so one key is enough.
It has already happened
UPCX, April 2025 (we do not pin the exact date: sources differ within early April), about
$70M (18.4M UPC tokens). A privileged management key was compromised; through it the attackers pushed
a malicious ProxyAdmin upgrade and called the built-in withdrawByAdmin function,
draining funds from three management accounts. For precision: here the protocol used a privilege to move
its own assets after swapping the code - this is not "someone's standing approve was betrayed" but a
direct abuse of an admin function. Sources: Halborn, QuillAudits / Cyvers.
PAID Network, March 2021 (a historical case). One key controlled the upgrade; swapping the
implementation introduced mint/burn logic, and the attacker minted 59.47M
PAID tokens. The CertiK audit showed that the reviewed code had no mint/burn functions - so the
defect lay in the upgrade governance and key management, not in the code itself. An honest note on
the numbers: 59.47M (and the "$100-160M" estimates) is the notional amount minted, not the real loss;
the realized damage is estimated at roughly $3M (the attacker managed to sell about 2.5M tokens on
Uniswap before the response). We keep the vector's severity on mechanics and controllability, not on the
notional figure.
Upgradeability is not a defect. The defect is when the right to change the code is held by one key with no delay and no second approver. Then exactly one compromise turns a "legitimate upgrade" into a full drain.
What this has to do with your wallet
In the cases above there was no approve of yours - the protocol drained itself. But the same class of defect bears directly on your standing approvals, and it is worth holding onto as a principle.
When you grant an approve or allowance to a contract, you are trusting the code that sits behind it right now. You approved implementation v1 (benign). Later a hostile upgrade can swap it for v2 that uses your old approve and pulls the funds - with no new signature from you. The mechanism is the same as in approve-drainer: the old allowance is enough once the code behind the address has changed. Hence the one-line takeaway: an approve to an upgradeable contract is safe only as far as its upgrade governance is safe.
How to protect yourself
- Timelock (on the protocol side). An implementation swap does not take effect in the same
transaction:
propose→ delay →apply. An instant swap becomes impossible, and the community gets a window to notice and react. - Guardian / multisig. A separate key can cancel a pending upgrade during the delay window, or a threshold (say, 2-of-N) is required to apply it. One compromised key is then not enough.
- A user check (on Etherscan). Open the contract and the "Read as Proxy" tab: you can see
whether it is a proxy, who the
admin/owner is, and whether a timelock or multisig sits behind upgrades. A large standing allowance to a contract that a single EOA can upgrade instantly is a reason to lower the limit or revoke the approval. - Basic approve hygiene. An exact limit instead of unlimited, and regular revocation of stale approvals, reduce the damage in this scenario too.
Want to practice the skill? In our testnet trainer you learn to read who you grant access to, and not to confuse "the contract exists" with "safe, immutable code sits behind it".