Back to all stories
Blogs
Incident Analysis
CUT Token Incident Analysis
9/10/2024
CUT Token Incident Analysis

Incident Summary

On 10th September, 2024, Caterpillar Coin ($CUT token) suffered a flashloan attack resulting in a loss of ~$1.4M and causing a 99% slippage on the token.

CUT1

The attack exploited vulnerabilities in the ‘price protection mechanisms’, which led to the manipulation of token reserves and rewards.

Key Transactions

Attack Transactions

  1. 0x2c123d08ca3d50c4b875c0b5de1b5c85d0bf9979dffbf87c48526e3a67396827
  2. 0xce6e474dc9555ef971473fee19f87716f38ba01a0df39e78207b71eda134c420
  3. 0x6262c0f15c88aed6f646ed1996eb6aae9ccc5d5704d5faccd1e1397dd047bc8a

Attack Flow

Addresses

  • Exploiter wallet address: 0x5766d1F03378f50c7c981c014Ed5e5A8124f38A4
  • Exploit contract: 0x87EFb39a716860eCd2324A944Cb40EC5128e56Dd
  • Exploiter contract 2: 0xD9ad954Bea4ad65578904CEFE6Ee2A6EB13879dB
  • CUT token: 0x7057f3b0f4d0649b428f0d8378a8a0e7d21d36a7
  • CUT _transferFunDealTypeContractAddress: 0x7b2e7cb89824236cb7096cde7a153af30f3ecbaf

Step by Step

  1. The exploiter started with a flashloan of 4,500,000 USDT which was transferred to 0xD9ad.

CUT3

  1. A new contract was created (0x34bEb8b92a61EB1C3e2fe27eAC16EeC895Ba2e98) and the attacker transferred 4,362,551 USDT. 3,053,785 USDT was then swapped for 515,830 CUT tokens.

  2. The attacker called Pancakeswap RouterV2.addLiquidity() with amountADesired as 392,629 USDT and amountBDesired as the 515,830 CUT tokens from step 2.

CUT4

392,629 USDT is added, however, only 21,885 CUT tokens are added to the USDT-CUT liquidity pool (LP).

CUT5

'_transferFunDealTypeContractAddress' recorded open deal 3157 at current price and generated a reward record.

CUT6

  1. With the liquidity added, the exploiter then swapped the 484,066 CUT they were still holding for 3,129,939 USDT. This shifted the reserve ratio from 4,900,599.300,495,827,251,332,919 vs 273,159.777,220 (17.94)to 1,770,659.646,119,018,975,885,067 vs 757,225.933,923 (2.34)

  2. The exploiter then removed 141,826 USDT and 60,652 CUT from liquidity.

CUT7

The LP Burn was expected to transfer 60.7e9 CUT to the exploiter. But, due to open "order 3157", they got 275e9 CUT instead. This order was created IActCheckContract.actDealLPAddBehaviorTrue() when the liquidity was added.

CUT8

CUT9

The exploiter then swapped 264,268 CUT for a further 447,179 USDT.

  1. This pattern was repeated 40 times until the exploiter repaid the flashloan and kept 1,259,965 USDC as profit.

Vulnerability

The $CUT token implemented a “price protection mechanism“ that involves external ‘transferFunDealTypeContractAddress’ contracts at 0x7b2e7cb89824236cb7096cde7a153af30f3ecbaf and lpFutureYieldContractAddress at 0x0917914b0a70ee7f1f2460fcd487696856e31154.

CUT10

When adding to the LP, the 0x7b2e contract generates an orderID and a ‘reward' record referring to the current reserve ratio. When removing from the LP, CUT token invokes the '0x7b32.valuePreservationByRemoveLP()’ method to calculate the actual balance change of the recipient, on top of Uniswap accounting.

As seen from the decompiled code at 0x7be2 (0xa54() calculates the USDT amount referring to current reserve ratio; 0x1cf2() refers to the recipient order record)

CUT11

The method calculates the USDT swap amount ‘v6' from past orderinfo and 'v0’ from current price v0 and then naively converts the difference to CUT, based on the current price.

The calculation is vulnerable to price manipulation and the exploiter abused this in order to gain extra $CUT tokens, sold them and gained ~$1.4m from the BUSD-CUT pancake pair.

The Stats

In 2023 we saw an average of 15 flashloan attacks per month with a yearly loss of $126M excluding a further $188M that was returned by whitehats. In 2024, we have recorded 52 incidents involving a flashloan, bringing the average down to 5.7 incidents per month, but still reaching losses of ~$86.7M.

CUT12

To keep up to date on the latest incident alerts and statistics follow @certikalert on X, or read our latest analysis on certik.com.