Back to Blog

「セーフティトランスファー」が危険になる時:QBridgeセキュリティインシデントから学ぶ教訓

Code Auditing
January 28, 2022

1月28日、QBRIDGEが攻撃を受け、約8000万米ドル相当の資産が盗難されました。分析の結果、コードにおける根本原因はsafeTransfer(およびsafeTransferFrom)関数の実装にあることが判明しました。

根本原因

まず、プロジェクトではトークン転送に広く使われているOpenZeppelin SafeERC20ライブラリを使用していません。代わりに、SafeTokenというライブラリを独自に実装しました。

次に、実装では宛先が有効なコントラクトであるか(あるいはゼロアドレスでないか)のチェックを行っていません。

第三に、EVMの低レベルコールでは、宛先コントラクトがゼロアドレスの場合にfalseを返しません。 これは開発者の常識に反します。

もちろん、このインシデントには、例えばゼロアドレスがホワイトリストに入れられたといった他の理由もいくつかあります。しかし、コードがこの特別なケースを適切に処理できていれば、脆弱性はありませんでした。

ちなみに:類似のコードを使用している他のプロジェクトも存在します。それらも同様の問題の影響を受ける可能性があります。

実験

VMが宛先コントラクトがゼロアドレスの場合にfalseを返さないという3番目の理由を確認するために、以下に示すテストコントラクトを開発しました。

TestSafeTransfer.test()の実行はリバートしません。

教訓とリスク軽減策

以下の点を推奨します。

  • 非常に非常に正当な理由がない限り、独自の車輪を再発明するのではなく、広く使われているライブラリを使用してください。
  • 資産転送の前後に残高をチェックし、転送された資産の数量が期待値と一致していることを確認してください。これは、デフレ・インフレトークンの問題も回避できます。

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
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.

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

Weekly Web3 Security Incident Roundup | Mar 23 – Mar 29, 2026

This BlockSec weekly security report covers eight DeFi attack incidents detected between March 23 and March 29, 2026, across Ethereum and BNB Chain, with total estimated losses of approximately $1.53M. Incidents include a $679K flawed burn mechanism exploit on the BCE token, a $512K spot-price manipulation attack on Cyrus Finance's PancakeSwap V3 liquidity withdrawal, a $133.5K flash-loan-driven referral reward manipulation on a TUR staking contract, and multiple integer overflow, reentrancy, and accounting error vulnerabilities in DeFi protocols. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Newsletter -  March 2026
Security Insights

Newsletter - March 2026

In March 2026, the DeFi ecosystem experienced three major security incidents. Resolv Protocol lost ~$80M due to compromised privileged infrastructure keys, BitcoinReserveOffering suffered ~$2.7M from a double-minting logic flaw, and Venus Protocol incurred ~$2.15M following a donation attack combined with market manipulation.

Best Security Auditor for Web3

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

BlockSec Audit