solady-ownable-init-frontrun

Solid

Detect front-runnable ownership initialization in Solady Ownable / OwnableRoles. Solady's `_initializeOwner` is a guarded one-time setter (it reverts with `AlreadyInitialized` on a second call) but it is NOT access-controlled, so in constructor-less deployment paths (minimal-proxy clones, EIP-1167, factory `create`/`create2` without atomic init) an attacker can call the public initializer first and seize ownership. Activate on solady Ownable/OwnableRoles in clones, factories, or any non-atomic deploy+init.

AI & Automation 38 stars 5 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
53
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Solady Ownable initializer front-run detection ## When this applies Trigger on any of: - `import {Ownable} from "solady/auth/Ownable.sol";` or `OwnableRoles` - A contract calling `_initializeOwner(...)` from a public/external `initialize()` rather than the constructor - Minimal-proxy clones (`LibClone.clone` / EIP-1167) of an Ownable implementation - Factory deployments where `create`/`create2` and `initialize()` are two separate transactions - Implementation contracts behind proxies (UUPS / transparent) using Solady Ownable - Any `initialize`/`init` that is not protected by an initializer guard or atomic deploy ## Detection patterns ### Public init, non-atomic deploy (HIGH) ```solidity contract Vault is Ownable { function initialize(address owner) external { _initializeOwner(owner); // reverts on 2nd call — but ANYONE can make the 1st } } // Factory: address v = LibClone.clone(impl); Vault(v).initialize(msg.sender); // ← separate tx: front-runnable in the mempool ``` Between `clone` and `initialize`, a searcher front-runs `initialize(attacker)`. `_initializeOwner` succeeds for them; the legit call then reverts `AlreadyInitialized`. **Signal:** `_initializeOwner` reachable from an unguarded external function and deploy/init are not in one transaction. ### Implementation left uninitialized (HIGH) ```solidity contract Impl is Ownable { function initialize(address o) external { _initializeOwner(o); } } // Impl deployed standalone, never initialize...

Details

Author
iktok90-design
Repository
iktok90-design/ai-smart-contract-auditor
Created
1 weeks ago
Last Updated
2 days ago
Language
JavaScript
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category