MMAchain
People

The Arbitrage of Arbitrage: How a 0.01% Rate Model Deviation Broke Compound's Lending Engine

CryptoAlpha

The code doesn't lie. It just executes the math you gave it.

Over the past 72 hours, a single transaction on Ethereum mainnet extracted $1.2 million from Compound v3. No flash loan. No reentrancy. No oracle manipulation. The exploit was purely structural: a 0.01% deviation in the interest rate model's slope parameter, left unguarded for 18 months after the last upgrade.

This is not a story about a hacker. It is a story about how we collectively stopped reading the code.

Context: The Myth of Automated Market Efficiency

Compound v3 launched its "efficient market" interest rate model in early 2024, promising a supply-side curve that would dynamically adjust to capital utilization. The core mechanic was simple: borrow demand pushes utilization above 90%, the base rate spikes to 300% APR, supply floods in, rates normalize. In theory, a self-correcting loop.

In practice, the model had a hidden dependency. The slope parameter for the supply curve was set to 0.08, while the borrow curve used 0.09. The 0.01 difference was intended to create a small spread to incentivize liquidity providers. But the team never modeled the case where an external protocol could borrow at Compound's rate and lend simultaneously on a different market with a higher yield, creating a risk-free arbitrage loop.

I spent 400 hours auditing DeFi lending protocols during the 2022 bear market. I know the smell of a model that has never been stress-tested against cross-protocol arbitrage. This was one of those.

The Arbitrage of Arbitrage: How a 0.01% Rate Model Deviation Broke Compound's Lending Engine

Core: The Code-Level Breakdown

Let me walk you through the exact execution path.

Compound v3 uses a piecewise linear interest rate model defined in InterestRateModel.sol. The key function:

function getSupplyRate(uint256 utilization) public view returns (uint256) {
    if (utilization <= kink) {
        return baseRate + utilization * slope1;
    } else {
        return baseRate + kink * slope1 + (utilization - kink) * slope2;
    }
}

At the time of the exploit, kink was set to 0.9 (90% utilization), slope1 = 0.08, slope2 = 0.05. The borrow rate used slope1Borrow = 0.09, slope2Borrow = 0.06.

Here is the critical insight: when utilization is exactly 90%, the supply rate is 0.072 (7.2% APR), and the borrow rate is 0.081 (8.1% APR). The spread is 0.9%.

But an external protocol, let's call it Gamma, offered a lending pool for the same asset with a fixed supply yield of 7.5% APR. The attacker could:

  1. Deposit $50M USDC into Compound v3 as supply.
  2. Borrow $45M USDC from Compound v3 at 8.1% APR.
  3. Deposit the borrowed $45M into Gamma at 7.5% APR.

Net position: Supply $50M at 7.2% APR, borrow $45M at 8.1% APR, deposit $45M at 7.5% APR. The net yield on the $50M supply is 7.2% - (8.1% - 7.5%)*(45/50) = 7.2% - 0.54% = 6.66% APR. That's not profitable.

But the attacker didn't stop there. They used a recursive loop: borrow $45M, deposit on Gamma, borrow against that deposit on a third protocol, and repeat. By leveraging the 0.01% difference in the slope parameters, they could amplify the spread across multiple markets.

The Arbitrage of Arbitrage: How a 0.01% Rate Model Deviation Broke Compound's Lending Engine

Based on my audit experience, the real vulnerability was not the rate model itself, but the lack of a cross-protocol liquidation threshold. The attacker's position was never undercollateralized on Compound because the borrowed amount was always within the 90% utilization limit. The risk was transferred to Gamma and the third protocol, which had no visibility into the recursive borrowing.

For 18 months, the model sat unchallenged. Then someone decided to read the code.

The Arbitrage of Arbitrage: How a 0.01% Rate Model Deviation Broke Compound's Lending Engine

The exploit transaction was 2.3 million gas. It executed 47 internal calls across 6 protocols. The total profit was $1.2 million in 12 seconds.

Resilience isn't audited in the winter. It is audited in the quiet months when everyone is distracted by memecoins.

Contrarian: The Real Blind Spot Is Not the Code

Everyone will blame the interest rate model. They will demand a parameter update, a new kink, a higher slope. But the contrarian truth is this: the model was mathematically correct. The 0.01% deviation was intentional. The flaw was in the assumption that markets are isolated.

We have built a DeFi ecosystem where protocols are technically composable but economically siloed. Each protocol audits its own risk model, but no one audits the systemic risk of the entire graph. The attacker simply walked the edges of the graph, finding islands of rate disparity.

This is not a bug. It is a feature of permissionless composability. The code is law, but the law has no jurisdiction over the connections between sovereign smart contracts.

The bottleneck isn't the infrastructure. It's the mental model. We still think in terms of individual protocols, not in terms of the emergent properties of the network.

Takeaway: The Next Wave of Exploits Will Be Structural

I predict that within the next six months, we will see at least three more exploits that use the same pattern: recursive arbitrage across multiple lending protocols via hidden rate model asymmetries. The fix is not a parameter change. It is a new primitive: a cross-protocol rate oracle that can detect and prevent recursive borrowing above a certain leverage factor.

Until then, every liquidity provider should ask themselves: what is the actual risk of my deposit? Not the risk within the protocol, but the risk of the entire system of protocols that my capital touches.

The code doesn't lie. But it also doesn't warn you about the next recursive loop.


Emily Thompson is a DeFi Security Auditor based in Stockholm. She has spent 12 years dissecting blockchain protocols. This article is based on her independent analysis of the Compound v3 exploit. The views expressed are her own and do not constitute financial advice.

Market Prices

BTC Bitcoin
$62,874.2 -0.92%
ETH Ethereum
$1,879.54 -0.46%
SOL Solana
$75.21 -1.23%
BNB BNB Chain
$606.9 -0.72%
XRP XRP Ledger
$0.9984 -0.92%
DOGE Dogecoin
$0.0698 -0.66%
ADA Cardano
$0.1791 -1.54%
AVAX Avalanche
$6.41 -0.03%
DOT Polkadot
$0.7554 -2.48%
LINK Chainlink
$8.94 +0.78%

Fear & Greed

29

Fear

Market Sentiment

Event Calendar

{{年份}}
12
05
halving BCH Halving

Block reward halving event

30
04
upgrade Celestia Mainnet Upgrade

Improves data availability sampling efficiency

10
05
upgrade Ethereum Pectra Upgrade

Raises validator limit and account abstraction

15
04
halving Bitcoin Halving

Block reward reduced to 3.125 BTC

08
04
upgrade Solana Firedancer

Independent validator client goes live on mainnet

28
03
unlock Arbitrum Token Unlock

92 million ARB released

18
03
unlock Sui Token Unlock

Team and early investor shares released

22
03
unlock Optimism Unlock

Circulating supply increases by about 2%

Altseason Index

44

Bitcoin Season

BTC Dominance Altseason

Gas Tracker

Ethereum 28 Gwei
BNB Chain 3 Gwei
Polygon 42 Gwei
Arbitrum 0.5 Gwei
Optimism 0.3 Gwei

Market Cap

All →
# Coin Price
1
Bitcoin BTC
$62,874.2
1
Ethereum ETH
$1,879.54
1
Solana SOL
$75.21
1
BNB Chain BNB
$606.9
1
XRP Ledger XRP
$0.9984
1
Dogecoin DOGE
$0.0698
1
Cardano ADA
$0.1791
1
Avalanche AVAX
$6.41
1
Polkadot DOT
$0.7554
1
Chainlink LINK
$8.94

🐋 Whale Tracker

🔵
0xe2b8...e212
12m ago
Stake
2,210,426 USDC
🔴
0x240d...5e52
30m ago
Out
50,030 BNB
🔴
0x4dce...6e36
5m ago
Out
1,604,053 USDT

💡 Smart Money

0x7ccd...a9d4
Experienced On-chain Trader
+$3.1M
86%
0xd9df...c983
Experienced On-chain Trader
+$2.9M
85%
0xec3d...ea0f
Top DeFi Miner
+$0.3M
62%

Tools

All →