Back to Blog

#7: ParaSpace Incident: A Race Against Time to Thwart the Industry's Most Critical Attack Yet

Code Auditing
February 17, 2024
5 min read
Key Insights

Background

On March 17, 2023, Paraspace (now Parallel Finance), an NFT lending platform, suffered a critical attack due to a vulnerability in its price oracle. Paraspace allows users to deposit NFTs and ERC-20 tokens as collateral to borrow ERC-20 tokens, enabling returns on NFTs without selling them.

Click here to read the tweet
Click here to read the tweet

A key feature of ParaSpace is ApeStaking, which auto-compounds APE rewards. Users staking APE receive cAPE tokens, a cToken representation of APE, which can be used as collateral to borrow assets like USDC and WETH. Depositing cAPE tokens grants pcAPE shares, whose collateral value is calculated by multiplying the pcAPE amount by its rebasingIndex.

The rebasingIndex is derived from the total pooled APE balance and total shares, as shown in the following code snippets:

function _scaledBalanceOf(address user, uint256 rebasingIndex)
    internal
    view
    returns (uint256)
{
    return super.scaledBalanceOf(user).rayMul(rebasingIndex);
}

function lastRebasingIndex() internal view override returns (uint256) {
  return ICApe(_underlyingAsset).getPooledApeByShares(WadRayMath.RAY);
}

function getPooledApeByShares(uint256 sharesAmount)
    public
    view
    returns (uint256)
{
    uint256 totalShares = _getTotalShares();
    if (totalShares == 0) {
        return 0;
    } else {
        return
            sharesAmount.mul(_getTotalPooledApeBalance()).div(totalShares);
    }
}

function _getTotalPooledApeBalance()
    internal
    view
    override
    returns (uint256)
{
    (uint256 stakedAmount, ) = apeStaking.addressPosition(address(this));
    uint256 rewardAmount = apeStaking.pendingRewards(
        APE_COIN_POOL_ID,
        address(this),
        0
    );
    return stakedAmount + rewardAmount + bufferBalance;
}

The _getTotalPooledApeBalance() function sums the staked APE tokens, pending rewards, and a buffer balance from the ApeCoinStaking contract.

Vulnerability Analysis

The vulnerability lies in the manipulation of the rebasingIndex, which artificially inflates the collateral value of cAPE tokens. Specifically, the depositApeCoin() function in the ApeCoinStaking contract increases the stakedAmount for a position. An attacker can exploit this by depositing APE tokens into the cAPE position, inflating the output of _getTotalPooledApeBalance() and thus the rebasingIndex.

function depositApeCoin(uint256 _amount, address _recipient) public {
    if (_amount < MIN_DEPOSIT) revert DepositMoreThanOneAPE();
    updatePool(APECOIN_POOL_ID);

    Position storage position = addressPosition[_recipient];
    _deposit(APECOIN_POOL_ID, position, _amount);

    apeCoin.transferFrom(msg.sender, address(this), _amount);

    emit Deposit(msg.sender, _amount, _recipient);
}

function _deposit(uint256 _poolId, Position storage _position, uint256 _amount) private {
  Pool storage pool = pools[_poolId];
  _position.stakedAmount += _amount;
  pool.stakedAmount += _amount.toUint96();
  _position.rewardsDebt += (_amount * pool.accumulatedRewardsPerShare).toInt256();
}

This design flaw allows the attacker to inflate the collateral value by depositing APE tokens through depositApeCoin() with cAPE as the recipient.

Attack Analysis

The attacker exploited this vulnerability using a flash loan attack in five key steps:

  1. Obtained a flash loan of approximately 47,352 wstETH and supplied about 46,018 wstETH to borrow cAPE via multiple contracts.
  2. Deposited roughly 12,880,000 cAPE tokens as collateral.
  3. Traded approximately 1,205 wstETH for about 492,124 APE tokens and withdrew 1,839,999 cAPE to APE tokens.
  4. Deposited 2,332,214 APE tokens into the cAPE position by calling ApeCoinStaking.depositApeCoin(), increasing the protocol’s stakedAmount from 851,662 to 3,183,876 (a 373% increase).
  5. Leveraged the inflated collateral to borrow large amounts of assets such as USDC and WETH for profit.

This manipulation of the pcAPE price via flash loans exploited the use of spot prices in the oracle calculation.

Get Started with Phalcon Security

Detect every threat, alert what matters, and block attacks.

Try now for free

Summary

The ParaSpace incident underscores the risks of oracle manipulation and flash loan attacks in DeFi protocols. It highlights the critical need for robust, manipulation-resistant price oracles and continuous security monitoring beyond pre-launch audits.

BlockSec’s Phalcon Security system demonstrated the value of active threat detection and prevention by automatically blocking the attack and protecting user assets. This incident serves as a reminder for DeFi protocols to implement comprehensive security measures, including smart contract audits, infrastructure audits, and real-time monitoring.

For more insights on DeFi security incidents and best practices, explore our Security Incident Library and consider our Smart Contract Audit and Infrastructure Audit services.

Explore MetaSleuth Investigation

Trace flows and build evidence for investigations

Try now for free

Best Security Auditor for Web3

Validate design, code, and business logic before launch

Sign up for the latest updates
The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis
Security Insights

The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis

This BlockSec deep-dive analyzes the KelpDAO $290M rsETH cross-chain bridge exploit (April 18, 2026), attributed to the Lazarus Group, tracing a causal chain across three layers: how a single-point DVN dependency enabled the attack, how DeFi composability cascaded the damage through Aave V3 lending markets to freeze WETH liquidity exceeding $6.7B across Ethereum, Arbitrum, Base, Mantle, and Linea, and how the crisis forced decentralized governance to exercise centralized emergency powers. The article examines three parameters that shaped the cascade's severity (LTV, pool depth, and cross-chain deployment count) and provides an exclusive technical breakdown of Arbitrum Security Council's forced state transition, an atomic contract upgrade that moved 30,766 ETH without the holder's signature.

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026

This BlockSec weekly security report covers four attack incidents detected between April 13 and April 19, 2026, across multiple chains such as Ethereum, Unichain, Arbitrum, and NEAR, with total estimated losses of approximately $310M. The highlighted incident is the $290M KelpDAO rsETH bridge exploit, where an attacker poisoned the RPC infrastructure of the sole LayerZero DVN to fabricate a cross-chain message, triggering a cascading WETH freeze across five chains and an Arbitrum Security Council forced state transition that raises questions about the actual trust boundaries of decentralized systems. Other incidents include a $242K MMR proof forgery on Hyperbridge, a $1.5M signed integer abuse on Dango, and an $18.4M circular swap path exploit on Rhea Finance's Burrowland protocol.

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026

This BlockSec weekly security report covers four DeFi attack incidents detected between April 6 and April 12, 2026, across Linea, BNB Chain, Arbitrum, Optimism, Avalanche, and Base, with total estimated losses of approximately $928.6K. Notable incidents include a $517K approval-related exploit where a user mistakenly approved a permissionless SquidMulticall contract enabling arbitrary external calls, a $193K business logic flaw in the HB token's reward-settlement logic that allowed direct AMM reserve manipulation, a $165.6K exploit in Denaria's perpetual DEX caused by a rounding asymmetry compounded with an unsafe cast, and a $53K access control issue in XBITVault caused by an initialization-dependent check that failed open. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Best Security Auditor for Web3

Validate design, code, and business logic before launch. Aligned with the highest industry security standards.

BlockSec Audit