access-control
Skill36 starsChanged 5 months agoMITView on GitHub
Detect missing or incorrect access control — missing modifiers, wrong role checks, privileged function exposure, public initializers, and role-escalation paths. Activate on any function that mutates state, transfers funds, mints tokens, sets admin parameters, upgrades implementations, or pauses/unpauses.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- emre-guler/websectheir own version, first seen Aug 27, 2026
- hereshecodes/secureskillstheir own version, first seen Mar 4, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- emre-guler/websec★ 2same name
- hereshecodes/secureskills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository44 other files it gives its agents.
- approval-issuesSkill
- caching-and-incrementalSkill
- centralization-riskSkill
- confidence-scoringSkill
- cosmwasmSkill
- cross-chain-messagingSkill
- cross-contract-stateSkill
- delegatecall-risksSkill
- diamond-eip2535Skill
- dos-vectorsSkill
- erc1271-contract-signaturesSkill
- erc4337-account-abstractionSkill
- erc4626-inflationSkill
- false-positive-feedback-loopSkill
- fee-on-transferSkill
- flash-loan-attacksSkill
- initializationSkill
- inline-assemblySkill
- integer-issuesSkill
- intents-erc7683Skill
- known-good-comparisonSkill
- liquidation-cascadeSkill
- mev-frontrunningSkill
- mev-pbsSkill
- multi-pass-self-critiqueSkill
- oracle-manipulationSkill
- oracle-redundancySkill
- permit2-patternsSkill
- pragma-and-addressesSkill
- progress-and-streamingSkill
- reentrancySkill
- restaking-eigenlayerSkill
- selfdestruct-eip6780Skill
- signature-malleabilitySkill
- signature-replaySkill
- solana-anchorSkill
- storage-layoutSkill
- stylus-rustSkill
- token-compatibilitySkill
- tx-context-misuseSkill
- unchecked-callsSkill
- ve-lock-governanceSkill
- vyper-specificSkill
- zk-verifier-bugsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 81
Use OwnableUpgradeable / AccessControlUpgradeable from OZ — never roll your own.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Access control detection
When this applies
Any state-mutating function. In particular:
- Functions modifying balances, totalSupply, allowances, prices, fees
setOwner,transferOwnership,grantRole,setAdmin,setMinter- Upgrade pathways:
upgradeTo,_authorizeUpgrade, proxy admins - Pause/unpause, emergency-withdraw, sweep, recoverERC20
- Initializers (
initialize,__Init,_init) - Functions guarded only by
msg.sender == tx.originor address checks against a single static value - Bridges, governors, vaults, anything with treasury
Detection patterns
Missing modifier (CRITICAL)
function mint(address to, uint256 amount) external {
_mint(to, amount); // ← anyone can mint
}Wrong role check (HIGH)
function setFee(uint256 fee) external {
require(msg.sender == owner || hasRole(USER, msg.sender)); // ← USER role can set fee
fee_ = fee;
}Initializer left public (CRITICAL)
function initialize(address admin) public { // ← no initializer guard, anyone can re-init
_grantRole(DEFAULT_ADMIN_ROLE, admin);
}See also: [[initialization]]
tx.origin auth (HIGH)
require(tx.origin == owner); // ← phishable via intermediate contractPublic privileged getter masking setter
Sometimes a setter is internal but a public wrapper exists with weak checks. Search for "alternate paths" to the same state slot.
Role admin self-grant (HIGH)
DEFAULT_ADMIN_ROLE can grant itself any role. If the admin is an EOA, a single key compromises everything. Look for renounceable admin patterns or multi-sig requirements.
selfdestruct reachable without ownership check (CRITICAL — but see [[selfdestruct-eip6780]])
Sweep / recoverERC20 with no asset allowlist (MEDIUM-HIGH)
function rescue(IERC20 token) external onlyOwner {
token.transfer(owner, token.balanceOf(address(this))); // ← sweeps any token incl. user deposits
}Critical if it can sweep user deposits, Medium if only stuck airdrops.
Severity rubric
| Pattern | Severity |
| Privileged mint/burn with no auth | Critical |
Public initialize on a deployed proxy | Critical |
| Owner sweep that includes user deposits | Critical |
| Wrong role guards a sensitive op | High |
tx.origin auth | High |
| Centralized single-key admin with no timelock | High (see [[centralization-risk]]) |
| Renounced ownership but admin role retained | Medium |
| Missing zero-address check on role grant | Low |
Remediation patterns
- Use
OwnableUpgradeable/AccessControlUpgradeablefrom OZ — never roll your own. - For each function: state the one role that should call it as a comment, then add the matching modifier.
- Initializers:
_disableInitializers()in the constructor,initializermodifier on init. - Multi-sig + timelock on
DEFAULT_ADMIN_ROLE. Document the timelock duration. - Two-step ownership transfer (
Ownable2Step) to prevent locking out the contract. - For sweeps: explicit allowlist of recoverable tokens, or
denylistuser-deposit tokens.
False-positive notes
- Internal functions called only from properly-guarded externals are fine — verify call sites.
- A function may look unguarded but its only side-effect is emitting an event — Info, not High.
- "Permissionless" by design (e.g.
claim()for caller) is fine — verify intent against the spec.
Related
- [[initialization]] — initializer-specific access control
- [[centralization-risk]] — admin-power audit
- [[delegatecall-risks]] — proxy upgrade authorization
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

