Smart contract bugs / Who can call it?
Missing or wrong access control
A function that moves funds, mints tokens or changes settings has no check of who calls it, or the check is wrong. Anyone can call it.
OWASP SC01:2026 · 131 real exploits · $149.7M lost
How the attack works
- A privileged function is
publicorexternaland has noonlyOwner, no role check, or a check on the wrong variable. - The attacker reads the verified source or the bytecode and finds the open function.
- The attacker calls it directly: sets themselves as owner, mints tokens, changes the fee receiver, or withdraws.
- Variants: auth with
tx.origin, a role granted to a contract that anyone can call, a helper that should beinternal.
Vulnerable and fixed code
function setFeeReceiver(address r) external {
feeReceiver = r; // no check: anyone can redirect fees
}
function withdraw(uint256 amt) external {
require(tx.origin == owner); // a phishing contract passes this
payable(msg.sender).transfer(amt);
}import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
bytes32 public constant ADMIN = keccak256("ADMIN");
function setFeeReceiver(address r) external onlyRole(ADMIN) {
require(r != address(0), "zero");
feeReceiver = r;
}
function withdraw(uint256 amt) external onlyRole(ADMIN) {
payable(msg.sender).transfer(amt); // msg.sender, never tx.origin
}Review checklist
- List every
externalandpublicfunction that changes state. For each one, write who may call it. - Use
msg.senderfor auth. Never usetx.origin. - Use a tested library (OpenZeppelin
Ownable2SteporAccessControl), not a hand-written check. - Put admin roles behind a multisig and a timelock, so one stolen key cannot drain the protocol.
- Make helpers
internalorprivateunless an outside caller needs them.
How to test for it
- For each privileged function, write a test that calls it from a random address and expects a revert.
- Run Slither: the detectors
arbitrary-send-eth,suicidal,tx-originandunprotected-upgradefind many cases.
Real exploits (131)
-
Infini: Infini lost about $49.5M in USDC when a former developer, who still held an admin role on its vault, drained the funds.
Root cause and fix
Vulnerable code:
Morpho MEV Capital Usual USDC vault (Infini's vault system)Infini's founder did not fully take back contract authority from a developer after the work was done. That developer's account kept a privileged role (the article gives 0x8e0b and 0x8e9b) that allowed withdrawing all vault funds. About 114 days later, the attacker funded a wallet with 1 ETH from Tornado Cash and deployed a contract disguised as part of the vault system. They then used the role to withdraw 11.5M and 38M USDC in two transactions. They swapped the USDC to DAI and then to about 17.7K ETH. QuillAudits says the account's private key was accessed, while the founder says his own key was not leaked.
What would have stopped it: Move all admin and privileged roles to a multisig with a timelock, and remove every developer role at handover. Check the role holders on-chain after each handover. Add withdrawal limits for critical vault functions.
-
Parity Multisig Wallet: Parity multisig wallets lost 153,037 ETH (~$30M) because the initWallet() function was public and could be called again, so an attacker made himself owner and drained the funds.
Root cause and fix
Vulnerable code:
0xBEc591De75b8699A3Ba52F073428822d0Bfc0D7e (Parity wallet) · initWallet()The wallet's initialization function initWallet() had no check that the wallet was already initialized or that the caller was authorized. It could be reached through the wallet's delegatecall into the shared library code. The attacker called initWallet() with himself as the only owner, required=0 and a huge daily limit. Then he called execute() to send the whole balance to his own address.
What would have stopped it: Guard initializers so they run only once (an initialized flag or an only-once modifier), and make setup functions internal or constructor-only. Do not expose state-changing library functions through a fallback that delegatecalls; use explicit visibility and test that already-initialized wallets reject re-initialization.
-
Safemoon: Safemoon lost $8.9M (28k BNB) from its SFM/BNB pool because an upgrade left burn() publicly callable, letting anyone burn tokens from any address.
Root cause and fix
Vulnerable code:
SFM token contract (new implementation 0xeb11a0a0bef1ac028b8c2d4cd64138dd5938ca7a) · burn()About six hours before the attack, the deployer upgraded the SFM token to a new implementation in which burn() had no access control. The attacker called burn() to destroy a large amount of SFM held in the SFM/BNB liquidity pool, which skewed the pool price and made SFM look far more valuable. The attacker then sold previously acquired SFM into the skewed pool and drained about 28k BNB. Peckshield suggested the deployer keys may have been leaked or phished, but the article does not confirm this.
What would have stopped it: Restrict burn() so it can only burn the caller's own tokens, or require an authorized role. Add tests that check every external function for unauthorized callers, and review each upgrade's diff before deploying it.
-
RsETHSafeModule (rsETH whale Gnosis Safe via private DeFi-Saver-style Router): A whale's Gnosis Safe lost about 2,900 aEthrsETH (~$7.8M) because a Router's multicall authorization could be bypassed by targeting the Router itself, which reached an enabled Safe module and a DELEGATECALL.
Root cause and fix
Vulnerable code:
Router 0x4f0055926c839D1d960a82CBF84E2eE933958ebC · multicall(address,bytes[])The Router's multicall(address _contract, bytes[] _data) checks authorization on the target, and _isAuthorized returns true whenever _contract == address(this). An unauthorized caller calls multicall(ROUTER, [multicall(MODULE, [moduleCall])]). The outer call passes, and the nested call runs with the Router as msg.sender. The enabled Safe module trusts the Router, so it calls execTransactionFromModuleReturnData on the victim Safe with operation=1 (DELEGATECALL) to a RecipeExecutor. That recipe, running in the Safe's context, withdrew the Safe's aEthrsETH. No owner signature was needed. An MEV bot frontran the original exploiters.
What would have stopped it: Do not treat calls from the contract itself as authorized in a multicall that can forward calls. Check the original caller on every nested call. Restrict Safe modules so they cannot be reached by arbitrary callers and cannot use DELEGATECALL to arbitrary targets. Add tests that an unauthorized caller cannot reach privileged targets through self-calls.
-
KiloEx: KiloEx, a multi-chain perpetuals protocol, lost about $7.5M because its MinimalForwarder did not verify callers, letting anyone set the price oracle.
Root cause and fix
Vulnerable code:
MinimalForwarderThe MinimalForwarder contract did not properly check who was calling it or validate the data and signature. The trust chain was KiloPriceFeed trusts Keeper, Keeper trusts PositionKeeper, and PositionKeeper trusts MinimalForwarder. So anyone could change the price oracle. The attacker set the ETH price to about $100, opened leveraged longs, then set it to about $10,000 and closed them for profit. They repeated this on Base, BNB Chain, opBNB, Taiko and Manta.
What would have stopped it: Make the forwarder verify the signer and the caller properly, and restrict price-setting functions to trusted keepers only. Do not let a chain of contracts each assume the previous one did the check. Also add price sanity bounds against the Pyth feed and test access control across the whole call chain.
-
Safe (2-of-7 multisig, victim Safe 0x631f...b9b8): A 2-of-7 Safe on Avalanche lost about $7.45M because it had unlimited ERC20 approvals to an empty counterfactual address, which an attacker could occupy by reproducing CREATE2/CREATE address math.
Root cause and fix
Vulnerable code:
Victim Safe 0x631FCa4a73AEe699638634479132452ef354b9B8 (unlimited ERC20 approvals to empty counterfactual address 0x3725...155d) · transferFrom (via standing ERC20 approvals)On 2026-03-07 the Safe granted unlimited approvals (USDC, WAVAX, WETH.e, BTC.b) to an address that held no code on Avalanche and was never revoked. That address was the 13th CREATE output of a Safe CreateCall instance, which is itself the CREATE2 output of the Safe Singleton Factory (salt 0, fixed initcode). An ERC20 approval is tied to an address, not to a caller. So any EOA could deploy the factory-derived CreateCall, burn 12 CREATEs, deploy a sweeper as the 13th, and call transferFrom on all four tokens with no Safe key or signature. The original attacker tx was front-run by an MEV bot that landed the same drain.
What would have stopped it: Only approve addresses that already have verified code and are controlled by you. Never approve counterfactual or empty addresses, especially ones reachable through public deterministic deployers. Use exact or time-limited allowances and revoke them after use.
-
TrustedVolumes: TrustedVolumes lost about $5.87M on Ethereum when its custom RFQ swap proxy let anyone register as an order signer and pull funds from the inventory's unlimited approvals.
Root cause and fix
Vulnerable code:
RFQ Proxy (0xeEeEEe53033F7227d488ae83a27Bc9A9D5051756) / RFQ Implementation (0x88eb28009351Fb414A5746F5d8CA91cdc02760d8) · registerAllowedOrderSigner()registerAllowedOrderSigner() had no access control, so anyone could register their own EOA as an allowed signer. The signer check in fillOrder() used the caller/receiver as the key instead of the order's maker, so it proved nothing about who owned the funds. The contract also used the taker field as the transfer "from" address, so the attacker set taker to TrustedVolumes' inventory, which had given the proxy unlimited ERC-20 approvals. The replay guard (saltStatus) wrote to one storage key and read another, so it never fired. The attacker made four fill calls in one transaction, paying 1 wei USDC each time.
What would have stopped it: Restrict signer registration to the maker (or an owner), and key signer permissions by the order's maker. Require that the token "from" address is the verified maker who signed, not a caller-supplied taker. Add tests that a forged order cannot pull from a third party with approvals, and make sure replay-protection reads and writes the same key.
-
X-Token (xSNX): X-Token's xSNX lost about $4.5M because callFunction on xSNXAdmin had a wrong require and could be called by anyone, letting an attacker use a flash loan to trade SNX at a depressed price.
Root cause and fix
Vulnerable code:
xSNXAdmin · callFunctionThe callFunction function on xSNXAdmin was meant to be called only by dydx's SoloMargin flash loan contract. It used require(sender==address(this)) instead of require(msg.sender==soloMarginAddress), so anyone could call it. The attacker flash-loaned 25,000 ETH, pushed the SNX price down through swaps on Bancor, Kyber and Curve, and sent sUSD to xSNXAdmin. They then called callFunction to burn the sUSD debt and swap about 614k SNX for about 811k sUSD at the depressed price. Finally they reversed all the trades and repaid the loans, keeping the profit.
What would have stopped it: Check msg.sender against the trusted SoloMargin address in the flash loan callback, and also check that the initiating sender is the contract itself. Add tests that call the callback from an arbitrary address and expect a revert.
-
New Market Trading: New Market Trading lost about $3.98M from 88 Gnosis Safes on Ethereum, Base and Arbitrum because its Safe module trusted a caller-supplied delegate address and source string instead of checking msg.sender.
Root cause and fix
Vulnerable code:
SquidRouterModule · expressExecuteWithToken()The SquidRouterModule exposed Axelar's expressExecuteWithToken(), which skips gateway validation, and put no real access control behind it. The first check, sourceAddress == squidRouter, was a caller-supplied string anyone could copy. The second check, hasPermission(safe, delegate, ...), used a delegate address taken from the caller's payload rather than msg.sender. The attacker read real delegates from the public PermissionsManager and put them in the payload. Then they made each victim Safe approve tokens, authorize Permit2 and swap its full balance with amountOutMin = 0 into attacker-owned Uniswap V3 pools holding a worthless token. Afterwards they removed the liquidity.
What would have stopped it: Require msg.sender to be the registered delegate (require(msg.sender == delegate)). Only accept cross-chain messages after real gateway validation, and never treat a caller-supplied string as proof of origin. Audit every new privileged module before release, and enforce slippage or price checks on swaps the module makes.
-
Aevo (Ribbon Finance legacy vaults): Aevo's legacy Ribbon vaults lost about $2.7M after an oracle upgrade left the price-feed proxy admin functions unprotected, so an attacker could set arbitrary expiry prices.
Root cause and fix
Vulnerable code:
Proxy Admin (0x9D7b3586f361e3621Bf4F099cBC9d155e8ae6B76) for the oracle price-feed proxies · transferOwnership / setImplementationA December 6, 2025 oracle upgrade exposed the price-feed proxies. transferOwnership and setImplementation were left unprotected, and the Proxy Admin checked a permission flag on tx.origin instead of the caller. The attacker used a wallet with that flag to swap the oracle implementation to a malicious contract, set huge prices and expiry timestamps for newly made assets, then swap back. The attacker had also created options that mixed 18-decimal and 8-decimal assets, which the new configuration did not guard against. The attacker then burned the oTokens to drain WETH and USDC from the vault.
What would have stopped it: Gate ownership and implementation changes on msg.sender with strict role checks. Never authenticate with tx.origin. Test every upgrade for access control and decimal consistency, and enforce Opyn's collateral and product-matching rules and decimal normalization in the configuration.
121 more examples in the full guide.