Security Monitoring System for Cross-Chain Bridges

We design and develop full-cycle blockchain solutions: from smart contract architecture to launching DeFi protocols, NFT marketplaces and crypto exchanges. Security audits, tokenomics, integration with existing infrastructure.
Showing 1 of 1All 1305 services
Security Monitoring System for Cross-Chain Bridges
Complex
~1-2 weeks
Frequently Asked Questions

Blockchain Development Services

Blockchain Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1349
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1247
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    949
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1183
  • image_logo-advance_0.webp
    B2B Advance company logo design
    642
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    921

Most exploits on cross-chain bridges last from one transaction to a few minutes. The Wormhole attack ($326M) was a single signed transaction — zero reaction time. The Ronin Bridge ($620M) had 5 out of 9 validators compromised, and the bridge operated for 6 days before detection. If your monitoring system doesn't analyze both on-chain activity and validator state, funds are lost irreversibly. Our task: build a system that catches the attack before or during execution, giving time to pause the protocol.

We don't just build dashboards with charts. This is a production-grade system with alert logic, circuit breakers, and clear incident response playbooks. Our experience includes integration with OpenZeppelin Defender and Tenderly Web3 Actions for automated bridge pausing when anomalies are detected. Over 5+ years, we have delivered 15+ monitoring systems for DeFi protocols, which allows us to guarantee a reliable solution.

Key Threats to Cross-Chain Bridges

Bridges are critical DeFi infrastructure. The main attack vectors:

  • Reentrancy in smart contracts — classic attack amplified by cross-chain calls.
  • Validator/relayer compromise — attacker gains majority of signatures and confirms fraudulent transactions.
  • Oracle manipulation — tampering with price feeds for unfair exchange.
  • Flash loan attacks — instant borrowing to create pool imbalance.

The monitoring system must track each of these scenarios on both the source and target chains.

How the System Detects Anomalies

The system operates on three tiers, each with a different reaction time:

Tier 1 — On-chain real-time (< 1 block). Monitor pending transactions in the mempool for suspicious patterns: multiple cross-chain calls, unusual volumes, interactions with new contracts. Technically challenging (requires access to private mempool via Flashbots or Eden), but provides the earliest warning.

Tier 2 — On-chain per-block (< 12 seconds on Ethereum). Analyze each new block: bridge events (BridgeInitiated, BridgeFinalized), balance changes in liquidity pools, abnormal accumulation of validator votes.

Tier 3 — Off-chain aggregated (minutes to hours). Aggregate data over a period, trend analysis, cross-chain correlations. Catches slow-developing attacks: limit drifting, accumulation of signatures by inactive validators.

How On-Chain Circuit Breakers Work for Bridges

The most valuable component is the ability to automatically or semi-automatically pause the bridge when an attack is detected. Unlike the standard Pausable (OpenZeppelin), we use rate limiting at the contract level that triggers automatically on abnormal transfer volume:

contract BridgeWithCircuitBreaker is Pausable, AccessControl {
    bytes32 public constant GUARDIAN_ROLE = keccak256("GUARDIAN_ROLE");
    
    uint256 public maxTransferPerBlock;
    uint256 public maxTransferPerHour;
    
    uint256 private _transferredThisBlock;
    uint256 private _transferredThisHour;
    uint256 private _lastBlockNumber;
    uint256 private _lastHourTimestamp;
    
    modifier withinRateLimit(uint256 amount) {
        _updateRateLimitCounters();
        require(_transferredThisBlock + amount <= maxTransferPerBlock, "Block rate limit exceeded");
        require(_transferredThisHour + amount <= maxTransferPerHour, "Hour rate limit exceeded");
        _transferredThisBlock += amount;
        _transferredThisHour += amount;
        _;
    }
    
    function transfer(address token, uint256 amount, address to) external whenNotPaused withinRateLimit(amount) {
        // ... transfer logic
    }
    
    function emergencyPause() external onlyRole(GUARDIAN_ROLE) {
        _pause();
        emit EmergencyPause(msg.sender, block.timestamp);
    }
    
    function _updateRateLimitCounters() private {
        if (block.number > _lastBlockNumber) {
            _transferredThisBlock = 0;
        }
        if (block.timestamp >= _lastHourTimestamp + 1 hours) {
            _transferredThisHour = 0;
            _lastHourTimestamp = block.timestamp;
        }
    }
}

Rate limits don't block normal operations but stop drain attacks with large volumes. Setting limits at 2–3x the typical bridge volume strikes a balance between UX and security.

Why Invariant Monitoring Is Effective Against Exploits

Every cross-chain bridge has mathematical invariants that must always hold. Monitoring these invariants is an elegant way to catch exploits:

  • Mint/burn bridge: sum(totalSupplyOnSource) + sum(totalSupplyOnDestination) == constant (excluding fees).
  • AMM bridge: reserve0 * reserve1 >= k for each pair.

Example Python function for checking:

async def check_invariants(block_number: int):
    total_locked = await bridge.functions.totalLocked().call(block_identifier=block_number)
    total_minted = await bridge.functions.totalMinted().call(block_identifier=block_number)
    if total_locked != total_minted:
        await alert_critical(f"INVARIANT VIOLATED at block {block_number}: locked ({total_locked}) != minted ({total_minted})")

An invariant violation is a sure sign of a bug or an active attack.

Automatic Pausing via Off-Chain Keeper

OpenZeppelin Defender Actions — serverless functions that react to on-chain events. Example: monitoring the bridge pool's TVL and automatically pausing on a sharp drop:

const { ethers } = require("ethers");

module.exports = async function(credentials) {
  const provider = new ethers.providers.JsonRpcProvider(credentials.secrets.ALCHEMY_URL);
  const vault = new ethers.Contract(VAULT_ADDRESS, VAULT_ABI, provider);
  const currentTVL = await vault.totalAssets();
  const previousTVL = await storage.get('previousTVL') || currentTVL;
  const dropPercent = (previousTVL - currentTVL) * 100n / previousTVL;
  if (dropPercent > 15n) {
    const signer = credentials.relayer.getSigner();
    const guardian = new ethers.Contract(GUARDIAN_ADDRESS, GUARDIAN_ABI, signer);
    await guardian.emergencyPause();
    await notifySlack(`CRITICAL: TVL dropped ${dropPercent}% — bridge paused`);
  }
  await storage.put('previousTVL', currentTVL.toString());
};

Alerting and Incident Response

Alert severity is configured as follows:

Severity Criterion Reaction Reaction Time
P1 Critical Active attack, loss of funds Immediate pause + team calls < 2 minutes
P2 High Invariant violation, oracle manipulation Pause + review within an hour < 15 minutes
P3 Medium Abnormal volume, unusual behavior Next-day review < 4 hours
P4 Low Statistical deviation Weekly review Async

P1/P2 alerts are sent to PagerDuty with on-call rotation, P3 to a Telegram chat, P4 to a Slack daily digest.

Example Incident Response Playbook

Scenario: TVL drop > 15% in one block.

  1. On-call engineer receives PagerDuty alert (< 2 min).
  2. Check Etherscan: find the transaction, cause of TVL drop.
  3. If exploit — call emergencyPause() via Defender Relayer.
  4. Notify the team via Signal (not public Telegram).
  5. After 15 minutes: public message to users about the pause.
  6. Post-mortem analysis: how the attack occurred, how to fix, when to unpause.

The playbook is tested via drill exercises in a test environment.

What's Included in Our Work

  • Audit of your bridge architecture and identification of critical invariants
  • Development of smart contract circuit breakers with rate limiting (Solidity)
  • Deployment of event indexer and anomaly detector (Python / TypeScript)
  • Setup of alerting pipeline (PagerDuty, Telegram, Slack)
  • ML model (Isolation Forest) for unknown attacks
  • Documentation and tested incident response playbooks
  • Training of your team on the system
  • Post-launch support

Development Timeline

Component Technology Development Time
Event indexer web3.py / viem subscriptions 1–2 weeks
Rule-based detector Python rules engine 1–2 weeks
Invariant monitor Python + contract calls 1 week
Circuit breaker contract Solidity + OZ Pausable 1 week
Alerting pipeline PagerDuty + Telegram 3–5 days
ML anomaly detection scikit-learn 2–3 weeks
Defender Autotasks JavaScript + Defender SDK 1 week
Dashboard Grafana + InfluxDB 1–2 weeks

An MVP system (rule-based + alerting + basic circuit breaker) takes 4–6 weeks. A full system with ML, automatic pause, dashboard, and playbooks takes 10–14 weeks.

Cost is calculated after analyzing the bridge architecture. Given that an attack can cost hundreds of millions of dollars, investment in monitoring pays for itself with the first prevented attack. Contact us for a consultation — we will assess your project and propose an optimal solution. Request development of a monitoring system today.

How Do We Find What the Compiler Misses?

When a protocol loses $197M through a flash loan attack on a function that auditors reviewed live — it's not an accident. It's a systemic gap in methodology. Our experience shows: vulnerabilities live in a contract for over a year, while the compiler remains silent. We restructured the audit process to catch such cases before deployment.

What Static Analysis Won't Find?

Slither is the standard first tool. It finds reentrancy, integer overflow (in older Solidity versions), improper use of tx.origin, variable shadowing, uninitialized storage. On a real project, Slither produces dozens of warnings, of which critical ones are 0‑2. The rest is informational noise.

Slither won't find logical vulnerabilities. If withdraw correctly checks balance and correctly updates state, but business logic allows double deduction through two different code paths — Slither stays silent.

Mythril uses symbolic execution: builds a graph of all possible execution paths and searches for reachable states violating properties. Works well on isolated contracts. On a protocol of 20 contracts with cross‑contract calls — path explosion, analysis hangs or returns false positives.

Both tools are mandatory as a first pass. But they don't replace manual analysis.

Fuzzing: Where Echidna and Foundry Find Real Bugs

Echidna is a property‑based fuzzer from Trail of Bits. The idea: formulate contract invariants as Solidity functions (echidna_invariant), Echidna generates random call sequences and tries to break the invariant.

Example invariant for a lending protocol:

function echidna_total_assets_ge_liabilities() public view returns (bool) {
    return totalAssets() >= totalLiabilities();
}

Echidna will find a sequence deposit → borrow → liquidate → repay that violates this invariant. You can't build such a case manually — too many combinations.

Foundry fuzzing (forge test --fuzz-runs 100000) is easier to integrate if the team is already on Foundry. Supports stateful fuzzing via invariant tests. In a real project: auditing a vault contract, Foundry fuzzed for 40 minutes and found an edge case where maxWithdraw returned a value larger than actual balance at a specific shares/assets ratio after several donations. Hardhat unit tests missed it — they didn't have that combination of parameters.

Medusa (from Trail of Bits, newer than Echidna) supports corpus‑guided fuzzing and runs faster on large contracts. If the codebase exceeds 5000 lines of Solidity — we look at Medusa.

How Invariants Help Identify Critical Vulnerabilities

Formal verification proves that the contract satisfies specifications for all possible inputs — not for N random ones, but mathematically for all. Tools: Certora Prover, K Framework, Halmos.

Certora works with CVL (Certora Verification Language): write rules and invariants, the Prover translates them into SMT formulas and checks via Z3/CVC5. MakerDAO, Aave, Uniswap use Certora in CI/CD pipeline — every PR is automatically verified.

Limitations: doesn't work with unbounded loops, struggles with hash functions and signature verification. For contracts with simple math (AMM, lending) — excellent. For contracts with arbitrary external calls — difficult to write sufficiently complete specifications.

Formal verification makes sense for contracts that: manage over $50M, are rarely updated, have clearly formalizable invariants. For fast‑iterating products — the cost‑benefit ratio doesn't favor verification.

What Attack Vectors Do Junior Auditors Miss?

Storage collision in proxy pattern. Transparent proxy and UUPS use specific slots for implementation address (EIP‑1967). If an implementation accidentally declares a variable in slot 0 that overlaps with proxy storage — we get silent override. Slither won't catch this if proxy and implementation are in different files.

Read‑only reentrancy. Classic reentrancy guard protects against state changes during recursive calls. But if an external contract reads state via a view function mid‑transaction — guard doesn't help. Years ago, Curve pools became an attack vector precisely through this: an external protocol read get_virtual_price during a reentrancy‑vulnerable state of Curve.

Oracle manipulation via TWAP. Spot price is a standard target for flash loan attack. TWAP is harder to manipulate, but not impossible: on low‑liquidity Uniswap v2 pairs, TWAP can be shifted over several blocks with enough capital. Proper protection: use Chainlink as primary oracle with TWAP as fallback, with deviation threshold check.

Gas griefing on unbounded loop. A function iterates over an array of users. Attacker adds thousands of addresses with zero balances — the function's gas cost rises to the gas limit, making it inaccessible. Protection: pull pattern instead of push, limit array lengths, batch processing with position tracking.

Front‑running on MEV. Transaction is visible in mempool before inclusion in block. MEV bot sees addLiquidity for a significant amount, inserts its own swap before it (sandwich attack). For AMM this is part of the model. For protocols with price functions — require minAmountOut / deadline parameter and its mandatory verification.

Structure of a Full Audit

  1. Scope definition and automated analysis (1‑2 days). Fix commit hash, compiler version, list of out‑of‑scope items. Run Slither, Mythril, Aderyn. Triage: separate real critical bugs from false positives. Build contract dependency map.

  2. Manual analysis (5‑15 days). Each contract line by line. Special attention: all external and public functions, all transfer/call/delegatecall, all places where state changes before a check or after an external call, all math operations with user inputs. On average, 95% of found vulnerabilities are logical, not technical.

  3. Fuzzing and testing (2‑5 days). Echidna or Foundry invariant tests for critical invariants. Fork mainnet tests — verify behavior in real environment with real oracles. For example, in 4 days fuzzing finds on average 3 edge cases not covered by unit tests.

  4. Report and mitigation. Report with severity (Critical/High/Medium/Low/Informational), attack vector description, PoC code for Critical/High. Developers fix, auditors perform re‑audit of fixes.

Severity Examples Requires re‑audit?
Critical Drain funds, unauthorized ownership transfer Always
High Manipulation, DoS on key functions Always
Medium Incorrect behavior on edge cases Recommended
Low Gas inefficiency, typos in events Optional

Audit in CI/CD

Common practice for mature protocols: Slither and Aderyn run in GitHub Actions on every PR. Certora Prover — on merge to main. This doesn't replace a full audit before deployment, but catches regressions.

# .github/workflows/audit.yml
- name: Run Slither
  uses: crytic/[email protected]
  with:
    target: 'src/'
    slither-args: '--filter-paths "test|mock|script"'
Checklist of mandatory checks before deployment
  • All external functions have access controls (onlyOwner, onlyRole)
  • Use SafeERC20 for external tokens
  • No delegatecall to unknown addresses
  • Reentrancy check in all functions with external calls
  • Presence of minAmountOut and deadline in AMM functions
  • Use of a trusted oracle (Chainlink) with deviation threshold

Audit Tools Comparison

Tool Type of Analysis What It Finds Limitations
Slither Static Reentrancy, integer overflow, access control Misses logical vulnerabilities
Mythril Symbolic execution Reachable states violating properties Path explosion on large codebases
Echidna Fuzzing (property‑based) Invariant violations Requires writing invariants
Certora Formal verification Mathematical proof of properties Doesn't work with hashes/signatures

Deliverables

  • Full report in PDF with CVSS scores for each vulnerability
  • PoC code for all Critical and High (reproducible in test environment)
  • Remediation recommendations with code examples
  • Re‑audit after fixes (up to two iterations)
  • Brief guide for developers on ongoing operation
  • Post‑deployment support for 30 days (consultations and incident analysis)

Timeline

Audit of a simple token or NFT contract — 3‑5 business days. DeFi protocol with lending/AMM — 2‑4 weeks. Full stack with multiple protocols, cross‑chain, proxy upgrades — 4‑8 weeks. Re‑audit of fixes — 3‑7 days separately.

Our team has 7+ years of experience in smart contract security, having audited over 100 projects. We guarantee we won't miss any known attack vectors — we use licensed versions of Slither and best fuzzer configurations. Assess your project — we will analyze your code for free and provide a commercial offer within 2 days. Order an audit with quality guarantee and get a discount on re‑audit for repeat customers.