Nereus Finance Hack

Reported loss $371K
Avalanche
Spot Price Manipulation

What happened

Nereus Finance, an Avalanche lending protocol that issues the NXUSD stablecoin, lost about $371,000 in a flash loan attack on September 6, 2022. The target was a recently added NXUSD market that accepted AVAX/USDC Trader Joe LP (JLP) tokens as collateral. Its oracle priced the LP token from the pool's live reserves, so for one block the attacker could make roughly $508,000 of collateral look large enough to borrow 998,000 NXUSD. After repaying a 51 million USDC flash loan from Aave, the attacker kept 371,406 USDC.

The borrowed NXUSD left about $500,000 of bad debt in the protocol. Nereus said it liquidated and paused the exploited JLP market, covered the bad debt with NXUSD from its treasury, said no user funds were at risk, and offered the attacker a 20% whitehat reward to return the funds. CertiK and PeckShield flagged the attack. The Block reported that the attacker bridged the proceeds to Ethereum, converted them to about 194 ETH and 15,800 DAI, and moved around 180 ETH through several addresses to an exchange.

Exploit transaction: 0x0ab12913f9232b27b0664cd2d50e482ad6aa896aeb811b53081712f42d54c026

CauldronV2 market: 0xc0a7a7f141b6a5bce3ec1b81823c8afa456b6930

DegenBox: 0x0b1f9c2211f77ec3fa2719671c5646cf6e59b775

JLP oracle: 0xf955a6694c6f5629f5ecd514094b3bd450b59000

How it happened

  1. The attack contract flash-borrowed 51,000,000 USDC from Aave.
  2. It swapped 280,000 USDC for WAVAX on Trader Joe, then added that WAVAX plus 260,000 USDC to the AVAX/USDC pool, receiving JLP tokens.
  3. It swapped the remaining 50,460,000 USDC for WAVAX in the same pool. This drained most of the WAVAX reserve and filled the pool with USDC.
  4. It called updateExchangeRate() on the CauldronV2 market. The JLP oracle priced each LP token as (wavaxReserve * avaxPrice + usdcReserve * usdcPrice) / totalSupply, using the manipulated reserves, so the JLP collateral was overvalued.
  5. It deposited its JLP through DegenBox and borrowed about 998,000 NXUSD against collateral worth about $508,000.
  6. It swapped the WAVAX back to USDC, swapped the NXUSD to USDC through Curve and other pools, repaid the flash loan plus a fee of about 25,000 USDC to Aave, and kept 371,406 USDC.

Protocol details

Classification Oracle Manipulation / Borrowing and Lending
Protocol Type Lending
Implementation language Solidity
Protocol links Website @nereusfinance

Build your security review skills

Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.