Cointime

Download App
iOS & Android

What Are Common Bridge Security Vulnerabilities?

This article is a community submission. The author is Minzhi He, an auditor at CertiK.

Views in this article are of the contributor/author and do not necessarily reflect those of Binance Academy.

TL;DR

Blockchain bridges are critical in achieving interoperability in the blockchain space. Hence, bridge security is of paramount importance. Some common bridge security vulnerabilities include weak on-chain and off-chain validation, improper handling of native tokens, and misconfigurations. Testing the bridge against all possible attack vectors is recommended to ensure sound verification logic.

Introduction

A blockchain bridge is a protocol connecting two blockchains to allow interactions between them. If you own bitcoin but want to participate in DeFi activity on the Ethereum network, a blockchain bridge enables you to do so without selling your bitcoin.

Blockchain bridges are fundamental to achieving interoperability within the blockchain space. They function using various on-chain and off-chain validations and therefore have different security vulnerabilities.

Why Is Bridge Security Critical?

A bridge usually holds the token a user wants to transfer from one chain to another. Often deployed as smart contracts, bridges hold a significant amount of tokens as the cross-chain transfers accumulate, making them lucrative targets for hackers.

In addition, blockchain bridges have a large attack surface as they involve many components. With that in mind, malicious actors are highly motivated to target cross-chain applications to drain large sums of funds.

Bridge attacks led to losses of over 1.3 billion USD in 2022, accounting for 36% of the year’s total losses, according to CertiK’s estimates.

Common Bridge Security Vulnerabilities

To enhance the security of bridges, it’s valuable to understand common bridge security vulnerabilities and test the bridges for them before launch. These vulnerabilities can be categorized into the following four areas.

Weak on-chain validation

For simple bridges, especially those designed for specific DApps, on-chain validation is kept to a minimum. These bridges rely on a centralized backend to execute basic operations like minting, burning, and token transfers while all verifications are performed off-chain.

In contrast, other types of bridges use smart contracts to validate messages and perform verifications on-chain. In this scenario, when a user deposits funds into a chain, the smart contract generates a signed message and returns the signature in the transaction. This signature serves as proof of the deposit and is used to verify the user's withdrawal request on the other chain. This process should be able to prevent various security attacks, including replay attacks and forged deposit records.

However, if there is a vulnerability during the on-chain validation process, the attacker can cause severe damage. For example, if a bridge uses Merkle tree to validate the transaction record, an attacker can generate forged proofs. This means they can bypass proof validation and mint new tokens to their account if the validation process is vulnerable.

Certain bridges implement the concept of “wrapped tokens.” For instance, when a user transfers DAI from Ethereum to BNB Chain, their DAI is taken from the Ethereum contract, and an equivalent amount of wrapped DAI is issued on the BNB Chain.

However, if this transaction isn’t properly validated, an attacker could deploy a malicious contract to route the wrapped tokens from the bridge to an incorrect address by manipulating the function.

The attackers also need victims to approve the bridge contract to transfer tokens using the function “transferFrom” to drain assets from the bridge contract.

Unfortunately, this is made worse because many bridges request infinite token approval from DApp users. This is a common practice that lowers gas fees but creates additional risks by allowing a smart contract to access an unlimited number of tokens from the user’s wallet. Attackers are able to exploit the lack of validation and excessive approval to transfer tokens from other users to themselves.

Weak off-chain validation

In some bridge systems, the off-chain backend server plays a critical role in verifying the legitimacy of messages sent from the blockchain. In this instance, we’re focusing on the verification of deposit transactions. 

A blockchain bridge with off-chain validation works as follows: 

  1. Users interact with the DApp to deposit tokens into the smart contract on the source chain.
  2. The DApp then sends the deposit transaction hash to the backend server via an API.
  3. The transaction hash is subject to several validations by the server. If deemed legitimate, a signer signs a message and sends the signature back to the user interface via the API.
  4. Upon receiving the signature, the DApp verifies it and permits the user to withdraw their tokens from the target chain.

The backend server must ensure that the deposit transaction it processes has actually occurred and was not forged. This backend server determines whether a user can withdraw tokens on the target chain and is, therefore, a high-value target for attackers.

The backend server needs to validate the structure of the transaction’s emitted event, as well as the contract address that emitted the event. If the latter is neglected, an attacker could deploy a malicious contract to forge a deposit event with the same structure as a legitimate deposit event. 

If the backend server does not verify which address emitted the event, it would consider this a valid transaction and sign the message. The attacker could then send the transaction hash to the backend, bypassing verification and allowing them to withdraw the tokens from the target chain.

Improper handling of native tokens

Bridges take different approaches toward handling native tokens and utility tokens. For example, on the Ethereum network, the native token is ETH and most utility tokens adhere to the ERC-20 standard.

When a user intends to transfer their ETH to another chain, they must first deposit it into the bridge contract. To achieve this, the user simply attaches the ETH to the transaction, and the amount of ETH can be retrieved by reading the “msg.value” field of the transaction.

Depositing ERC-20 tokens differs significantly from depositing ETH. To deposit an ERC-20 token, the user must first allow the bridge contract to spend their tokens. After they’ve approved this and deposited the tokens into the bridge contract, the contract will either burn the user's tokens using the "burnFrom()" function or transfer the user's token to the contract using the "transferFrom()" function.

One approach to differentiate this is to use an if-else statement within the same function. Another approach is to create two separate functions to handle each scenario. Attempting to deposit ETH using the ERC-20 deposit function can result in the loss of these funds.

When handling ERC-20 deposit requests, users usually provide the token address as input to the deposit function. This poses a significant risk as untrusted external calls can occur during the transaction. Implementing a whitelist that only includes the tokens supported by the bridge is a common practice to minimize risk. Only whitelisted addresses are allowed to be passed as arguments. This prevents external calls as the project team has already filtered the token address.

However, issues may also arise when bridges handle native token cross-chain transfer, as the native token does not have an address. A zero address (0x000...0) is representative of the native token. This can be problematic since passing the zero address to the function can bypass the whitelist verification even if implemented incorrectly.

When the bridge contract calls “transferFrom” to transfer user assets to the contract, the external call to the zero address returns false since there is no “transferFrom” function implemented in the zero address. However, the transaction may still occur if the contract does not handle the return value appropriately. This creates an opportunity for attackers to execute the transaction without transferring any tokens to the contract.

Misconfiguration

In most blockchain bridges, a privileged role is responsible for whitelisting or blacklisting tokens and addresses, assigning or changing signers, and other critical configurations. Ensuring that all configurations are accurate is crucial, as even seemingly trivial oversights can lead to significant losses.

In fact, there has been an incident where the attacker successfully bypassed the transfer record verification due to a misconfiguration. The project team implemented a protocol upgrade a few days before the hack, which involved changing a variable. The variable was used to represent the default value of the trusted message. This change resulted in all messages being automatically deemed proven, thus allowing an attacker to submit an arbitrary message and pass the verification process.

How To Improve Bridge Security

The four common bridge vulnerabilities explained above demonstrate the challenges to ensuring security in an interconnected blockchain ecosystem. There are significant considerations for handling each of these vulnerabilities, and no single playbook applies to all of them.

For example, providing general guidelines to ensure an error-free verification process is challenging since each bridge has unique verification requirements. The most effective approach to prevent verification bypass is to thoroughly test the bridge against all possible attack vectors and ensure the verification logic is sound.

To summarize, it’s essential to perform rigorous testing against potential attacks and pay special attention to the most common security vulnerabilities in bridges.

Closing Thoughts

Due to their high value, cross-chain bridges have long been a target for attackers. Builders can strengthen their bridges’ security by conducting thorough pre-deployment testing and engaging in third-party audits, reducing the risk of the devastating hacks that have plagued bridges over the last few years. Bridges are critical in a multi-chain world, but security must be a primary concern when designing and building an effective Web3 infrastructure.

Read more: https://academy.binance.com/en/articles/what-are-common-bridge-security-vulnerabilities

Comments

All Comments

Recommended for you

  • Strong Demand for AI Optical Communication Drives Lumentum Shares Up Over 10%

    On August 12, Lumentum's shares rose over 10% following strong quarterly results, leading the optical communication sector. Nokia's shares increased by over 9%, while Ciena, Fabrinet, and Tower Semiconductor saw gains of over 7%. Coherent, Credo Technology, and Corning also rose by more than 5%. The news highlights robust demand for AI optical communication, with Lumentum reporting a strong performance for its fourth fiscal quarter. During this period, net revenue more than doubled year-on-year to $1.01 billion, with adjusted earnings per share soaring 267% to $3.23 and gross margin exceeding 50%. The company's guidance for the first fiscal quarter also surpassed expectations. CEO Michael Hurlston confirmed during the earnings call that production for its major CPO customers is 'on track,' with demand signals showing an increase since the last update. The company reiterated its expectation for demand for high-power laser chips to ramp up in the second half of 2027.

  • Cloud Computing Concept Soars, CoreWeave Rises Over 23% as Earnings Validate Surge in Computing Demand

    On August 12, the cloud computing sector saw significant gains, with CoreWeave rising over 23%, NEBIUS up over 17%, IREN increasing over 8%, and Hut 8 climbing over 6%. Additionally, Oracle and Riot Platforms both rose over 3%. In terms of news, cloud computing giants' earnings have confirmed a surge in computing demand. CoreWeave reported Q2 revenue of $2.575 billion, a 112% year-over-year increase, exceeding expectations; its core revenue backlog reached approximately $104 billion. Furthermore, NEBIUS reported a 454% year-over-year increase in Q2 revenue to $582 million, with AI cloud business revenue skyrocketing by 514%, and it has raised its guidance for contracted power capacity for 2026.

  • Hyperliquid Seeks to Enter the U.S. Market

    On August 12, news emerged that Hyperliquid is looking to explore pathways to enter the U.S. market for its perpetual contracts. Currently, the platform is not open to U.S. users. Previously, the Hyperliquid Policy Center, funded by Hyper Foundation, has conducted policy research and initiatives in Washington to advocate for the establishment of a regulated access framework for on-chain perpetual contracts and decentralized market infrastructure in the U.S. (The Information)

  • Tencent President Liu Chiping Discusses Increased AI Capital Expenditure: Multiple Applications Performing Well with Clear Upside Potential

    On August 12, during Tencent's Q2 2026 earnings conference call, President Liu Chiping addressed the issue of increased capital expenditure in the second quarter. He stated that Tencent is indeed making significant investments in computing power and has already seen a clear potential for returns. Several new applications are performing well. Additionally, the computing power used for cloud leasing services is expected to bring considerable revenue growth, enhancing the return on capital expenditure. Regarding some previously placed computing power orders, if sold, they could yield profits exceeding 30% compared to the purchase price from a few months ago.

  • U.S. Stocks Open: Nasdaq Rises 0.9%, Optical Communication and Memory Chip Stocks Surge

    The Dow Jones increased by 0.3%, while the S&P 500 rose by 0.5%. CoreWeave surged approximately 21% after its Q2 revenue doubled, exceeding expectations, with backlog orders reaching $104 billion. AMD saw a rise of about 9% due to sustained demand for AI infrastructure, with last quarter's sales nearly doubling and guidance for this quarter and the new fiscal year significantly surpassing expectations. Optical communication stocks broadly increased, with Lumentum rising around 11% as strong AI optical communication demand led to a doubling of its revenue last quarter, and its guidance for this quarter also exceeded expectations, despite a debt restructuring resulting in a massive loss of over $7 billion. Marvell Technology climbed about 5%, Coherent rose about 7%, Credo increased around 7%, and Corning gained about 5%. Nebius saw an increase of approximately 15% after its Q2 revenue exceeded expectations. Memory chip stocks also broadly rose, with SK Hynix increasing by about 6%. Data showed that the U.S. core inflation in July performed moderately, which may ease pressure on the Federal Reserve to raise interest rates. The core CPI in July increased by 2.5% year-on-year, matching the lowest growth rate since March 2021 and in line with expectations, compared to a previous increase of 2.6%.

  • Spot Gold Breaks $4,440/Ounce, Reaching New High Since June 5

    Spot gold has surpassed $4,440 per ounce, marking a new high since June 5, with an intraday increase of 1.66%.

  • Nasdaq 100 Futures Rise by 1%

    Nasdaq 100 futures rose by 1%; S&P 500 futures increased by 0.5%.

  • Bank of America Plans $250 Billion Investment in U.S. Digital and Infrastructure Projects

    On August 12, Bank of America announced the launch of a critical infrastructure financing initiative, planning to invest $250 billion in U.S. digital and infrastructure projects to celebrate the 250th anniversary of the founding of the United States. The initiative aims to strengthen and modernize the nation's infrastructure, support energy security, and enhance job opportunities and economic competitiveness.

  • Ploymarket: Market Probability of Fed Rate Hike in September Drops to 34% After CPI Data Release

    According to prediction market Ploymarket, the probability of a Federal Reserve rate hike in September has dropped to 34% following the release of CPI data. This is the lowest probability for a September rate hike since July 17, and is only half of what it was on that date.

  • Goldman Sachs: Fed May Keep Rates Unchanged Throughout 2026 as Inflation Eases

    Matheus Dibo, head of investment strategy for Europe, the Middle East, and Africa at Goldman Sachs, stated that the Federal Reserve is likely to maintain interest rates unchanged throughout 2026, with inflation risks expected to ease in the second half of the year. "Clearly, the market is still digesting the expectations for interest rate hikes, but we actually disagree with this view and believe that the Fed will keep rates unchanged for the foreseeable future," Dibo said in an interview on Wednesday. He noted that the inflation data released earlier this year was influenced by oil prices, the World Cup, and tariffs, but there are currently few signs that inflation will spread throughout the remainder of 2026. Dibo added that, given trends in the housing market, housing inflation should also ease. (Bloomberg)