Back to Blog

ポプシクル・ファイナンスのセキュリティインシデント分析

Code Auditing
August 4, 2021
4 min read

2021年8月4日、Popsicle Financeは攻撃により巨額の損失(2,000万ドル以上)を被りました[1]。 手動分析の結果、これは「ダブルクレイム」攻撃、すなわち報酬システムの脆弱性により、攻撃者が繰り返し報酬を請求できたことが確認されました。 以下では、攻撃トランザクションを用いて、攻撃プロセスと脆弱性の根本原因を説明します。

背景

Popsicle Financeは、複数のチェーン(例:Ethereum、BSC)に対応したイールド最適化プラットフォームです。

具体的には、ユーザーはまずdeposit関数を呼び出して流動性を提供し、Popsicle LPトークン(略称PLP)を取得します。その後、Popsicle Financeがユーザーに代わって流動性を管理し(Uniswapなどのプラットフォームと連携)、利益を生み出します。 ユーザーはwithdraw関数を呼び出してPopsicle Financeから流動性を取り戻すことができ、その量はPLPトークンに基づいて計算されます。 インセンティブ報酬は流動性に由来し、時間とともに蓄積されます。 ユーザーはcollectFees関数を呼び出して報酬を請求できますが、これがこの攻撃の鍵となります。

脆弱性分析

collectFees関数では、token0Rewardtoken1Reward(対応するLPトークンペアの報酬)がユーザーのために計算されます。計算ロジック全体は単純です。しかし、この関数はupdateVaultというモディファイアを使用しており、これは報酬を適切に更新するために使用されます。

要するに、updateVaultは以下の処理を行います。

  1. まず_earnFees関数を呼び出し、プールから蓄積された手数料を取得します。
  2. 次に_tokenPerShare関数を呼び出し、token0PerShareStoredtoken1PerShareStoredを更新します。これらは、シェアあたりのトークン0およびトークン1のプール内の量を示します。
  3. 最後に_fee0Earned_fee1Earned関数を呼び出し、ユーザーの報酬(それぞれtoken0Rewardstoken1Rewards)を更新します。

_fee0Earned_fee1Earned関数は同じロジックを共有しており、以下の数式を実装しています(トークン0を例とします)。

user.token0Rewards += PLP.balanceOf(account) * (fee0PerShare - user.token0PerSharePaid) / 1e18

この計算は累積的であることに注意してください。つまり、ユーザーがPLPトークンを保有していなくても、計算された報酬はtoken0Rewardsに格納されている値のままです。

したがって、以下の2つの観察結果が得られます。

  1. ユーザーの報酬はtoken0Rewardstoken1Rewardsに格納され、これらはPLPトークンとは関連付けられていません。
  2. collectFees関数はtoken0Rewardstoken1Rewardsの状態のみに依存するため、PLPトークンを保有せずに報酬を引き出すことができます。

現実世界では、これはユーザーが銀行にお金を預け、銀行が預金証書を発行するようなものです。残念ながら、この証書は偽造防止機能がなく、ユーザーとも関連付けられていません。 このような場合、複製を作成して他人に配布し、銀行から利益を得ることが可能です。

攻撃フロー

簡潔に言うと、攻撃者は以下の手順で攻撃を実行しました。

  1. 3つのコントラクトを作成しました。1つは攻撃に使用され、他の2つは報酬を取得するためにcollectFees関数を呼び出すために使用されました。
  2. AAVEから大量の流動性を借り入れるフラッシュローンを利用しました。
  3. デポジット-ウィズドロー-コレクトFeesサイクルを実行して攻撃を仕掛けました(合計8サイクル実行され、Popsicle Financeの複数のボルトから大量の流動性が引き出されました)。
  4. フラッシュローンをAAVEに返却し、Tornado.Cashを通じて利益をマネーロンダリングしました。

具体的には、デポジット-ウィズドロー-コレクトFeesサイクルはいくつかのステップで構成されており、当社のオンラインツール [2]を使用することで、簡単にラベル付けして明確に要約できます。

利益分析

合計で、攻撃者はPopsicle Financeから2,000万ドルを収穫しました。これには、2.56K WETH、96.2 WBTC、160K DAI、5.39M USDC、4.98M USDT、10.5K UNIが含まれます。 この搾取の後、攻撃者はまずUniswapとWETHを通じて他のすべてのトークンをETHに交換し、その後Tornado.Cashを使用してマネーロンダリングを行いました。

功労者

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

https://www.blocksecteam.com

Medium: https://blocksecteam.medium.com/

Twitter: https://twitter.com/BlockSecTeam

連絡先: [email protected]

参考文献

[1] https://twitter.com/defiprime/status/1422708265423556611

[2] https://tx.blocksecteam.com/

Sign up for the latest updates
The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis
Security Insights

The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis

This BlockSec deep-dive analyzes the KelpDAO $290M rsETH cross-chain bridge exploit (April 18, 2026), attributed to the Lazarus Group, tracing a causal chain across three layers: how a single-point DVN dependency enabled the attack, how DeFi composability cascaded the damage through Aave V3 lending markets to freeze WETH liquidity exceeding $6.7B across Ethereum, Arbitrum, Base, Mantle, and Linea, and how the crisis forced decentralized governance to exercise centralized emergency powers. The article examines three parameters that shaped the cascade's severity (LTV, pool depth, and cross-chain deployment count) and provides an exclusive technical breakdown of Arbitrum Security Council's forced state transition, an atomic contract upgrade that moved 30,766 ETH without the holder's signature.

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026

This BlockSec weekly security report covers four attack incidents detected between April 13 and April 19, 2026, across multiple chains such as Ethereum, Unichain, Arbitrum, and NEAR, with total estimated losses of approximately $310M. The highlighted incident is the $290M KelpDAO rsETH bridge exploit, where an attacker poisoned the RPC infrastructure of the sole LayerZero DVN to fabricate a cross-chain message, triggering a cascading WETH freeze across five chains and an Arbitrum Security Council forced state transition that raises questions about the actual trust boundaries of decentralized systems. Other incidents include a $242K MMR proof forgery on Hyperbridge, a $1.5M signed integer abuse on Dango, and an $18.4M circular swap path exploit on Rhea Finance's Burrowland protocol.

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026

This BlockSec weekly security report covers four DeFi attack incidents detected between April 6 and April 12, 2026, across Linea, BNB Chain, Arbitrum, Optimism, Avalanche, and Base, with total estimated losses of approximately $928.6K. Notable incidents include a $517K approval-related exploit where a user mistakenly approved a permissionless SquidMulticall contract enabling arbitrary external calls, a $193K business logic flaw in the HB token's reward-settlement logic that allowed direct AMM reserve manipulation, a $165.6K exploit in Denaria's perpetual DEX caused by a rounding asymmetry compounded with an unsafe cast, and a $53K access control issue in XBITVault caused by an initialization-dependent check that failed open. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Best Security Auditor for Web3

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

BlockSec Audit