Back to Blog

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

Code Auditing
July 19, 2021

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
Tracing $1.6B in TRON USDT: Inside the VerilyHK Ponzi Infrastructure
Case Studies

Tracing $1.6B in TRON USDT: Inside the VerilyHK Ponzi Infrastructure

An on-chain investigation into VerilyHK, a fraudulent platform that moved $1.6B in TRON USDT through a multi-layered fund-routing infrastructure of rotating wallets, paired payout channels, and exchange exit funnels, with traced connections to the FinCEN-sanctioned Huione Group.

Weekly Web3 Security Incident Roundup | Mar 30 – Apr 5, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Mar 30 – Apr 5, 2026

This BlockSec weekly security report covers nine DeFi attack incidents detected between March 30 and April 5, 2026, across Solana, BNB Chain, Arbitrum, and Polygon, with total estimated losses of approximately $287M. The week was dominated by the $285.3M Drift Protocol exploit on Solana, where attackers combined multisig signer social engineering with Solana's durable nonce mechanism to bypass a zero-timelock 2-of-5 Security Council, alongside notable incidents including a $950K flash loan TWAP manipulation against the LML staking protocol, a $359K Silo Finance vault inflation via an external `wstUSR` market donation exploiting a depegged-asset oracle and `totalAssets()` accounting flaw, and an EIP-7702 delegated-code access control failure. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident, covering flawed business logic, access control, price manipulation, phishing, and misconfiguration attack types.

Drift Protocol Incident: Multisig Governance Compromise via Durable Nonce Exploitation
Security Insights

Drift Protocol Incident: Multisig Governance Compromise via Durable Nonce Exploitation

On April 1, 2026 (UTC), Drift Protocol on Solana suffered a $285.3M loss after an attacker exploited Solana's durable nonce mechanism to delay the execution of phished multisig approvals, ultimately transferring administrative control of the protocol's 2-of-5 Squads governance with zero timelock. With full admin privileges, the attacker created a malicious collateral market (CVT), inflated its oracle price, relaxed withdrawal protections, and drained USDC, JLP, SOL, cbBTC, and other assets through 31 rapid withdrawals in approximately 12 minutes. This incident highlights how durable nonce-based delayed execution can decouple signer intent from on-chain execution, bypassing the temporal assumptions that multisig security implicitly relies on.

Best Security Auditor for Web3

Validate design, code, and business logic before launch. Aligned with the highest industry security standards.

BlockSec Audit