Back to Blog
RedVoltDeFiCase Study

How We Audited a $50M DeFi Protocol in 10 Days

February 6, 20266 min readRedVolt Team

When a DeFi lending protocol with $50M in TVL approached us for a security audit, they had a problem: they needed the audit done before their governance vote in two weeks. Traditional audit firms quoted 4-8 weeks. We did it in 10 days.

Here's exactly how.

The Protocol

A lending/borrowing protocol on Ethereum mainnet with:

  • 12 core Solidity contracts (~4,500 lines of code)
  • Integration with Chainlink oracles, Uniswap V3, and Aave flash loans
  • Upgradeable proxy pattern (UUPS)
  • Custom liquidation engine with partial liquidations
  • Governance module with timelock

$50M

TVL at Audit Time

4,500

Lines of Solidity

12

Core Contracts

10 days

Total Audit Time

Day 1-2: AI Analysis Phase

Our AI agents ran first, performing the mechanical analysis that traditionally takes human auditors 3-5 days:

AI

Static Analysis

Slither, Mythril, and custom rule engines scanned all contracts for known vulnerability patterns

AI

Dependency Mapping

Automated cross-contract call graph analysis to identify all external interactions and trust boundaries

AI

Storage Analysis

Verified upgrade storage compatibility and checked for initialization vulnerabilities

AI

Pattern Matching

Compared code against a database of known DeFi exploits to identify similar patterns

AI phase results:

  • 8 potential findings flagged for human review
  • 23 items classified as informational/gas optimization
  • Full cross-contract interaction map generated
  • Oracle integration points identified and cataloged
  • All access control modifiers mapped

As we described in How RedVolt Combines AI with Human Expertise, the AI phase doesn't just find bugs — it builds a complete mental model of the protocol that human auditors can start from.

Day 3-8: Human Expert Deep-Dive

Two senior auditors started with the AI's output — already knowing the architecture, the trust boundaries, and the flagged areas:

What We Focused On

Expert Focus Areas

Liquidation engine

The custom partial liquidation logic was the most complex code in the protocol. Flash loan-powered liquidations, liquidation incentive calculations, and bad debt handling all required deep manual analysis.

Oracle integration

The protocol used Chainlink with a Uniswap V3 TWAP fallback. We tested for manipulation resistance, staleness handling, and edge cases when the fallback activates.

Interest rate model

The dynamic interest rate curve had precision-sensitive calculations. We verified that no rounding errors could be exploited to drain the protocol over time.

Governance and upgrades

The timelock, proposal execution, and UUPS upgrade mechanism were tested for bypass opportunities and flash loan governance attacks.

The Critical Findings

1

Finding #1: Oracle Manipulation (Critical)

The Uniswap V3 TWAP fallback used a 10-minute window. We demonstrated that with $2M in flash-loaned capital, the TWAP could be moved enough to trigger incorrect liquidations — profiting the attacker ~$800K per attack.

2

Finding #2: Partial Liquidation Rounding (High)

The partial liquidation calculation rounded in the liquidator's favor. By performing many small partial liquidations, a liquidator could extract ~0.3% more collateral than intended. Over time and across many positions, this drained the protocol's solvency buffer.

3

Finding #3: Flash Loan Re-Entrancy (High)

The repay function didn't follow checks-effects-interactions for Aave flash loan callbacks. An attacker could re-enter during repayment to manipulate their health factor, borrowing more than their collateral should allow.

4

Finding #4: Governance Timelock Bypass (Medium)

Emergency proposals could be executed with a shorter timelock (6 hours instead of 48). The threshold for "emergency" was set by the proposer — any proposal could be marked as emergency.

These findings aligned with the most common DeFi vulnerability patterns we see — oracle manipulation, precision loss, reentrancy, and access control gaps. The AI flagged the first three as areas of interest; the human auditors confirmed exploitability and calculated the economic impact.

Day 9-10: Report and Remediation

01

Report Delivery

Comprehensive report with all findings, proof-of-concept Foundry tests, severity ratings, and remediation guidance

02

Debrief Call

2-hour walkthrough with the protocol team — explaining each finding and discussing fix approaches

03

Quick Fixes

Team implemented fixes for critical and high findings within 48 hours

04

Re-Audit

We verified all fixes in a 1-day re-audit pass

Final Report Summary

4

Critical

3

High

5

Medium

11

Low / Info

Finding / Severity

  • Oracle TWAP manipulation — Critical
  • Partial liquidation rounding — High
  • Flash loan reentrancy — High
  • Governance timelock bypass — Medium
  • Missing event emissions — Low
  • Gas optimizations (7) — Info

Found By / Fixed

  • AI flagged, human confirmed — Fixed
  • Human — Fixed
  • AI flagged, human confirmed — Fixed
  • Human — Fixed
  • AI — Fixed
  • AI — Partial

Why 10 Days Instead of 8 Weeks

Traditional Audit (8 weeks)

  • Week 1-2: Auditor studies codebase and architecture manually
  • Week 3-4: Manual static analysis and known pattern checking
  • Week 5-6: Deep manual testing of complex logic
  • Week 7-8: Report writing and review

RedVolt AI-Assisted (10 days)

  • Day 1-2: AI handles architecture mapping, static analysis, and pattern detection
  • Day 3-8: Auditors start at full context — deep-dive into complex logic immediately
  • Day 9: Report generation (automated template + human analysis)
  • Day 10: Fix verification

The AI didn't replace the human auditors — it eliminated the 2-3 weeks of mechanical work that didn't require their expertise. They spent 100% of their time on the complex analysis that actually found the critical issues.

This is exactly the approach we described in Why AI-Assisted Security Auditing Finds More Vulnerabilities — AI breadth combined with human depth.

ℹ️The Outcome

The protocol team fixed all critical and high findings before their governance vote. They launched on schedule with a clean audit report. Six months later, the protocol holds $120M in TVL with zero security incidents.


Need a fast, thorough DeFi audit? Our Smart Contract Auditor combines AI analysis with expert human review to deliver comprehensive audits in days, not months. Request a quote.

Want to secure your application or smart contract?

Request an Expert Review