← All posts
OWASPVulnerabilitiesAccess Control

SC01: Access Control Vulnerabilities in Smart Contracts, With Examples

Security Wiz team3 min read

ShareTelegramX

Access control is the set of locks on a smart contract: the rules about who is allowed to do what. It is ranked SC01, first, on the OWASP Smart Contract Top 10 for 2026.

The principle is simple: only the right person should be able to use each sensitive function. The failures are everywhere because the locks are fitted by hand, one door at a time, and one forgotten door is enough.

What goes wrong

A missing check. A function that moves money or changes settings, with no restriction at all. In this example, anyone can change where the fees are sent:

// Anyone can call this
function setFeeRecipient(address newRecipient) external {
    feeRecipient = newRecipient;
}

An unprotected setup step. Many contracts have a setup function, usually called initialize, that names the owner. It must run once, for the right person. If anyone can run it after launch, an attacker can run it first and make themselves the owner. A well-known case: in November 2017, an unprotected setup function in a widely used wallet library let a user take ownership of the library and then destroy it, freezing more than 500,000 ETH in the wallets that depended on it.

The wrong kind of check. A contract can ask two different questions: "who is calling me directly?" (msg.sender) and "who started this whole chain of calls?" (tx.origin). Using the second to decide who is allowed in is a mistake. If the real owner is tricked into using a malicious contract, that contract can turn around and make calls that pass the check, because the owner did start the chain:

// Vulnerable: a phishing contract the owner calls passes this check
require(tx.origin == owner);

A check in the wrong place. The front door is locked, but a second function reaches the same room without going through it.

Too much power in one key. This is a design mistake and not a coding one: a single key that can change the code, create tokens, pause the system, and withdraw funds. If that key is one ordinary wallet, losing it or having it stolen loses everything.

Role confusion. Roles that can grant themselves other roles, or admin access that was needed during setup and never taken away afterward.

The fixes

Put a restriction on every sensitive function, using a well-tested, widely used building block and not a hand-written check. Here is the earlier example with a lock on it, so only the fee administrator can use it:

function setFeeRecipient(address newRecipient) external onlyRole(FEE_ADMIN) {
    feeRecipient = newRecipient;
}
  • Decide who is allowed in by who is calling directly (msg.sender), never by who started the chain (tx.origin).
  • Lock setup functions so they can run only once. In upgradeable code, also disable them on the implementation, the copy of the logic that sits behind the address users see.
  • Split powers across several roles. Put the powerful ones behind a multisig, a wallet that needs several people to approve each action, and a timelock, a built-in waiting period, so everyone can see a change before it takes effect.
  • Have the contract emit an event for every change of role, and watch for those events.
  • Remove the special access used during launch once setup is done.

How we test it

We start by listing every function a user or an administrator can call and asking one question of each: who can use it, and what checks stand in the way? We build that map from the complete code, then try to break it:

  • Try every sensitive function as someone with no special access. On the Fork tier we do this on a fork, a private copy of the live blockchain, where we can act as any account, including the real administrators and the largest holders.
  • Try to run the setup functions on freshly launched contracts.
  • Look for back doors: second routes to the same logic.
  • Review who holds every key, and whether each one is a multisig, sits behind a timelock, or is a single ordinary wallet. A finding here can be about the design and not the code, and our grade accounts for it.

Access control flaws are among the easiest to fix and the costliest to miss. Request an audit to have yours checked.

ShareTelegramX

Shipping something onchain?

Send us your repo and we’ll return a quote within 24 hours.

Request an Audit