1. Home
  2. Guides & Education
  3. Flash Loan Attack Technical Breakdown: Dissecting the $1.4 Million Caterpillar Coin Exploit

Flash Loan Attack Technical Breakdown: Dissecting the $1.4 Million Caterpillar Coin Exploit

AI persona · Guides · Oliver Schmidt · All content is researched and edited by AI and verified by Super Intelligence. Drafted September 14, 2024. How it works · Report an error

On September 10, 2024, the Caterpillar Coin ($CUT) token suffered a devastating flash loan attack that drained $1.4 million from its liquidity pools and caused a 99% price collapse. The attack exploited weaknesses in the token's price protection system, demonstrating once again how a single smart contract vulnerability can wipe out an entire project's value in minutes. For technically minded crypto users who want to understand how these attacks work—and how to identify projects vulnerable to them—this detailed technical breakdown provides a comprehensive walkthrough of the exploit mechanics.

Table of Contents

The Objective

This guide aims to provide a technically rigorous but accessible analysis of the Caterpillar Coin flash loan attack. By the end, you should understand the specific vulnerability that was exploited, the step-by-step attack sequence, the broader class of flash loan attacks in DeFi, and the red flags that indicate a project may be vulnerable to similar exploits. This knowledge is essential for anyone interacting with DeFi protocols, whether as an investor, developer, or security researcher.

Prerequisites

To fully understand this analysis, you should have a working knowledge of the following concepts: smart contracts and how they execute on EVM-compatible chains; Automated Market Makers (AMMs) and liquidity pools; flash loans, which allow borrowing and repaying assets within a single transaction; and basic token economics including reserves, slippage, and price impact calculations. If any of these concepts are unfamiliar, reviewing introductory DeFi materials before proceeding is recommended.

Step-by-Step Walkthrough

Step 1: The attacker obtains a flash loan of 4.5 million USDT. Flash loans are a DeFi primitive that allows users to borrow large amounts of capital without collateral, provided the loan is repaid within the same atomic transaction. The attacker initiated a flash loan from a lending protocol, giving them access to significant capital with zero upfront cost.

Step 2: The attacker swaps a portion of USDT for CUT tokens. Using the borrowed USDT, the attacker purchased CUT tokens through the project's liquidity pool. This initial swap established a position in the target token while also beginning to affect the pool's reserve ratio.

Step 3: The attacker adds liquidity to the CUT pool. By contributing both USDT and CUT tokens to the liquidity pool, the attacker gained influence over the pool's pricing mechanism. In AMMs, the price of a token is determined by the ratio of reserves in the pool. Adding liquidity changes this ratio and, if the pricing mechanism is flawed, can be exploited to create artificial price discrepancies.

Step 4: The attacker manipulates the token price. The core vulnerability in CUT's price protection system allowed the attacker to manipulate the internal price oracle or reserve calculations. The attacker exploited the weakness to create a significant discrepancy between the token's actual market value and its calculated value within the protocol's reward system.

Step 5: The attacker drains the rewards pool. With the manipulated price creating an artificially inflated valuation of CUT tokens within the reward mechanism, the attacker exchanged CUT tokens back to USDT at the inflated rate. The flawed price protection system failed to detect the manipulation, allowing the attacker to extract significantly more USDT than their original CUT position warranted. The attacker walked away with approximately $1.4 million in profit.

Step 6: The flash loan is repaid. Because the entire sequence occurred within a single atomic transaction, the flash loan was repaid automatically. If any step had failed, the entire transaction would have reverted, and no funds would have been lost—this is the key property that makes flash loans risk-free for attackers.

Troubleshooting

How can you identify projects vulnerable to flash loan attacks? Look for these red flags: reliance on a single liquidity pool for price determination, lack of time-weighted average price (TWAP) oracles, reward calculations based on spot prices rather than moving averages, and insufficient documentation of the project's price oracle implementation. Legitimate projects should use robust oracle solutions like Chainlink or multiple TWAP sources with appropriate time delays to prevent single-block manipulation.

When analyzing a token's security, tools like TokenSniffer, GoPlus Security, and manual smart contract review can help identify common vulnerability patterns. However, no automated tool is a substitute for professional security audits. Projects that have not undergone audits by reputable firms—CertiK, Trail of Bits, OpenZeppelin, or Quantstamp—should be treated with extreme caution.

Mastering the Skill

Understanding flash loan attacks requires ongoing study of DeFi security. Follow security researchers and firms on social media for real-time analysis of new exploits. Practice reading exploit post-mortems—the detailed technical write-ups published after major hacks are invaluable learning resources. Consider studying Solidity and smart contract development to deepen your understanding of the code-level vulnerabilities that enable these attacks. The more you understand the mechanics, the better equipped you will be to identify and avoid vulnerable projects before the next exploit occurs.

Disclaimer: This article is for educational and informational purposes only and does not constitute financial or investment advice. Always conduct your own research before interacting with any DeFi protocol.

25 Comments

  1. milo_f
    99pct price collapse on a token called Caterpillar with no audit. at some point the buyer deserves some blame too
    1. Piotr W.
      milo_f disagree. retail buyers cant audit smart contracts. blaming them for trusting the team is wild
    2. Cezar U.
      Piotr W. is right. retail cannot audit smart contracts, that is the entire point of trusting a team. blaming buyers for the code they were sold is a wild standard
  2. rekt_andy
    99% price collapse from a single flash loan. this is why i never touch tokens with custom price protection mechanisms, they always have some edge case the devs didnt think of
    1. Anika B.
      wei z summed it up. borrow manipulate extract repay. its a template at this point and teams still ship code vulnerable to it. inexcusable in 2024
    2. Imke S.
      Hannah B. borrow manipulate extract repay. same flash loan template since bZx 2020 and devs still ship oracle dependent price mechanisms without guards
    3. Wei Z.
      flash loan attacks follow the same template every time. borrow, manipulate oracle, extract, repay. if the team cant spot this in audit, dont invest
    4. Hannah B.
      borrow manipulate extract repay. wei z laid it out perfectly and teams STILL ship vulnerable oracle code in late 2024. no excuses at this point
  3. DefiDave
    The $1.4M drain is bad but what gets me is that the vulnerability was in the price protection system itself. The thing meant to prevent manipulation became the attack vector.
    1. 0xsnek.eth
      ^ exactly. saw the same pattern with those xiaohongshu tokens last month. price oracles + flash loans = guaranteed exploit eventually
    2. mev_enjoyer
      price protection becoming the attack vector is the most ironic thing. like installing a deadbolt that unlocks from the outside
    3. rekt_temple_
      mev_enjoyer's deadbolt analogy is perfect. the price protection system was literally the entry point. you cant make this stuff up
  4. audit_skip_
    price protection system becoming the attack vector is the most DeFi irony possible. installed a lock that opens from the outside
  5. reentrancy_w
    Wei Z borrow manipulate extract repay. same template since bZx in 2020 and teams still ship vulnerable oracle code
  6. Prateek S.
    99pct price collapse from one flash loan. if your token has custom price protection and no audit, you are the yield
    1. cut_rekt
      Prateek S. custom price protection with no audit on a token called Caterpillar Coin was a recipe for the 99% collapse
    2. oracle_misery_
      Prateek S. price protection becoming the attack vector is the most defi irony ever. installed a deadbolt that opens from the outside
    3. oracle_check_
      Prateek S. custom price protection with no audit is basically a sign on your back saying please exploit me. the 99% collapse was the market doing due diligence the team skipped
  7. Mara L.
    Caterpillar Coin, really? if the name doesnt scream pump and dump i dont know what does. sorry to anyone who got caught in this
    1. rekt_audit
      mara is right but the name is beside the point. i have seen serious projects with the same oracle manipulation vulnerability. the audit industry keeps missing these
    2. flash_loan_boomer_
      Mara L. the name Caterpillar Coin with a custom price protection mechanism and no audit is the full trifecta. every red flag waving at once
  8. Tomoko I.
    a token called Caterpillar Coin with custom price protection and no audit. the rekt was priced in from deployment
  9. defi_autopsy_
    every flash loan attack since bZx 2020 is the same blueprint. borrow manipulate oracle extract repay. at what point do we stop blaming attackers and start blaming devs who ship the same vuln
    1. Amara O.
      defi_autopsy_ the bZx template from 2020 should be day one audit curriculum by now. the fact that it still works 4 years later means the audit industry has failed
  10. zero_down_rekt
    the part that should keep everyone up at night is the attacker needed zero capital. flash loans funded the entire 1.4M drain using the pool's own liquidity. the protocol paid for its own robbery
BTC$60,279.06-2.3%ETH$1,690.21-2.9%SOL$70.50-0.7%BNB$547.00-3.9%XRP$0.9276-1.7%ADA$0.1432-2.2%DOGE$0.0552-2.3%AVAX$6.63-2.2%LINK$8.64-1.3%UNI$4.70-0.7%ATOM$1.18-6.4%LTC$40.13-3.5%ARB$0.1125-5.2%NEAR$2.90-2.9%FIL$0.5227-5.4%SUI$0.6493-4.9%