Stablecoin · $150B Market · CDP / Algorithmic / Hybrid

Stablecoin Smart Contract Audit

Quick Answer

  • Stablecoin audits cover peg mechanism correctness, oracle price feed security, collateral liquidation logic, governance parameter protection, and redemption reentrancy. The $150B+ stablecoin market includes both well-audited protocols and projects with critical unreviewed logic.
  • Terra/LUNA ($40B collapse, May 2022) demonstrated mechanism design failure. Beanstalk ($182M, April 2022) demonstrated governance attack via flash loan. Both were stablecoin failures that proper auditing processes should have surfaced earlier.
  • The most dangerous stablecoin vulnerability class is oracle manipulation — it can cause mass incorrect liquidations or allow undercollateralized positions to persist. Free first scan, results in 60 seconds.

Stablecoin protocols are uniquely difficult to audit because their security depends not only on code correctness but on mechanism design soundness. A technically correct implementation of a flawed peg mechanism will fail — as Terra demonstrated at $40 billion scale. Security review must cover both the code and the economic logic.

Stablecoin Security Considerations by Type

Fiat-Backed (USDC, USDT)

Primary risks: minting/burning access control, blacklist function security, reserve attestation trust. Smart contract surface is smaller but admin key custody is the primary attack vector.

Crypto-Collateralized (DAI, LUSD)

Oracle security for collateral pricing, liquidation logic correctness, stability pool reentrancy, debt ceiling governance. The most complex smart contract surface of any stablecoin type.

Algorithmic (High Risk)

Reflexive peg mechanisms with seigniorage companions have demonstrated death spiral failure modes. Terra/LUNA wiped $40B. The mechanism design must be reviewed alongside the code — technically correct code implementing a flawed mechanism still fails.

Hybrid (FRAX, crvUSD)

Both collateral management AND algorithmic components require audit. The interaction between the two components — how the protocol shifts between full and partial collateralization — introduces additional attack surface beyond either component alone.

Audit Your Stablecoin Protocol Now

Oracle dependency, liquidation logic, governance parameter control, and peg mechanism correctness — free first scan.

Stablecoin Vulnerability Classes

VulnerabilitySeverityDescriptionExample
Oracle Price Feed ManipulationCriticalStablecoins that maintain their peg via collateral liquidations depend on accurate, manipulation-resistant price feeds. A manipulated oracle can cause either improper liquidations (when collateral is priced below true value) or allow undercollateralized positions to remain open (when collateral is priced above true value). This is the attack class that caused the bZx protocol losses ($8M, 2020) and multiple subsequent DeFi exploits.A CDP stablecoin using a spot price Chainlink feed for collateral valuation. A flash loan inflates the collateral token's price just long enough for a borrower to take out an undercollateralized loan before the price reverts.
Algorithmic Peg Spiral (Death Spiral)CriticalAlgorithmic stablecoins that use a seigniorage model (burn/mint of a companion governance token to maintain peg) are vulnerable to reflexive death spirals. When the stablecoin de-pegs below $1, the system mints more governance tokens to incentivize buying — but if confidence is lost, the newly minted tokens also lose value, accelerating the peg failure. Terra/LUNA's $40B collapse in May 2022 is the canonical example.An algorithmic stablecoin that requires 100% of its peg to be maintained by a companion token with a $200M market cap. A sudden $100M sell pressure on the stablecoin requires minting $100M of companion tokens — if the companion token market can't absorb this, both spiral to zero.
Liquidation Parameter Governance AttackHighStablecoin protocols with governance-controlled liquidation parameters (collateral ratio thresholds, liquidation penalties, interest rates) can be exploited via governance attacks. A malicious governance proposal that lowers collateral ratios or disables liquidations can allow protocol insolvency. The Beanstalk governance attack ($182M, April 2022) used a flash loan to acquire enough governance tokens to pass a malicious proposal in a single transaction.A stablecoin governance contract with no timelock on parameter changes — a proposal to change the collateral ratio from 150% to 101% passes and executes in the same block, instantly making most positions liquidatable.
Collateral Redemption ReentrancyHighStablecoin redemption functions that release collateral to burners before updating the debt accounting are vulnerable to reentrancy. An attacker who receives control flow during the collateral release can re-enter the redemption function and claim additional collateral for the same amount of burned stablecoin.A Frax-style stablecoin redemption function that sends ETH collateral to the redeemer via a callback and then reduces the stablecoin supply — an attacker using a smart contract wallet re-enters on the ETH receipt before the supply reduction.
Stale Price During Market StressMediumDuring extreme market events, Chainlink price feeds can lag real-world prices by several blocks due to heartbeat intervals and deviation thresholds. Stablecoin protocols that liquidate based on stale prices can incorrectly trigger (or fail to trigger) liquidations, causing protocol losses or preventing healthy liquidations during exactly the moments when they're most needed.A CDP stablecoin that uses a Chainlink feed with a 1-hour heartbeat. During a rapid 20% ETH price drop, the feed doesn't update for 45 minutes. Protocol continues issuing stablecoin against ETH priced at the stale rate while the actual collateral value has dropped below the required ratio.

Stablecoin Audit — Frequently Asked Questions

What types of stablecoins require smart contract security audits?
All on-chain stablecoin mechanisms require security audits: (1) Fiat-backed (USDC, USDT) — primarily custody and minting/burning access control; (2) Crypto-collateralized (DAI, LUSD) — oracle security, liquidation logic, debt ceiling governance; (3) Algorithmic (now largely discredited post-Terra) — peg mechanism correctness, death spiral resistance; (4) Hybrid (FRAX, crvUSD) — both collateral management and algorithmic stabilization logic. The $150B+ stablecoin market makes these among the highest-value audit targets.
What lessons did the Terra/LUNA collapse teach about stablecoin security?
Terra/LUNA ($40B collapse, May 2022) demonstrated that algorithmic stablecoin peg mechanisms with reflexive feedback loops have an inherent death spiral failure mode that cannot be mitigated purely through smart contract design. The underlying mechanism — burning LUNA to mint UST and vice versa — created a system where large sell pressure on UST caused LUNA supply inflation, reducing LUNA value, reducing confidence in the peg, creating more sell pressure. This is a mechanism design failure, not a smart contract bug. The security lesson: audit should include mechanism design review, not only code correctness.
How does the Beanstalk governance attack relate to stablecoin security?
The April 2022 Beanstalk hack ($182M) was a governance attack on a stablecoin protocol. An attacker used Aave to flash loan $1B in assets, acquired a supermajority of Beanstalk governance tokens in a single transaction, passed a malicious governance proposal that drained the protocol's treasury, and repaid the flash loan — all in one atomic transaction. The root cause was a governance contract that had no timelock on proposal execution, allowing a proposal to pass and execute in the same block. This attack class is relevant to any stablecoin with governance-controlled parameters.
What oracle setup is safest for stablecoin collateral pricing?
The most resilient oracle configuration for stablecoin collateral uses multiple redundant data sources with circuit breakers: primary Chainlink feed + secondary TWAP from a DEX + a maximum acceptable deviation between the two. If the sources diverge beyond a threshold, the protocol pauses liquidations until consensus is restored. LUSD (Liquity) uses a Chainlink feed with fallback to Tellor when the primary deviates, and a Uniswap TWAP as a secondary check. This multi-oracle approach is the current security best practice.
How much does a stablecoin protocol audit cost?
Stablecoin audit costs scale with protocol complexity. A simple fiat-backed stablecoin with basic mint/burn controls: $10,000–$25,000. A full CDP stablecoin (oracle integration, liquidation engine, governance, stability pool): $50,000–$200,000. Protocols with significant TVL ($10M+) or novel mechanisms typically engage multiple audit firms. DAI's Maker protocol has undergone dozens of audits totaling millions of dollars. AI-powered analysis at SmartContractAuditor.ai covers oracle dependency patterns, liquidation logic reentrancy, access control on governance functions, and flash loan attack surfaces — free for the first scan.
Written by Duron Epps, Founder of SmartContractAuditor.ai · Last updated July 2026