アレイファイナンスのセキュリティインシデントの分析

アレイファイナンスのセキュリティインシデントの分析

7月18日、当社のDeFiRangerシステムは、いくつかの疑わしいトランザクションを報告しました。手動分析の結果、これらのトランザクションがArray Financeへの攻撃であることを確認しました。以下では、攻撃トランザクションを使用して、攻撃プロセスと脆弱性の根本原因を説明します。

攻撃トランザクション

このブログで使用する攻撃トランザクションは次のとおりです。 0xa17bbc7c9ab17aa88fdb5de83b41de982845e9c9c072efff6709dd29febf0daa

攻撃フロー

Figure 1
Figure 1

図1に示すように、攻撃者はAAVEからフラッシュローンを借りて、186.62 WETHの利益を得ました(このブログではWETHとETHを明示的に区別していません)。

Figure 2
Figure 2

詳細な攻撃プロセスを図2に示します。

  • まず、攻撃者はArray Financeのbuy関数を呼び出しました。攻撃者は45.91 WETHを使用してArray Financeが発行した430 ARRAYトークンを取得しました。
  • 次に、攻撃者は非公開ソースのコントラクト(Array Collater - 0xa800cda5)のjoinPool関数を5回呼び出しました。攻撃者は676,410.58 DAI + 679,080.46 USDC + 901.82 WETH + 20 WBTC + 20 renBTCを預け入れ、Array Collaterが発行した726.38 aBPTトークンを取得しました。
  • 攻撃者はsell関数を呼び出して430 ARRAYトークンを燃焼させ、77.17 aBPTトークンを取得しました。
  • 最後に、攻撃者はArray CollaterのexitPool関数を呼び出しました。攻撃者は前の2つのステップで取得した804.55 aBPTトークンを燃焼させ、748,271.55 DAI + 751,225.08 USDC + 997.62 WETH + 22.63 WBTC + 22.74 renBTCを取得しました。

図2から、攻撃者はステップ5(図2:sell関数を呼び出す)で利益を得ていることがわかります。これは、取得した77.17 aBPTトークンが、ステップ3(図2:buy関数を呼び出す)で預け入れた49.9142 WETHよりも価値があるためです。以下では、この攻撃が可能になった理由を理解するためにコードを分析します。

コードの脆弱性

以下のコードは、Array Financeのsell関数を示しています。この関数では、Array Financeは攻撃者が所有するARRAYトークンの残高を使用し、内部の_sell関数を呼び出して、ARRAYトークンを売却して取得できるaBPTトークンの数を計算します。

以下は_sell関数の実装です。calculateLPtokensGivenArrayTokensを呼び出して、特定の数のARRAYトークンが与えられた場合に取得できるaBPTトークンの数を取得します。その後、この関数はARRAYトークンを燃焼させ、aBPTトークンを返します。

以下はcalculateLPtokensGivenArrayTokens関数の実装です。

amountLPTokenの計算に影響を与える4つの引数があることに注意してください。saleTargetAmountを読んだ後、次の式を推測します。

arraySmartPool.totalSupply() * (1 - (1 - amount / ARRAY.totalSupply()) ^ (1000000 / reseveRatio))

arraySmartPoolはArray Collaterのスマートコントラクトアドレス(0xa800cda5)です。攻撃者がフラッシュローンから借りた資金をArray Collaterに預け入れると、arraySmartPool.totalSupply()の値が増加します(以下の表を参照)。

TxnIndex: 64 arraySmartPool.totalSupply():  110162296218708026400
TxnIndex: 107 arraySmartPool.totalSupply():  165243444328062039600
TxnIndex: 150 arraySmartPool.totalSupply():  247865166492093059400
TxnIndex: 193 arraySmartPool.totalSupply():  371797749738139589100
TxnIndex: 236 arraySmartPool.totalSupply():  557696624607209383650
TxnIndex: 280 arraySmartPool.totalSupply():  836544936910814075475

arraySmartPoolのコードを読むことで、このロジックを確認できます。以下はarraySmartPoolのjoinPool関数です。

この関数は、まずSmartPoolManager.joinPool関数を呼び出して、msg.senderから取得する必要のあるトークン数(actualAmountsIn)を計算します。その後、各トークンについて_pullUnderlying関数を呼び出して、トークンをarraySmartPoolに預け入れます。最後に、_mintPoolShare_pushPoolShareを呼び出してaBPTトークンを発行し、発行されたaBPTトークンをmsg.senderに転送します。

arraySmartPoolはPCTokenから継承されていることに注意してください。_mintPoolShare関数は_mint関数を呼び出します。以下にそれを示します。

_mint関数はvarTotalSupply変数を増加させます。この変数はtotalSupply()によって直接返されます。したがって、この値はjoinPoolの各呼び出しで増加します。

利益推定

まとめ

要約すると、攻撃者は、aBPTトークンのtotalSupplyに依存するArray Financeの価格メカニズムが操作可能であるという脆弱性を悪用しました。この脆弱性は、当社の研究論文DeFiRanger: Detecting Price Manipulation Attacks on DeFi Applicationsで議論されています。

謝辞

Junjie Fei、Yufeng Hu、Ziling Lin、Siwei Wu、Lei Wu、Yajin Zhou @BlockSec (姓のアルファベット順)

BlockSecについて

BlockSecは、2021年に世界的に著名なセキュリティ専門家グループによって設立された、先駆的なブロックチェーンセキュリティ企業です。当社は、Web3の世界のセキュリティとユーザビリティを強化し、その大規模な普及を促進することに尽力しています。この目標を達成するために、BlockSecはスマートコントラクトおよびEVMチェーンのセキュリティ監査サービス、セキュリティ開発と脅威のプロアクティブなブロックのためのPhalconプラットフォーム、資金追跡と調査のためのMetaSleuthプラットフォーム、そしてWeb3ビルダーが暗号通貨の世界を効率的にサーフィンするためのMetaDock拡張機能を提供しています。

現在までに、MetaMask、Uniswap Foundation、Compound、Forta、PancakeSwapなどの300社を超える著名なクライアントにサービスを提供し、Matrix Partners、Vitalbridge Capital、Fenbushi Capitalなどの著名な投資家から2回の資金調達で数千万米ドルを受け取っています。

公式ウェブサイト:https://blocksec.com/ 公式Twitterアカウント:https://twitter.com/BlockSecTeam

Sign up for the latest updates
#1 Cetus Incident: One Unchecked Shift Drains $223M in the Largest DeFi Hack of 2025

#1 Cetus Incident: One Unchecked Shift Drains $223M in the Largest DeFi Hack of 2025

Cetus Protocol, the largest concentrated-liquidity DEX on Sui, was exploited on May 22, 2025, resulting in an estimated ~$223M loss across multiple liquidity pools. The attacker leveraged a flaw in checked_shlw(), a custom overflow-prevention helper used in fixed-point u256 math, where an incorrect constant and comparison failed to block unsafe left shifts and caused silent truncation of high bits during liquidity delta calculations. By crafting specific liquidity and tick/price-range parameters, the exploit made required deposits appear near-zero while minting an oversized liquidity position, which was later withdrawn to drain real pool reserves.

#2 Bybit Incident: A Web2 Breach Enables the Largest Crypto Hack in History

#2 Bybit Incident: A Web2 Breach Enables the Largest Crypto Hack in History

The largest crypto hack ever, the February 21, 2025 Bybit breach stole about $1.5B after attackers used social engineering to compromise a Safe{Wallet} workflow, injected malicious JavaScript into an AWS S3 bucket, tampered with the transaction signing process, and upgraded Bybit’s Safe{Wallet} contract to a malicious implementation that drained funds across multiple chains.

Weekly Web3 Security Incident Roundup | Jan 25 – Feb 1, 2026

Weekly Web3 Security Incident Roundup | Jan 25 – Feb 1, 2026

During the week of January 25 to February 1, 2026, six blockchain security incidents were reported with total losses of ~$18.05M. These involved improper input validation, token design flaws, key compromises, and business logic errors across DeFi protocols on multiple chains. The primary causes included unchecked user inputs enabling arbitrary calls, flawed burn mechanisms allowing price manipulation, compromised developer tools, and missing solvency checks in lending functions.