SlowMist: Can Safe Mode be bypassed, and can Guard contract Babeltower be refactored?
Original Article Title: "SlowMist Analysis | Safe Paradox, Can Guard Restructure the Contract Babel Tower?"
Original Article Authors: flush & kong, SlowMist Technology
Background
On February 21, 2025, the cryptocurrency industry experienced the most severe asset management crisis in history. The on-chain multi-signature wallet of the exchange Bybit was breached through a targeted attack, and nearly $1.5 billion worth of assets were quietly drained via a "legitimate signature" transaction. Subsequent on-chain analysis revealed that the attacker, through a sophisticated social engineering attack, acquired multi-signature permissions, exploited the delegatecall functionality of the Safe contract to implant malicious logic, ultimately bypassed the multi-signature verification mechanism, and transferred the funds to an anonymous address.

This event exposed a harsh reality: "multisig" does not equal "absolute security." Even a security mechanism like the Safe multi-signature wallet, if lacking additional protective measures, still carries the risk of being breached. This is not the first attack case against a Safe multi-signature wallet. Last year, both WazirX (loss of $230 million) and Radiant Capital (loss of $50 million) encountered similar attack methods. As SlowMist pointed out in the analysis of the hacker tactics behind the nearly $1.5 billion theft from Bybit and the associated questions, the Safe multi-signature wallet attack event exhibits the following technical homogeneity:
Over-reliance on Signature Mechanism: Entrusting all security responsibilities to private key custody.
Lack of Dynamic Defense: Absence of real-time risk scanning before transaction execution.
Coarse-grained Permission Control: Failure to establish a whitelist mechanism for high-risk operations like delegatecall.

(Bybit Theft Process: Using Safe v1.1.1)
The core issue of this series of events lies not in the Safe contract itself but in the security vulnerabilities during the integration process of the entire system, especially at the front-end validation stage. This prompts us to consider: How can we strengthen the protection capability of multi-signature wallets through Safe's additional security measures?
Safe
Safe is a multi-signature (Multi-Sig) wallet designed for the secure storage and transfer of high-value assets and cryptocurrencies. As an infrastructure for decentralized asset management, it ensures the security of fund operations through a multi-party collaborative verification mechanism, guarding against malicious actions by a single administrator or hacker exploiting a single point of failure. Safe is widely used in scenarios such as DAO governance, corporate fund custody, and decentralized fund pools. Developed by the Safe (formerly Gnosis Safe) team, this contract is the industry-standard on-chain asset management solution. The contract implements the EIP-712 standard to facilitate structured data signatures, thereby enhancing the security and verifiability of transaction data.
Core Use Cases
Asset Security Management: The contract requires multiple pre-defined owners to collectively approve a transaction before it can be executed, effectively preventing single-point errors or malicious operations and ensuring fund security.
Transaction Execution and Management: Through its built-in multi-signature validation mechanism, the contract can execute external transfers, interact with other contracts, or handle complex business logic when the signature threshold conditions are met, supporting token and native coin transfers as well as fee compensation.
Modular Expansion: The contract is designed with a modular approach, inheriting and combining multiple management modules (such as OwnerManager, ModuleManager, GuardManager, FallbackManager, etc.), making its functionality flexible and easily extensible to provide customized support for various application scenarios.
Function Breakdown
The execTransaction function executes a transaction that has been verified through multiple signatures:
· Computes the unique hash of the transaction (based on transaction parameters, nonce, etc.);
· Validates the authenticity of all signatures, ensuring each signature comes from a legitimate owner or a pre-approved address;
· Calls the target address's business logic and records the success or failure status through events after transaction execution;
· Supports flexible gas fee handling to accurately calculate transaction costs during fee compensation.
The checkContractSignatures & checkNSignatures functions validate the signature data of a transaction or message:
· Process EOA account signature, contract signature (EIP-1271), and pre-approved hash separately;
· Ensure that the signatures are ordered by owner and that each signature comes from a valid address to prevent replay attacks and signature tampering.
The getTransactionHash function generates the transaction hash for signature verification and prevention of replay attacks:
· Structure the transaction data hash using the EIP-712 standard;
· Optimize memory operations using inline assembly to improve computational efficiency;
· Include the current nonce value to ensure the uniqueness of each transaction.
The handlePayment function handles gas reimbursement payment during transaction execution:
· Calculate the payment amount based on the actual gas used and the base fee;
· Support payment in ETH and other tokens to ensure accurate fee reimbursement.
The onBeforeExecTransaction is an internal virtual hook function called before the execution of the execTransaction function. The design purpose of this function is to allow subcontracts inheriting the Safe contract to perform custom logic before transaction execution. The received parameter set includes:
· to: Target Address - Address of the contract or account the transaction is to call
· value: Ether Value - Amount of Ether sent with the transaction
· data: Payload Data - Call data containing the function selector and parameters
· operation: Operation Type - Determines whether it is a CALL or DELEGATECALL
· safeTxGas: Transaction Gas Limit - Amount of gas reserved for transaction execution
· baseGas: Base Gas - Gas cost independent of the transaction execution
· gasPrice: Gas Price - Price used to calculate transaction fee reimbursement gas price
· gasToken: gasToken - The token address used to pay transaction fees
· refundReceiver: Refund Receiver - The address that receives the transaction fee reimbursement
· signatures: Signatures - The collection of signatures from the owners of the transaction
Despite its rigorous security design and flexible modular structure, a multi-signature wallet contract provides an efficient and secure solution for digital asset management, covering end-to-end security control from transaction initialization to final execution. It has become an essential tool for blockchain security management. However, it is also important to note that many victims rely on hardware wallets for signing, and some hardware devices may not display structured data signatures effectively, potentially leading to users being unable to accurately identify transaction data within a short timeframe, thus introducing the risk of "blind signing." To address this issue, in addition to optimizing hardware and its data display, one can explore measures such as increasing multi-factor verification, providing smart prompts, and enhancing signature verification tools to further mitigate the security risks associated with blind signing.
Safe Guard
The Safe contract introduced an important security feature in version 1.3.0 - the Safe Guard mechanism. This mechanism aims to provide additional constraints for the standard n-out-of-m multi-signature scheme to further enhance transaction security. The core value of Safe Guard lies in its ability to perform security checks at different stages of transaction execution:
· Transaction Pre-check (checkTransaction): The Guard mechanism can programmatically inspect all parameters of a transaction before execution to ensure compliance with preset security rules.
· Transaction Post-check (checkAfterExecution): After transaction execution is completed, Guard also conducts additional security validation to verify whether the final state of the Safe wallet after transaction execution meets expectations.
Architecture Analysis

In Safe, multi-signature transactions are typically executed through the execTransaction function. With Safe Guard enabled, when a user executes a multi-signature transaction, the Safe contract will invoke the Guard contract's checkTransaction function to perform a pre-transaction check. After the multi-signature transaction is executed, the Safe contract will call the Guard contract's checkAfterExecution function to examine the transaction's execution result. The specific implementation is as follows:


When a Safe contract performs a multisig transaction pre-check through the Guard mechanism, its checkTransaction function will receive the complete transaction context data, including the target contract address, call method, execution data (such as delegatecall), owner signature information, Gas configuration, and payment information.
This mechanism allows developers to implement multi-dimensional risk control strategies, such as contract whitelist control (restricting interactable addresses), function-level permission management (disabling high-risk function selectors), transaction frequency limits, and dynamic rules based on fund flow. By properly configuring Guard policies, attackers can effectively prevent attackers from exploiting non-contract-layer attacks.
Against the backdrop of a series of recent security incidents, various parties are paying increasing attention to the security of multisig wallet contracts. Hardware wallet providers such as KeyStone, OneKey, and RigSec have called for enhancing the resolution and protection capabilities of Safe contracts to prevent similar risks from reoccurring. After the Bybit incident, many projects have begun to focus on Safe contracts and explore upgrade and expansion solutions based on the Guard mechanism.
Among them, there are innovative applications based on the Guard mechanism, building a middleware security solution on top of the Safe multisig wallet, providing additional security for the underlying assets and user assets. Its core function lies in passing the target contract, call method, execution data, owner signature information, payment information, and gas information involved in Safe multisig transactions to the checkTransaction function to achieve ultra-fine-grained transaction checks, including whitelist contract calls, whitelist function operations, whitelist transfer targets, transaction frequency, and other permission controls.
It is worth noting that Safe itself only provides Guard management and callback functions, and the actual multisig transaction verification logic is implemented by the user. Its security depends on the quality of the Guard implementation. For example, Solv Guardian has extended this idea by specifying dedicated Guardians for each Vault to specify allowed target addresses and operation permissions, achieving three major elements of permission control: specifying allowed contracts, defining allowed function operations, and ACL verification requirements.
Furthermore, by adopting a separate governance mechanism, where the Vault Guardian is responsible for execution and the Governor controls governance permissions, ensures that even if the Guardian encounters issues, remedial measures can be promptly taken to protect user assets. Similar design principles are also applied in Elytro's SecurityControlModule, where the module intercepts critical operations through the preExecute function and finely controls high-risk operations such as module installation, hook settings, and validator management through a whitelist mechanism, ensuring that only trusted contracts can be added to the system, providing long-lasting security for wallets.
In the Bybit attack chain, if the Safe contract has deployed a properly configured Guard mechanism, malicious delegatecall initiated by the attacker through execTransaction will be intercepted by a multi-layered defense during the pre-check phase: the Guard's checkTransaction function first identifies the delegatecall operation type and triggers disable rules (such as enforcing the operation to be a regular call only), then parses the data field to detect non-standard contract address (0x4622...7242) and high-risk function selectors. It directly rolls back the transaction through preset contract whitelisting and function blacklisting policies, ultimately forming a "Policy Interception → Logic Block" defense system, thoroughly preventing storage tampering and fund transfer paths.

(When using Safe version ≥ v1.3.0 Safe Guard module validation operation https://excalidraw.com/#room=fd1df67dd09b3dab6bd8,Q1jeb1MZW7vwbY4NuxaV5A)
Overall, Safe only provides Guard functionality after version 1.3.0. Although Guard can offer very granular multi-signature transaction checks, users face a significant threshold when using Guard functionality. They need to implement Guard check logic themselves. Rough or flawed Guard implementations may not help users enhance the security of their Safe wallets; hence, a security audit of Guard implementation is necessary. Undoubtedly, a secure and proper Guard implementation can significantly enhance the security of a Safe wallet.
Conclusion and Prospects
The Bybit attack incident highlights the importance of timely updating security infrastructure. Bybit was using the v1.1.1 (<1.3.0) version of the Safe contract, which means they could not utilize the Guard mechanism, a key security feature. If Bybit upgrades to the 1.3.0 or higher version of the Safe contract and implements a proper Guard mechanism, such as specifying a whitelist address that can receive funds and conducting strict contract function ACL verification, they may be able to avoid such losses. Although this is only a hypothesis, it provides important insights for future asset security management.
The Safe Guard mechanism is like an intelligent security check system added to a digital asset safe, and its effectiveness depends on the precision of rule design and implementation quality. Faced with increasingly sophisticated attack methods, we need:
· Automated Verification: Establish an automated transaction verification mechanism
· Dynamic Policy Adjustment: Adjust security policies in real-time based on threat intelligence
· Multi-Layer Defense: Combine various security mechanisms to build a defense-in-depth system
· Continuous Audit: Regularly audit the Guard implementation for security
The future of digital asset management will be a joint evolution of smart contract security mechanisms and continuous offensive and defensive evolution. Only by integrating security principles into every aspect can we build a truly secure defense in the game between the hacker's "spear" and the guardian's "shield."
References
[1] https://github.com/safe-global/safe-smart-account/blob/v1.3.0/CHANGELOG.md
[2] https://docs.safe.global/advanced/smart-account-guards
[3] https://docs.solv.finance/security/solv-guard
[4] https://github.com/safe-global/safe-smart-account/tree/main/contracts/examples/guards
[5] https://github.com/Elytro-eth/soul-wallet-contract/blob/v0.6/contracts/modules/securityControlModule/SecurityControlModule.sol
You may also like

SpaceX vs Tesla vs xAI: Which Elon Musk Trade Has the Biggest Upside in 2026?

OpenAI Reveals It Has Confidentially Submitted an S-1 to the SEC, Keeping the Door Open for a Future IPO
On June 9, according to an OpenAI announcement, the company recently confidentially submitted a draft S-1 registration statement to the U.S. Securities and Exchange Commission (SEC), beginning the preliminary compliance process for a potential initial public offering. OpenAI said it chose to disclose this proactively because it expected the news might leak; however, the company has not yet set a specific listing timeline, and related arrangements may still take some time.

Latest research from 13 top universities including Cornell University: The current state, challenges, and misconceptions of the fusion of Crypto and AI

Deconstructing Anthropic: The Best AI Company, Possibly Also a Type of Organizational Invention

Apollo and Blackstone Reportedly Back $35 Billion Anthropic Chip Financing as Deal Details Remain Unclear
On June 9, according to currently available news alerts, Apollo and Blackstone Group participated in a $35 billion financing for an Anthropic “chip project.” Based on the original wording of the report, the funding has already been raised, but public information remains limited. The financing structure, use of proceeds, project entity, and whether Apollo and Blackstone participated through equity, debt, or project financing have not yet been disclosed.

Humanity Protocol Security Incident Escalates: More Than $31 Million Stolen From Related Addresses as Attacker Continues Selling H for ETH
On June 9, according to monitoring by Onchain Lens, more than $31 million has been stolen from addresses linked to Humanity Protocol, and the attack is still ongoing, with the hacker continuously swapping H tokens for ETH. Project founder Terence Kwok later confirmed the security incident on X, saying the issue involved a private key leak.

Bloomberg: As Bitcoin Weakens, Stablecoins and RWA Continue to Drive Expansion in Crypto Businesses
In June, Bloomberg reported that despite Bitcoin falling below $60,000 last week, wiping out about $235 billion in market value within seven days, and dropping close to 50% from last year’s peak, some core businesses in the crypto industry are still expanding, mainly in stablecoins, real-world asset tokenization (RWA), payments, and infrastructure. The report also noted that overall altcoin activity has contracted significantly: altcoin market capitalization has fallen from a peak of about $431 billion in November 2021 to around $170 billion, and among the tens of millions of tokens issued in recent years, fewer than 1,700 still maintain meaningful trading activity.

Galaxy Deep Research Report: How Hyperliquid's HIP-4 Upgrade Changes the Landscape of Prediction Markets?

Binance Research: RWA Market Expected to Expand Nearly 6x from Early 2025, with Public Equities and Onchain Payments Heating Up Together
In June, Binance Research said in its monthly market report that the real-world asset (RWA) market is expected to grow by about 589% from the beginning of 2025. Bond- and money market fund-related RWA expanded by about $6.5 billion, up 83% year over year, while publicly traded equity RWAs grew by about 422%. The report also noted that monthly crypto debit card transaction volume exceeded $747 million in May, up 48.6% year to date.

Japan to Assess a Framework for Yen Stablecoins and Crypto ETFs as Asia’s Compliant Payments Narrative Heats Up
Recently, according to the original report, Japan is considering the launch of yen stablecoins and cryptocurrency ETFs. Public information remains limited at this stage, and there is still no complete policy text, regulatory draft, or clear implementation timeline, so this is better characterized as a “policy discussion” rather than formal implementation. The original wording also noted that advancing stablecoin regulation in Asia is driving XRP usage and supporting growth in the XRPL ecosystem. However, based on currently available public information, there is not enough evidence to directly establish a clear causal relationship between this round of discussion in Japan and XRP or XRPL.

ZachXBT: Humanity private key leak and abnormal surge in H token should be viewed separately
On June 9, according to related disclosures, on-chain investigator ZachXBT posted an update on Humanity’s roughly $31 million security incident, saying that after further analyzing fund flows, he currently tends to believe the project team was not involved in an “inside job” or a self-staged attack. According to him, the official explanation about the private key leak was broadly accurate, but before the token unlock, the price of H had been artificially pushed higher, and the hacker later took advantage of that market environment; therefore, the private key leak and the earlier abnormal price pumping should be regarded as two separate and independent events. This reframing has shifted the market’s understanding of the nature of the incident. Earlier discussion around Humanity had focused on whether the team directly participated in the attack or used the security incident to cover up internal operations. ZachXBT’s latest remarks shift the focus from “whether it was self-theft” to “whether there were pre-unlock market structure issues.” He also questioned whether the team may have.

Morning Report | OpenAI has submitted an S-1 registration statement draft to the U.S. SEC; Morpho completes $175 million financing

Morning Report | BitMine increased its holdings by 126,971 ETH last week; trader Eugene announced his exit from the crypto market

Wang Chuan: How can one not feel anxious after the neighbor Old Wang made thirty times profit by investing in storage stocks? (Seven) - A quarter-century cycle

Cryptocurrency CEXs are flocking to sell US stocks, and traditional brokerages are facing an "uninvited guest."

$75 billion in foreign capital has fled, and South Korean retail investors have absorbed it all using leverage

Japan’s Three Megabanks Plan Joint Stablecoin Issuance in Fiscal 2026
MUFG, SMBC, and Mizuho reportedly plan to jointly issue fiat-pegged stablecoins in fiscal 2026, signaling Japan’s growing push into bank-led digital payment infrastructure.

Humanity Discloses H Token Dual-Chain Attack Details, With Losses on Ethereum and BSC Exceeding $36 Million
Humanity said the H token attack across Ethereum and BSC caused more than $36 million in losses after leaked ProxyAdmin keys enabled malicious contract upgrades and token minting.
SpaceX vs Tesla vs xAI: Which Elon Musk Trade Has the Biggest Upside in 2026?
OpenAI Reveals It Has Confidentially Submitted an S-1 to the SEC, Keeping the Door Open for a Future IPO
On June 9, according to an OpenAI announcement, the company recently confidentially submitted a draft S-1 registration statement to the U.S. Securities and Exchange Commission (SEC), beginning the preliminary compliance process for a potential initial public offering. OpenAI said it chose to disclose this proactively because it expected the news might leak; however, the company has not yet set a specific listing timeline, and related arrangements may still take some time.
Latest research from 13 top universities including Cornell University: The current state, challenges, and misconceptions of the fusion of Crypto and AI
Deconstructing Anthropic: The Best AI Company, Possibly Also a Type of Organizational Invention
Apollo and Blackstone Reportedly Back $35 Billion Anthropic Chip Financing as Deal Details Remain Unclear
On June 9, according to currently available news alerts, Apollo and Blackstone Group participated in a $35 billion financing for an Anthropic “chip project.” Based on the original wording of the report, the funding has already been raised, but public information remains limited. The financing structure, use of proceeds, project entity, and whether Apollo and Blackstone participated through equity, debt, or project financing have not yet been disclosed.
Humanity Protocol Security Incident Escalates: More Than $31 Million Stolen From Related Addresses as Attacker Continues Selling H for ETH
On June 9, according to monitoring by Onchain Lens, more than $31 million has been stolen from addresses linked to Humanity Protocol, and the attack is still ongoing, with the hacker continuously swapping H tokens for ETH. Project founder Terence Kwok later confirmed the security incident on X, saying the issue involved a private key leak.
