Skip to content
Smart contracts Write-up Advanced

Onyx, HopeLend, Beluga: Division Bugs and Liquidity Games

Several DeFi protocols suffered losses from rounding errors and price manipulation. Attackers used flash loans to manipulate token prices and exploit division truncation to profit.

medium.com

Published on medium.com

Onyx lost $2.1M to a rounding exploit; HopeLend followed with an $819K hit from a truncated division error. Beluga Protocol and MicDAO repeated the same supply manipulation routine: burn tokens, pump price, exit.

Olympix, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely integer division truncation and flawed accounting logic in smart contracts allowed attackers to manipulate exchange rates and token supplies.

What the attacker needed

Access to flash loans; vulnerable smart contract

How it was found

  1. Borrow funds via flash loans.
  2. Donate or burn tokens to manipulate price or exchange rate.
  3. Exploit the inflated rate to borrow or sell at a profit.
  4. Repay flash loan and keep profit.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

These are bugs in smart contracts, the code that runs on blockchains. A rounding error happens when a program does division and drops small decimal amounts, which attackers can exploit to steal funds. Price manipulation involves artificially changing a token's price to buy or sell at unfair rates.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.