Back to Blog

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

Code Auditing
August 4, 2021

2021年8月4日、Popsicle Financeは攻撃により巨額の金銭的損失(2000万ドル超)を被りました[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. 攻撃を実行するためにデポジット-ウィズドロー-コレクトフィーズサイクルを起動しました(合計8サイクルあり、Popsicle Financeの複数のボルトから大量の流動性が引き出されました)。
  4. フラッシュローンをAAVEに返却し、Tornado.Cashを通じて利益をマネーロンダリングしました。

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

利益分析

合計で、攻撃者はPopsicle Financeから2000万ドルを不正に取得しました。これには、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
Tether Freezes $6.76M USDT Linked to Iran's IRGC & Houthi Forces: Why On-Chain Compliance is Now a Geopolitical Battlefield
Security Insights

Tether Freezes $6.76M USDT Linked to Iran's IRGC & Houthi Forces: Why On-Chain Compliance is Now a Geopolitical Battlefield

Looking ahead, targeted freezing events like this $6.76M USDT action will only become more common. On-chain data analysis is improving. Stablecoin issuers are also working closely with regulators. As a result, hidden illicit financial networks will be exposed.

Weekly Web3 Security Incident Roundup | Mar 2 – Mar 8, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Mar 2 – Mar 8, 2026

During the week of March 2 to March 8, 2026, seven blockchain security incidents were reported with total losses of ~$3.25M. The incidents occurred across Base, BNB Chain, and Ethereum, exposing critical vulnerabilities in smart contract business logic, token deflationary mechanics, and asset price manipulation. The primary causes included a double-minting logic flaw during full token deposits that allowed an attacker to exponentially inflate their balances through repeated burn-and-mint cycles, a price manipulation vulnerability in an AMM-based lending market where artificially inflated vault shares created divergent price anchors to incorrectly force healthy positions into liquidation, and a flawed access control implementation relying on trivially spoofed contract interfaces that enabled attackers to bypass authorization to batch-mint and dump arbitrary tokens.

Weekly Web3 Security Incident Roundup | Feb 23 – Mar 1, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Feb 23 – Mar 1, 2026

During the week of February 23 to March 1, 2026, seven blockchain security incidents were reported with total losses of ~$13M. The incidents affected multiple protocols, exposing critical weaknesses in oracle design/configuration, cryptographic verification, and core business logic. The primary drivers included oracle manipulation/misconfiguration that led to the largest loss at YieldBloxDAO (~$10M), a crypto-proof verification flaw that enabled the FOOMCASH (~$2.26M) exploit, and additional token design and logic errors impacting Ploutos, LAXO, STO, HedgePay, and an unknown contract, underscoring the need for rigorous audits and continuous monitoring across all protocol layers.

Best Security Auditor for Web3

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

BlockSec Audit