Bedrock is a multi-asset liquidity re-hypothecation protocol that allows the collateralization of assets like wBTC, ETH, and IoTeX through its non-custodial platform. It was developed in collaboration with RockX and supports re-hypothecation/collateralization for multiple digital assets, such as uniBTC (wrapped BTC), uniETH, and uniIOTX, offering unique opportunities for users to earn rewards on their staked assets.
Despite its promising architecture, the protocol suffered a devastating exploit on the Ethereum chain that resulted in a significant financial loss. This hack led to a total profit of 649.6 WETH, equivalent to approximately $1.7 million, for the attacker. In this report, we will analyze the attack methodology, and the technical flaws that were exploited, and provide recommendations for enhancing the protocol’s security
On October 7, 2024, the Bedrock Protocol experienced a breach that led to the extraction of 649.6 WETH from the system by the attacker, who exploited a flaw in the uniBTC minting mechanism. The attack leveraged a miscalculation in the exchange rate between WETH and uniBTC, which caused the system to mint uniBTC at a drastically incorrect ratio of 1:1 (ETH to BTC), despite the large difference in value between the two. As a result, the attacker was able to inflate their holdings significantly and drain the project’s liquidity.
The attack began with the attacker borrowing 30.8 WETH via a flashloan through Balancer. Flashloans allow users to borrow assets without collateral as long as the loan is repaid within the same transaction. This capital would serve as the initial fuel for executing the exploit.
Next, the attacker exploited a flaw in Bedrock’s mint function. By calling the mint function in the Bedrock Vault contract, the attacker transferred the borrowed 30.8 ETH to the Vault, triggering the following line of code:
The mint function internally calls the _mint function:
In this mint function, Bedrock’s internal logic failed to handle the exchange rate between WETH and uniBTC correctly. Here’s how:
With the exchange rate being completely skewed (ETH being worth much less than BTC), the attacker minted 30.8 uniBTC by depositing 30.8 WETH. The ratio should have been far higher, but the vulnerability allowed the attacker to receive one uniBTC for each WETH they deposited.
Once the attacker had 30.8 uniBTC, they quickly exchanged it through Uniswap. First, they swapped 30.8 uniBTC for 27.8 WBTC (wrapped Bitcoin), using Uniswap’s pools. Then, they swapped the 27.8 WBTC for 680.4 WETH. After repaying the original 30.8 WETH flashloan, the attacker walked away with 649.6 WETH in profit, which is approximately $1.7 million.
To gain a deeper understanding of the uniBTC exploit, you can replicate the attack by following the proof of concept (PoC) available here . The PoC includes detailed, step-by-step instructions on how the vulnerability in the uniBTC Vault contract was exploited. By simulating the attack, you can observe the exploit process and gain insights into the attack dynamics and its impact.
The exploit involving the uniBTC protocol resulted in the theft of significant funds, primarily involving token swaps on Uniswap V3. The attacker executed the following key transactions:
The attacker borrowed 30.8 WETH via flashloan and used it to exploit the uniBTC minting mechanism, ultimately exchanging their minted uniBTC for WETH. After repaying the original flashloan, the attacker ended up with 649.6 WETH. The rapid conversion and liquidation of uniBTC and WBTC into WETH allowed the attacker to drain Bedrock’s liquidity without leaving a trace of the compromised assets in the system.
The Bedrock Protocol hack underscores the critical importance of implementing stringent security measures and thorough audits within DeFi platforms. While designed to enable innovative financial operations, the protocol’s vulnerabilities were exploited, leading to significant financial losses. This incident highlights that even advanced and well-structured systems can be compromised if security isn’t prioritized.
As DeFi continues to grow, safeguarding smart contracts and ensuring that proper validation mechanisms are in place must remain at the forefront. Rigorous input validation, meticulous handling of exchange rates, and regular, comprehensive audits are essential for protecting user assets and maintaining trust within the ecosystem.
Organizations specializing in smart contract audits, such as BlockApex, play a crucial role in identifying and mitigating vulnerabilities before they can be exploited. The Bedrock Protocol hack serves as a powerful reminder of the need for constant vigilance and robust security protocols to ensure the ongoing stability and success of decentralized financial systems.
ADOT Finance integrates a blockchain-based marketplace and bridging system that facilitates the exchange and creation…
What is Berachain? Berachain is a high performance, EVM-identical Layer 1 blockchain leveraging Proof of…
On September 3, 2024, Onyx DAO, a protocol derived from Compound Finance, suffered a severe…
The cryptocurrency world continues to expand rapidly, offering new investment opportunities almost daily. One of…
In today's digital age, where data is the new currency, safeguarding sensitive information has become…
Overview of Penpie Protocol Penpie is a next-generation DeFi platform integrated with Pendle Finance, designed…
This website uses cookies.