Access control is the discipline of ensuring that only authorized addresses can invoke privileged functions in a smart contract, withdrawing funds, minting tokens, pausing the protocol, upgrading logic.
Broken access control is one of the highest-impact and most preventable vulnerability classes. The classic patterns:
- Missing modifier: the function should require
onlyOwnerand doesn't. - Wrong modifier:
onlyAdminexists but is checked against the wrong role. - Initializable not initialized: a proxy's initializer can be called by anyone if the deployer forgets.
tx.origininstead ofmsg.sender: lets a contract phish through a victim user.- Public when it should be internal: utility functions exposed by accident.
Access control should be exhaustive: every state-changing function has a deliberate authorization decision documented in the audit, and every privileged role has a documented holder (which itself should usually be a multi-sig, not an EOA).