Conic Finance: A Post Mortem of $3.2 million De-Fi attack | BlockAudit

BlockAudit
5 min readAug 2, 2023

--

Conic Finance, a liquidity pool platform designed to work with the DeFi protocol Curve, has fallen victim to an exploit on the ETH Omnipool, resulting in a staggering loss of $3.26 million worth of Ether. The incident was reported on July 21, 2023, and is characterised as a reentrancy attack

Conic Finance: An Overview

Conic Finance aims to balance liquidity in the DeFi space, facilitating efficient trading and asset swaps for users within the Curve ecosystem.

Vulnerability Analysis and its Impact

Details of the Attack:

Peckshield.Inc’s Twitter account reported that the initial analysis of the malicious transaction in Conic Finance’s recent exploit points to the new CurveLPOracleV2 contract as the root cause. The analysis is based on data available on Etherscan (Ethereum Transaction Hash (Txhash) Details | Etherscan). It’s worth noting that Peckshield.Inc had previously identified a similar read-only reentrancy issue, but the CurveLPOracleV2 contract, which also exhibited the same problem, was not included in the scope of their audit.

“Our audit identifies a similar read-only reentrancy issue. However, the same issue is introduced in the newly introduced CurveLPOracleV2 contract, which was not part of the audit scope,” Peckshield wrote.

What’s the problem with the code?

The Conic Finance protocol implements a Conic Omnipools, which allocate liquidity in a single asset across multiple Curve Pools, giving liquidity providers exposure to multiple Curve Pools through a single Conic LP token. The withdraw() routine in the ConicPool contract allows liquidity providers to withdraw the underlying token.

This hints at a possible issue introduced into new CurveLPOracle V2.

Flow of Funds Attack Summary:

Transactions on the address involving a flashloan exploit on Coin ETH Pool.

Source: Etherscan

Here’s a breakdown of the flow of funds from each malicious contract to different exploiters, and then the subsequent loss to Tornado Cash:

1. Malicious Contract 1 — Exploitation of ETH Omnipool:

- The attacker utilized a read-only reentrancy vulnerability in the new CurveLPOracleV2 contract, part of Conic Finance’s protocol.

- They initiated a flash loan of 20,000 staked ether (stETH).

- With the flash loan, the attacker manipulated the price of rETH Curve LP tokens through a series of swaps.

- As a result, they were able to mint a significantly higher amount of cncETH tokens than expected.

- Repeating this exploitative pattern multiple times, they deposited and withdrew funds at a favorable exchange rate, draining 1,727 ETH from the ETH Omnipool.

- The stolen funds were then transferred to an associate address controlled by the attacker.

2. Malicious Contract 2 and 3 — Attack on crvUSD Omnipool:

- After the initial attack on the ETH Omnipool, the attacker targeted the crvUSD Omnipool, which is also controlled by Conic Finance.

- However, the Conic Finance team was alerted to the threat, and the damage was limited to a loss of 13.58 ETH in this attack, 11.56 ETH from Malicious contract 2 and 2.02 ETH from Malicious contract 3.

- Subsequently, the attacker moved 9 ETH to Tornado Cash as part of their maneuvers.

Loss to Tornado Cash:

- Tornado Cash is a privacy-focused protocol that allows users to deposit and withdraw funds in a way that helps obfuscate the transaction history.

- The attacker transferred 9 ETH to Tornado Cash in an attempt to further conceal the stolen assets and make them harder to trace.

- This loss of 9 ETH represents a portion of the funds stolen during the attack that was moved to Tornado Cash.

It’s important to note that the total loss suffered by Conic Finance due to the exploitation of the read-only reentrancy vulnerability is approximately $3.26 million worth of Ether. The attacker skillfully exploited the vulnerability, manipulated token prices, and utilized flash loans to execute the attacks, highlighting the need for robust security measures in De-Fi protocols to prevent such incidents in the future.

Diagram to explain breakdown of flow of funds

Updates from Conic Finance and aftermath

Conic Finance was quick to provide updates and brief insights into the root cause which is a positive step. After what appeared to be the second attack, Curve Finance urged users to remove all funds from Conic Finance. It took steps to safeguard its users by shutting down all deposits across omnipools.

The aftermath of the attack on Conic Finance has highlighted the inherent risks associated with complex smart contracts and intricate financial mechanisms in the DeFi space. While these innovations have brought about revolutionary advancements, they also leave potential points open that attackers can exploit. The substantial financial damage suffered by Conic Finance serves as a stark warning to other DeFi protocols relying on price oracles from third-party contracts. It underscores the urgent need for the DeFi industry to prioritise security measures, conduct thorough audits, and implement robust mechanisms to protect user funds and maintain trust in the rapidly evolving decentralised finance ecosystem.

Conic FInance first status update via Twitter

Recommended Mitigation:

Reentrancy mitigation is of utmost importance in securing smart contracts in the DeFi space. One effective approach is the implementation of a reentrancy guard, which prevents multiple recursive calls to critical functions and helps safeguard against reentrancy attacks. A reentrancy guard is a modifier which can be placed on functions like withdraw() as shown above too. Additionally, conducting thorough security audits and penetration testing is crucial to identify and address potential vulnerabilities before deployment. Collaborating with reputable firms like BlockAudit can provide the best quality of audit services, ensuring a comprehensive review of the smart contract’s code and security measures. By adopting these mitigation strategies, DeFi protocols can enhance their resilience against attacks, protect user funds, and foster greater confidence among users and investors in the DeFi ecosystem.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

BlockAudit
BlockAudit

Written by BlockAudit

BlockAudit is pioneer Blockchain security company. Our mission is to secure your project from all possible security threats.

No responses yet

Write a response