Back to list

Conflict in Aave and USDT Security: DeFi Risk Analysis

Конфликт в Aave и безопасность USDT: Анализ DeFi рисков

How to Protect Your Assets in DeFi: A Guide to Protocol Risk Assessment

Introduction

  • Target Audience: This article is intended for DeFi users with an intermediate to advanced technical background. It assumes the reader is familiar with the basics of Solidity, knows how to interact with smart contracts via Etherscan or libraries like ethers.js, and understands the basic principles of security audits.
  • Expected Outcome: After reading, you will be able to perform a structured preliminary security assessment of a DeFi protocol, identify key risks related to governance and technical implementation, and make more informed investment decisions.
  • Methodology Limitations: This guide does not replace a full professional audit. It does not cover areas such as formal verification, deep economic model analysis, off-chain oracle security, or client-side (frontend) vulnerabilities.

TL;DR: Key Checks Before Interacting with a Protocol

  • Audits and Reputation: Verify the existence and content of reports from reputable firms (Trail of Bits, OpenZeppelin, ConsenSys Diligence).
  • Access Rights (Admin Keys): Determine who controls critical functions. An Externally Owned Account (EOA) address is a high risk. A multisig with independent, public participants is the security standard.
  • Timelock: Ensure that critical changes (contract upgrades, ownership changes) are executed with a delay of at least 48–72 hours.
  • Code Verification: Check on Etherscan that the contract source code is verified and matches the bytecode on the blockchain.
  • Governance: Analyze recent votes on Snapshot or Tally. Look for controversial proposals regarding treasury control or changes to key parameters.
  • Transaction Simulation: Before sending funds, use simulators (Tenderly, Etherscan's built-in simulator) to verify the consequences of the transaction.

Final Checklist and Protocol Assessment Action Plan

This section combines the action plan and checklist into a single step-by-step process. Items are grouped by priority: from mandatory checks to in-depth analysis.

Step 1: Basic Verification (Mandatory)

No.Checklist ItemAction: What and How to CheckRed Flag
1.1AuditsFind reports on the project website or GitHub repository. Check who the auditor is, the report date, and which critical vulnerabilities were found and fixed.Absence of audits, audits from obscure firms, unfixed critical vulnerabilities.
1.2Code VerificationOpen the contract address on Etherscan. There should be a green checkmark on the Contract tab.Code is not verified or bytecode does not match (red warning). Stop factor.
1.3Access Rights (Admin Keys)On the Read Contract tab, find owner() or admin() functions. Determine who controls the address: an EOA or a contract.Critical functions are controlled by a single EOA address.
1.4TimelockIf the admin is a contract, check if it is a Timelock. Find its address and check the delay or minDelay parameter.Delay of less than 48 hours or no delay at all.

Step 2: In-Depth Technical Analysis (Recommended)

No.Checklist ItemAction: What and How to CheckRed Flag
2.1Multisig AnalysisIf the admin is a multisig (most often Safe), paste its address into the Safe interface. Check: 1) Threshold: signature ratio (e.g., 2/3, 4/7); 2) Signers: whether they are public figures or anonymous addresses; 3) Liveness: is there a public procedure for lost keys or signer rotation.Low threshold (2/3), anonymous signers without reputation, lack of an access recovery plan.
2.2Proxy Contract AnalysisOn Etherscan, under the Contract tab, click Read as Proxy. 1) Find implementation: this is the address of the logic contract. 2) Identify the pattern: Transparent Proxy has an admin() function that only the admin can call. UUPS Proxy delegates upgrade logic to the implementation; look for _authorizeUpgrade in the code. 3) Check who can call upgradeTo: this is the most critical function.Upgrade rights belong to an EOA without a Timelock; delegatecall is used in unsafe functions.
2.3pause FunctionLook for pause/unpause or similar functions in the code. Check who has the right to call them and if they are protected by a Timelock.Ability to instantly stop the protocol by a single address.
2.4Admin Address HistoryAnalyze the admin address transactions on Etherscan. Look for frequent, unannounced updates or other suspicious activities.Sudden changes to key parameters without community discussion.

Step 3: Economic and Systemic Risks (For Advanced Users)

This level of analysis requires a deeper understanding of DeFi architecture.

  • MEV (Front-running, Sandwich Attacks):
    • What it is: Miners or bots use their right to order transactions to extract profit, for example, by executing their trade before and after yours to profit from price changes.
    • How to check: Analyze if the protocol has functions sensitive to transaction ordering (e.g., DEX swaps). Is there slippage protection?
    • Protection: Using private RPCs (e.g., Flashbots Protect RPC) to send transactions, setting the minimum possible slippage.
  • Oracle Manipulation:
    • What it is: An attack on the price data source. An attacker manipulates the price of an asset on an exchange with low liquidity to take out an unreasonably large loan in the target protocol.
    • How to check: Identify which oracle is used (Chainlink, Uniswap V3 TWAP, etc.). Assess its resilience to flash-loan attacks. Oracles pulling prices from a single DEX are the most vulnerable.
    • Protection: Using aggregated oracles (Chainlink) or time-weighted average price oracles (TWAP).
  • Economic Exploits and Rug Pulls:
    • What it is: Using loopholes not intended in the economic model. For example, manipulating a share in a liquidity pool to gain rewards, uncontrolled token emission (infinite mint), or centralized liquidity withdrawal by the team.
    • How to check: Study the tokenomics and the token contract. Does the owner have the right to unlimited emission (mint)? Is there logic in the code allowing a single user to get a disproportionately large share of rewards?

Practical Tools and Their Application

  • Transaction Simulation:
    • Etherscan: On the page of an unconfirmed transaction (in the Mempool), a "Simulate Transaction" tab is available. For any contract, you can simulate a write function call.
    • Tenderly Dashboard: Allows creating "forks" of the mainnet and simulating complex sequences of transactions to see the final balance changes of all affected addresses. Example steps: New Simulation → Enter contract address and function parameters → Run Simulation.
  • Static Code Analysis (for Developers):
    • Slither: A tool for automatically finding vulnerabilities.
    • Example usage:
      1. Installation: pip install slither-analyzer
      2. Run in the source code directory: slither .
      3. Output analysis: Slither will highlight potential vulnerabilities such as reentrancy, unprotected-upgrade, tx.origin, and others. Link to the guide.

Detailing Key Concepts

  • Justification for the Timelock Threshold (48–72 hours): This period is considered an industry standard as it provides users with enough time to:
    1. Notice a malicious or controversial proposal.
    2. Analyze its consequences.
    3. Take action: withdraw their funds from the protocol before the change takes effect.
  • Monitoring: Transactions pending execution in the Timelock are visible on the blockchain. Projects with a high level of transparency announce them via social media.
  • Example of Controversial Governance: The Aave AIP-399 proposal (late 2023) caused debate in the community due to its potential impact on the distribution of the GHO stablecoin. Analyzing such discussions on governance forums provides insight into hidden conflicts and centralization risks.

Sources and Useful Tools

Last updated: May 24, 2024

Tags

defi risk assessment
smart contract security
aave usdt risk
governance and admin keys
defi protocol audits