The $1.4 billion Bybit heist did not originate from a smart contract bug. It did not exploit a cryptographic weakness or a consensus failure. It came through a compromised developer workstation at Safe{Wallet}, proving that the most sophisticated on-chain security is meaningless if the off-chain infrastructure connecting users to the blockchain is neglected. For advanced users and security professionals managing significant crypto holdings or building decentralized applications, the events of February 5, 2025 — when the TraderTraitor attack on Safe’s infrastructure began — demand a fundamental reassessment of threat models. This tutorial walks through a systematic methodology for auditing your entire crypto infrastructure stack, from wallet interfaces to cloud dependencies.
The Objective
This guide provides a framework for conducting a comprehensive attack surface audit of your crypto infrastructure. Unlike traditional smart contract audits that focus on Solidity code, this methodology addresses the full stack of dependencies between your private keys and the blockchain: wallet interfaces, browser extensions, RPC providers, cloud infrastructure, CI/CD pipelines, and developer environments. By the end of this tutorial, you will be able to map every component in your transaction signing chain, identify single points of failure, and implement controls that mitigate the class of supply chain attacks that compromised Safe{Wallet}.
Prerequisites
This tutorial assumes familiarity with public key cryptography, blockchain transaction construction, and basic network security concepts. You will need access to a Linux or macOS command line environment, a blockchain explorer API key (Etherscan or equivalent), and the ability to run network analysis tools. Familiarity with JavaScript bundle analysis and AWS IAM concepts is helpful but not required.
Step-by-Step Walkthrough
Step 1: Map Your Transaction Signing Chain
Begin by documenting every component that touches a transaction between the moment you decide to send it and the moment it is confirmed on-chain. For most users, this chain includes: your browser or desktop application, the wallet extension or software, the JavaScript served by the wallet provider, the RPC node used to broadcast the transaction, and any intermediate services like gas estimators or transaction simulators.
For each component, document: who controls the code, how updates are delivered, whether the code is open source and reproducible, and what happens if that component is compromised. Use browser developer tools to inspect the JavaScript loaded by your wallet interface — look for dynamically loaded scripts, inline code injections, and third-party dependencies that could introduce supply chain risk.
Step 2: Audit Your RPC Configuration
Your RPC provider is a critical trust point. A compromised or malicious RPC node can display incorrect balances, fake transaction confirmations, and manipulated gas estimates. Verify that your wallet is connecting to the RPC endpoint you expect by checking the network configuration settings. Use Wireshark or tcpdump to confirm that DNS resolution points to the correct IP addresses and that no unexpected redirects are occurring.
For high-value operations, consider running your own RPC node using clients like Geth, Reth, or Erigon. Self-hosted nodes eliminate the RPC provider as a trust assumption, though they introduce operational complexity. At minimum, configure your wallet to use a specific, trusted RPC endpoint rather than accepting the default provided by the wallet software.
Step 3: Implement Transaction Verification Protocols
Before signing any significant transaction, implement a two-channel verification protocol. Construct the transaction using your primary interface, then verify the transaction data — destination address, value, calldata, and gas parameters — through an independent channel. This could be a second wallet application, a command-line tool like cast from the Foundry suite, or a direct query to your own RPC node.
For hardware wallet users, the device screen serves as the second verification channel. Ensure you are reading and verifying every field displayed on the device before confirming. Pay particular attention to the contract interaction data — in the Bybit heist, the malicious code replaced a legitimate delegate call with one pointing to an attacker-controlled contract, a change that would have been visible in the raw transaction data but not in the wallet interface’s simplified display.
Step 4: Analyze Your Dependency TreeUse tools like npm audit, yarn audit, or Snyk to scan your wallet software’s dependency tree for known vulnerabilities. For browser-based wallets, use Chrome’s built-in security panel or extensions like Requestly to monitor network requests and identify unexpected data flows. Pay attention to third-party analytics scripts, error tracking services, and content delivery networks — each represents an additional attack surface.
For organizations managing multisig setups, audit the deployment pipeline for your wallet infrastructure. The Safe{Wallet} attack succeeded because the attackers gained access to the CI/CD pipeline through a compromised developer machine. Ensure that your deployment process requires multiple approvals, that build artifacts are reproducible and verified against source code, and that production credentials are never accessible from developer workstations.
Step 5: Establish Continuous Monitoring
Deploy on-chain monitoring that alerts you to unexpected activity on your high-value addresses. Tools like Forta, OpenZeppelin Defender, or custom scripts using ethers.js can detect anomalous transaction patterns, unexpected approval changes, or interactions with known malicious contracts. Configure alerts for any transaction that exceeds predefined thresholds or interacts with unverified contracts.
For infrastructure monitoring, set up integrity checks on the JavaScript bundles served by your wallet provider. Tools like Subresource Integrity (SRI) hashes can alert you if the code loaded by your browser differs from the expected version — a potential indicator of a supply chain compromise similar to the Safe{Wallet} attack.
Troubleshooting
If you discover unexpected behavior during your audit, do not panic but do act deliberately. Isolate the affected system immediately — disconnect from the network and do not sign any transactions. Document everything: URLs of unexpected scripts, IP addresses of suspicious connections, and hashes of any modified files. Report findings to the wallet provider’s security team and, if significant funds are at risk, to law enforcement through IC3.gov or your local cyber crime unit.
Common issues encountered during audits include wallet extensions loading scripts from unexpected domains, RPC requests being redirected through intermediary servers, and wallet interfaces that do not display full transaction calldata for contract interactions. Each of these represents a potential vector that sophisticated attackers could exploit.
Mastering the Skill
Infrastructure auditing is not a one-time exercise — it is a continuous discipline. Schedule quarterly audits of your full transaction signing chain. Subscribe to security advisories from your wallet providers and blockchain client teams. Participate in bug bounty programs to stay current on emerging attack techniques. As the Safe{Wallet} incident demonstrated, the most dangerous attacks target not what is visible on-chain, but everything that happens before a transaction reaches the blockchain. Mastering this discipline means understanding that in crypto security, what you cannot see is precisely what can hurt you.
Disclaimer: This article is for educational purposes only and does not constitute professional security advice. Always engage qualified security professionals for comprehensive audits of high-value infrastructure.
CI/CD pipelines are the soft underbelly of every crypto project. one bad github action and your deployment is compromised
most teams dont even audit their github actions. its just copy-paste from stackoverflow and pray
copy-paste CI/CD from stackoverflow is basically industry standard in crypto. saw a project last month that had AWS credentials hardcoded in their github actions yaml. 200M TVL
aws creds in github actions yaml with 200m tvl… and people wonder why defi keeps getting drained. its not the contracts, its the ops
finally someone talking about off-chain infra. smart contract audits are theater if your RPC provider is malicious
exactly. the Bybit hack went through Safe infrastructure, not a smart contract. everyone audits solidity but nobody checks what RPC node they are actually talking to
the bybit hack wasnt even a smart contract exploit but you wouldnt know it from how most coverage framed it. safe infrastructure was compromised, the contract was fine