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
~$4.72M Lost: TAC, Transit Finance & More | BlockSec Weekly
Security Insights

~$4.72M Lost: TAC, Transit Finance & More | BlockSec Weekly

This BlockSec weekly security report covers 3 notable attack incidents identified between May 11 and May 17, 2026, across TRON, TON, and Ethereum, with total estimated losses of approximately $4.72M. Three incidents are analyzed in detail: the highlighted $1.88M Transit Finance exploit on TRON, where a deprecated swap bridge contract with lingering token approvals was exploited through arbitrary calldata forwarding; the $2.8M TAC TON-to-EVM bridge exploit caused by missing canonical wallet verification in the jetton deposit flow; and the $46.75K Boost Hook exploit on Ethereum, where spot price manipulation on a Uniswap V4 hook-based perpetual protocol forced the protocol to buy tokens at inflated prices using its own reserves.

~$15.9M Lost: Trusted Volumes, Wasabi & More | BlockSec Weekly
Security Insights

~$15.9M Lost: Trusted Volumes, Wasabi & More | BlockSec Weekly

This BlockSec bi-weekly security report covers 11 notable attack incidents identified between April 27 and May 10, 2026, across Sui, Ethereum, BNB Chain, Base, Blast, and Berachain, with total estimated losses of approximately $15.9M. Three incidents are analyzed in detail: the highlighted $1.14M Aftermath Finance exploit on Sui, where a signed/unsigned semantic mismatch in the builder-fee validation allowed an attacker to inject a negative fee that was converted into positive collateral during settlement; the $5.87M Trusted Volumes RFQ authorization mismatch on Ethereum; and the $5.7M Wasabi Protocol infrastructure-to-contract-control compromise across multiple EVM chains.

Newsletter - April 2026
Security Insights

Newsletter - April 2026

In April 2026, the DeFi ecosystem experienced three major security incidents. KelpDAO lost ~$290M due to an insecure 1-of-1 DVN bridge configuration exploited via RPC infrastructure compromise, Drift Protocol suffered ~$285M from a multisig governance takeover leveraging Solana's durable nonce mechanism, and Rhea Finance incurred ~$18.4M following a business logic flaw in its margin-trading module that allowed circular swap path manipulatio

Best Security Auditor for Web3

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

BlockSec Audit