Decentralized finance (DeFi) protocol Onyx was exploited for $3.8 million on Sept. 26, according to a report from blockchain security platform Peck Shield. The exploit used a known bug in the Compound Finance v2 codebase, and this bug had already been used to exploit Onyx previously on Nov. 1. A vulnerability in the NFT liquidation contract also contributed to the exploit, the report stated.
In a Sept. 27 X post, the Onyx team claimed that the faulty NFT contract was the root cause of the exploit.
According to the Peck Shield report, 4.1 million virtual USD (VUSD), 7.35 million Onyxcoin (XCN), 0.23 Wrapped Bitcoin (WBTC), $5,000 worth of Dai (DAI) stablecoin and $50,000 worth of Tether (USDT) stablecoin were drained from the protocol, for a total of greater than $3.8 million of losses.
Source: Peck Shield.
The known vulnerability exists in version 2 of Compound Finance, which is a codebase often forked and used by decentralized finance protocols. It led to an exploit against Hundred Finance in April 2023. In November, the vulnerability was used against Onyx for the first time.
The flaw can only be exploited when an “empty market” or a market with no liquidity exists, which generally only happens when a new market is launched.
The Onyx team acknowledged the exploit in an X post. “Onyx Protocol was subject to a security incident where a nefarious actor exploited the protocol to drain VUSD from the protocol,” it stated. However, it claimed that the known flaw was not its primary cause. “[T]he primary issue wasn’t an empty market but the NFTLiquidation Contract,” it stated in a thread.
Peck Shield agreed that the NFT contract was “[a]nother issue that facilitates the hack.” The faulty contract allowed the attacker to “inflate the self-liquidation reward amount” because it didn’t “properly validate (untrusted) user input.”
Onyx NFT contract vulnerability. Source: Peck Shield.
DeFi exploits are a common source of losses for Web3 users. On Sept. 27, liquid staking protocol Bedrock lost over $2 million due to a vulnerability in its uniBTC contract. On Sept. 23, Bankroll Network was drained of $230,000 when an attacker made multiple self-transfers, exploiting a faulty “buyFor” function to inflate their profits.