Decoding vETH Token’s $450K Exploit

Updated at: December 25, 20245 Mins Read

Author:QuillAudits Team

Overview

On November 14, 2024, the vETH token was exploited due to a business logic error in its lending mechanism. This exploit resulted in a loss of approximately $450k USD. The attack targeted interactions between the vETH token’s takeLoan function and a liquidity-adding function in the Factory contract, which manipulates the state of Uniswap pairs. The attacker leveraged this flaw to acquire vETH tokens without incurring the intended cost.

About Project

The vETH token (VirtualToken) is an ERC-20 token designed to facilitate token lending, wrapping, and unwrapping functionalities. It features a controlled loan mechanism, allowing only authorized factory contracts to call its takeLoanfunction and manage user debt. The token also integrates access control through a whitelist and factory mechanism, ensuring that interactions are limited to approved entities.

Exploit Details

Attacker Address: 0x713d2b652e5f2a86233C57Af5341Db42a5559Dd1 Attacker Contract: 0x351D38733DE3f1E73468d24401c59F63677000C9

Vulnerable Contract: 0x280A8955A11FcD81D72bA1F99d265A48ce39aC2E

Attack Transaction: 0x900891, 0x90db33, 0x1ae40f

Attack Process:

  1. The attacker started attack by taking a flash loan of 32,560 of Wrapped ETH (WETH) from the balancer vault.

    image.png
  2. The attacker identified a function in the Factory contract capable of calling the takeLoan function from the vETH token contract.
  3. This function was intended to manage liquidity by borrowing vETH against user deposits.

    image.png
  4. The attacker exploited this function to interact with Uniswap V2 pairs (e.g., vETH-BIF). By leveraging user BIF tokens, the function added liquidity to the pair and increased the pool’s constant x*y =k.
  5. During this liquidity addition, the state of the Uniswap pool was manipulated. The attacker gained vETH tokens as a result of the inflated pool state, bypassing the intended costs.

    image.png
  6. The attacker executed this process across multiple Uniswap V2 pairs, including vETH-BIF, vETH-Cowbo, and vETH-BOVIN.

    image.png
    image.png

    The attacker converted the gained vETH tokens to other assets, extracting approximately $450,000.

The Root Cause

The root cause of the hack was a flawed interaction between the takeLoan function in the vETH contract and the liquidity-adding function in the Factory contract. This function allowed state manipulation of Uniswap pools, enabling the attacker to inflate the pool's constant product and mint vETH without proper cost. 

Flow of Funds

See the funds flow here

image.png

How could they have prevented the Exploit?

  1. The Factory contract should have included strict checks to ensure that adding liquidity to Uniswap pools does not inadvertently manipulate the pool's constant product or allow unintended gains.
  2. The takeLoan function should have incorporated additional checks to validate the context and intent of its calls, ensuring it could not be exploited through liquidity-adding operations.
  3. Collaborate with reputable auditors like QuillAudits to analyse smart contracts and identify vulnerabilities.

Why QuillAudits?

Choosing a reputable audit firm like QuillAudits ensures that your protocol undergoes rigorous scrutiny from experienced security professionals. QuillAudits specializes in uncovering critical vulnerabilities and providing actionable remediation strategies. Our expertise helps safeguard your project from attacks, ensuring that security issues are addressed proactively.

QuillAudits Team

QuillAudits Team

The QuillAudits team, comprises of expert security researchers & auditors in Web3 security, has completed 1,000+ audits across Ethereum, Polygon, Solana, Arbitrum, BSC, and more, securing $30B+ with 0 exploits, advancing the blockchain ecosystem.

TwitterLinkedInTelegram

Get an audit done today for your
Smart Contract

Join 1000+ leaders who secured themselves from losing Billion Dollars.

Request An Audit

Subscribe to our Newsletter

Get Pure Alpha Straight to Your Inbox. Miss this, and you’re missing out. Insider Secrets - Delivered Right to You. Subscribe now.

Telegram