「セーフミント」が危険になる時:HypeBearsセキュリティインシデントからの教訓

「セーフミント」が危険になる時:HypeBearsセキュリティインシデントからの教訓

2月3日午前(+8時台)、当社のシステムは、HypeBears NFTコントラクトに対する攻撃トランザクション0xfa97c3476aa8aeac662dae0cc3f0d3da48472ff4e7c55d0e305901ec37a2f704を報告しました。調査の結果、ERC721の_safeMint関数によって引き起こされたリエントランシー攻撃であることが判明しました。

原因

プロジェクトには、アカウントがミントできるNFTの数に制限があります。基本的に、NFTをミントしたかどうかを記録するaddressMintedというマップがあります。

NFTをミントする際、コードはOZリファレンス実装の_safeMint関数を使用します。この関数は、受信者がERC721トークンを受信できるかどうかを確認するため、safeです。これにより、ERC721トークンを処理できないコントラクトにNFTがミントされるのを防ぐことができます。以下は、ドキュメントによると:

toがスマートコントラクトを参照する場合、IERC721Receiver.onERC721Receivedを実装する必要があります。これはセーフ転送時に呼び出されます。以下のコードは、_safeMint関数のOZ実装を示しています。

しかし、この外部関数呼び出しはセキュリティ上の脆弱性を生み出します。具体的には、攻撃者はonERC721Receivedコールバック内でリエントラント呼び出しを実行できます。例えば、脆弱なHypeBearsコントラクトでは、攻撃者はonERC721Receivedコールバック内でmintNFT関数を再度呼び出すことができます(addressMintedがまだ更新されていないため)。

攻撃

以下のスクリーンショットは、攻撃トランザクションを示しています。

教訓

SafeMintによって引き起こされるリスクは、セキュリティ研究者によって議論されてきました。link1 link2。しかし、依然として脆弱なコードと実際の攻撃を目にすることができます。QBridgeセキュリティインシデントsafeTransferで示されているように、安全な関数を使用しても、安全なコントラクトが保証されるわけではありません😃。

Sign up for the latest updates
Weekly Web3 Security Incident Roundup | Feb 9 – Feb 15, 2026

Weekly Web3 Security Incident Roundup | Feb 9 – Feb 15, 2026

During the week of February 9 to February 15, 2026, three blockchain security incidents were reported with total losses of ~$657K. All incidents occurred on the BNB Smart Chain and involved flawed business logic in DeFi token contracts. The primary causes included an unchecked balance withdrawal from an intermediary contract that allowed donation-based inflation of a liquidity addition targeted by a sandwich attack, a post-swap deflationary clawback that returned sold tokens to the caller while draining pool reserves to create a repeatable price-manipulation primitive, and a token transfer override that burned tokens directly from a Uniswap V2 pair's balance and force-synced reserves within the same transaction to artificially inflate the token price.

Top 10 "Awesome" Security Incidents in 2025

Top 10 "Awesome" Security Incidents in 2025

To help the community learn from what happened, BlockSec selected ten incidents that stood out most this year. These cases were chosen not only for the scale of loss, but also for the distinct techniques involved, the unexpected twists in execution, and the new or underexplored attack surfaces they revealed.

#10 Panoptic Incident: XOR Linearity Breaks the Position Fingerprint Scheme

#10 Panoptic Incident: XOR Linearity Breaks the Position Fingerprint Scheme

On August 29, 2025, Panoptic disclosed a Cantina bounty finding and confirmed that, with support from Cantina and Seal911, it executed a rescue operation on August 25 to secure roughly $400K in funds. The issue stemmed from a flaw in Panoptic’s position fingerprint calculation algorithm, which could have enabled incorrect position identification and downstream fund risk.