upgradeable-proxy
What it does
This playbook covers the usual weaknesses in upgradeable contract designs. It is for auditors and developers who use proxy patterns.
When to use it
- βWhen a contract is deployed behind a proxy and can be upgraded by an admin.
- βWhen an implementation contract might be initialized by someone other than the proxy.
- βWhen you need to check the storage layout after an upgrade.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/contracts/upgradeable-proxy/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βWe use an upgradeable proxy for our token contract. Can you check the setup and upgrade permissions?β
5 new skills a week. 1 minute to read.
How it works
The agent checks whether implementations are locked against direct setup, whether storage slots could clash, and who can authorize upgrades.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Upgradeable Proxy Playbook
Proxies separate storage (proxy) from logic (implementation). The
proxy delegatecalls into the implementation, executing logic in the
proxy's storage context. Three common patterns:
- Transparent Proxy (OZ TransparentUpgradeableProxy)
- UUPS (OZ UUPSUpgradeable, OZ 4.1+)
- Diamond / EIP-2535 (multi-facet, much more complex)
Each has distinct bug classes.
Audit checklist
1. Uninitialized implementation
Implementations should be initialized at deployment to prevent third-party initialization:
// Vulnerable β anyone can call initialize() on the implementation
// directly (not via proxy) and become its owner
contract VulnImpl {
function initialize(address owner_) external {
owner = owner_;
}
}
// Safe β disable initializers on impl deployment
contract SafeImpl is Initializable {
constructor() { _disableInitializers(); }
function initialize(address owner_) external initializer {
owner = owner_;
}
}
Attack: attacker calls initialize on the impl contract β becomes
"owner" of the impl. While this doesn't immediately drain the proxy,
it CAN matter if _authorizeUpgrade reads impl-side state, or if
selfdestruct is exposed and impl auth is on owner. Past incident:
Parity multisig 2017 β $280M frozen.
# Find unprotected impl
grep -rn 'initialize\|_disableInitializers' src/
2. Storage slot collisions
Proxy and impl share storage. New impl versions must lay storage identical to old:
// V1
contract LogicV1 {
address public owner; // slot 0
uint256 public total; // slot 1
}
// V2 β BUG: inserted new var at top
contract LogicV2 {
uint256 public newVar; // slot 0 β overwrites owner!
address public owner; // slot 1
uint256 public total; // slot 2
}
After upgrade, owner is read from where total was; arbitrary value.
Check:
- New vars only appended at the end
- Inheritance order unchanged
- OZ
__gapreserved slots used in upgradeable libs
# OZ provides a tool
slither-check-upgradeability V1.sol V2.sol --proxy-name MyProxy
3. Function selector collisions (Transparent Proxy specifically)
Transparent proxy: if caller is admin β proxy admin functions; else β delegatecall to impl. If impl has function with selector matching a proxy admin selector β admin sees impl, user sees impl, admin can never call admin functions. Or worse, ABI-trickery.
Common collisions:
upgradeTo(address): selector0x3659cfe6β what if impl defines atransferOwnership(address)that hashes to the same selector?
Slither auto-detects:
slither --print human-summary src/ | grep -i selector
4. _authorizeUpgrade empty / wrong
UUPS pattern: implementation contains the upgrade authorization. Default
OZ _authorizeUpgrade is internal virtual {} β empty body that
reverts, but the function itself is empty. Devs override it:
// VULNERABLE β empty body, no actual auth check
function _authorizeUpgrade(address newImplementation) internal override {}
// SAFE
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
Attack: anyone calls upgradeTo(maliciousImpl) β all storage now
controlled by malicious code.
grep -rn '_authorizeUpgrade' src/
5. delegatecall to attacker-controlled address
If the impl contains a function that performs delegatecall(arbitrary_address),
attackers can pass their own contract β execute arbitrary code in
proxy storage context, including selfdestruct.
grep -rn 'delegatecall' src/
6. Constructor logic in upgradeable contracts
Constructors run on the implementation only β proxy storage is
untouched. Storage initialization must happen in initialize(). If
critical state is set in the constructor, the proxy will read zero
values:
// VULNERABLE β admin set in constructor, proxy reads 0x0
contract Impl {
address public admin;
constructor() { admin = msg.sender; } // sets admin on IMPL only
}
7. Diamond / EIP-2535 specific bugs
- Facet selector collisions β two facets define same selector
- Diamond storage position not unique β cross-facet storage corruption
diamondCutaccess control β must be gated, often forgotten
# Inspect facet selectors
slither . --print function-summary | grep -A1 'Facet'
8. Storage gap for inheritance
OZ upgradeable libs use `
FAQ
What are the main proxy patterns?
The playbook names the Transparent Proxy, UUPS and Diamond patterns.
Why lock the implementation?
So no outside party can initialize it and take control of its settings.
What is a storage clash?
It is when the proxy and the logic contract use the same storage positions, so data gets overwritten.
Details
Original description by the author
Proxy upgrade patterns and their bugs β uninitialized implementation, storage slot collisions, selector clashes, unprotected upgrade auth.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #14014
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.