Version guide

Safe modules, guards and delegatecall

Short answer A Safe's owner threshold is the default, and four things change it. A module can execute without signatures, a guard can block execution, a fallback handler answers unknown calls, and a delegatecall transaction runs foreign code in the Safe's storage. Each is a contract the owners trust, and the operation type is part of what they sign.

Written by
Published
Last verified
What this date means
Reading time
About 4 min
Version context
Guards arrived in version 1.3.0, a module guard interface and an extensible fallback handler in 1.5.0. A deployed Safe supports only what its singleton version includes, so the behavior depends on the version it points to.

The protocol page explains how a Safe approves a transaction. This guide lists the parts that change who or what can act, because a Safe described as “3 of 5” can be more or less than that depending on what has been enabled.

The map

PartWhat it can doNeeds owner approval to addWhat to check
Owners and thresholdAuthorize a transaction by signing its hashChanging owners or the threshold needs the current thresholdWho holds each key and how it is stored
ModuleExecute transactions without owner signaturesYes, enabling needs the thresholdIts code, its audits, what it is allowed to call
GuardCheck and possibly block transactions before and afterYesWhether it can lock the Safe, and how to recover
Fallback handlerAnswer calls the Safe does not defineYesIts code and version
Delegatecall operationRun another contract’s code in the Safe’s storagePart of the signed transactionThe target contract and what it writes

Modules

The docs describe modules as extensions that run alongside the multisig. They can implement automation such as recurring payments, restrictions such as allowlists and spending caps, and recovery schemes. A Safe does not need any. A module is enabled with enableModule through a normal threshold-approved transaction, and from then on the Safe keeps a registry of authorized modules. When someone interacts with a module, the module validates the request and calls execTransactionFromModule on the Safe, which executes it.

Two consequences follow. First, a module is a standing permission: it does not need a new signature for each action. A daily allowance module that is correct is useful. A module with a bug or a malicious owner can execute anything the Safe can. Second, the signers who enabled it approved its code, not each future use, so the review has to happen when the module is enabled.

Guards

A guard is a contract that is called before a transaction, with all its parameters, and again after it, with its final result. The docs say guards are used when there are restrictions on top of the n-out-of-m scheme. The guard can inspect everything about the transaction and reject it. The pre-check can enforce a policy such as allowed destinations. The post-check can verify the Safe’s final state.

Guards fail closed. The docs warn that a broken guard can cause a denial of service, so the code must be audited and there must be a recovery mechanism. Version 1.5.0 adds a module guard interface, so module transactions can be checked as well, and the docs list guards as introduced in 1.3.0.

Delegatecall

Every Safe transaction carries an operation type, call or delegatecall. The Safe docs describe the delegatecall as how a Safe loads instructions from other contracts and executes them through the account, which is what batching libraries rely on: one signed transaction that does several things. The cost is that the called contract’s code runs with the Safe’s storage. A library written to transfer tokens is harmless. A contract that writes to the proxy’s implementation slot replaces the Safe’s logic.

That is not a flaw in the multisig. The threshold of owners can authorize a delegatecall and the contract does what they authorized. The Bybit analysis by NCC Group shows what happens when signers authorize one they did not understand: the transaction had operation type 1, a delegatecall to an attacker-controlled contract, and the effect was to change the proxy’s implementation. The amounts and the sequence are in the protocol page.

What changes with the version

The main branch of the contracts repository lists the differences between versions. Version 1.5.0 introduces an extensible fallback handler, a module guard interface, the updated EIP-1271 signature function, memory-safe assembly and removes transfer and send usage, and ends support for zkSync EraVM. The changelog also lists unreleased changes: no longer passing on a revert from a contract owner’s signature validation, and an option to bind an approved-hash signature to one hash. A Safe on an earlier singleton does not have these.

What to check before signing or relying on a Safe

  1. The operation type. If it is delegatecall, who is the target and what does it do? Independent decoding of the calldata is the check, not the interface.
  2. The hash. Compare the hash on the hardware wallet with one computed by a separate tool.
  3. Which modules, guards and fallback handler are enabled, and when they were added. An enabled module is a standing permission.
  4. Which singleton and version the proxy points to.
  5. Who the owners are, including whether any owner is itself a contract that can be changed.

The proxies concept page explains the pattern a Safe uses, and the security assumptions page puts signing risk with the other dependencies.

Version status

Version Status What that status means here
Owner threshold execution active execTransaction with signatures from the threshold of owners over an EIP-712 hash that includes the nonce and operation type.
Modules active Enabled by owners, then able to execute through execTransactionFromModule without signatures.
Guards active Check each transaction before and after execution. Introduced in version 1.3.0. A module guard interface is added in 1.5.0.

Common questions

Can a Safe module move funds without owner signatures?

Yes. Once owners enable a module, it can call execTransactionFromModule on the Safe, and the Safe executes without collecting owner signatures. The Safe docs say modules can execute arbitrary transactions, that only trusted and audited modules should be added, and that a malicious module can take over a Safe. Enabling or disabling a module needs the owner threshold.

What should signers check before approving a Safe transaction?

The destination, the value, the calldata and above all the operation type. A transaction with operation type 1 is a delegatecall, which runs the target's code in the Safe's own storage. Signers should verify the hash on their hardware wallet against an independent decoding, since the interface that displays the transaction is not the thing being signed.

Does a Safe guard make a Safe safer?

It can, by adding restrictions the owner threshold cannot express, such as limiting destinations. The docs add that a guard has full power to block execution, so a broken guard can lock the Safe permanently. A guard is more code that has to be audited and a recovery path that has to exist before it is enabled.

Sources

Check the claims yourself: each group below is a different kind of evidence. Code and specifications show what the contracts do. Documentation shows what the protocol says they do.

Source code

Documentation

Security

Keep reading

See something wrong or missing? Propose a change via pull request (src/content/guides/safe-modules-guards-and-delegatecall.md) or report a correction. See how to contribute.