Back to Blog

デポジットを減らして、より多くをゲット:yCREDIT攻撃の詳細

Code Auditing
January 3, 2021
2 min read

2021年1月2日(北京時間午前7時25分)、当社の監視システムThunderForecastは、yCREDITスマートコントラクトに対する一連の不正なトランザクションを報告しました。その後、当社の研究チームが開発したEthScopeシステムを使用してこれらのトランザクションを分析し、報告されたすべてのトランザクションが悪意のあるものであることを確認しました。このブログでは、攻撃の詳細を説明します。

詳細

この攻撃は、ミントされたトークンの数が意図された数と一致しないことに起因します。そのため、攻撃者はより低い価格でより多くのyCREDITトークンを入手できます。その後、これらのトークンを売却して利益を得ることができます。

脆弱な関数は、StableYieldCreditコントラクト_deposit関数にあります。

以下では、攻撃トランザクションを使用して、プロセス全体を説明します。

攻撃者は、まず1e-8 WBTC331.335 yCreditトークンをWBTC-yCREDITペアプールに転送しました。その後、攻撃者は0.5 WBTCStableYieldCreditコントラクトにデポジットして攻撃を開始しました。

具体的には、_valueは、価格オラクルプロバイダーChainLink(480行目、_value1466786010075)に基づいて、token(0x2260fac5e5542a773aa44fbcfedf7c193bc2c599 - WBTC)のamount(0.5)を使用して計算されます。これは、デポジットされたWBTCのUSDでの価値を計算することを意図しています。その後、コントラクトはyCREDITトークンの数(_value - fee)をWBTCをデポジットした人(攻撃者)に転送します。これは、yCREDITの価値が1USD(システムによって設計された通り)に等しいためです。攻撃者が少額のfeeを失うこと以外は、すべて問題ありません。

さらに、コントラクトはデポジットされたWBTCをWBTC-yCREDITペアプールに追加します。これは、デポジットされたWBTCがコントラクトにロックされると、流動性を失うためです。そのため、まずプールに入れられるトークンペア(WBTCからyCREDIT)の価値を計算します。この値は、_addLiquidity関数を使用して計算されます。基本的に、これはプール内の既存の準備金に基づいて計算されます。プールには1e-8 WBTC331.335 yCREDITトークンしかありませんでしたが、計算されたamountA44amountB1466786010075)でした。これは、攻撃者が44e-8 WBTC(485行目)しか消費せず、14667.86010075 - fee = 14594.52080025 yCREDITトークン(493行目)を取得したことを意味します。同時に、プールには少量のWBTC(1e-8 + 44e-8)と(331.335 + 14667.86010075)yCREDITトークンが残っています。

利益を得るために、攻撃者は獲得した14594.52080025 yCREDITトークンを取引所で取引するだけで済みます。興味深いことに、このトランザクションで利益を得るプロセスは、必要以上に複雑でした。他のトランザクションでも巧妙な攻撃戦略を観察しています。

攻撃には一連のトランザクションが関与しており、その中には(ただしこれらに限定されません)以下のものがあります。

更新

2020/01/03: 脆弱性を修正した新しいスマートコントラクトがあります。

タイムライン

  • 2021/01/01 23:25 UTC、当社のシステムが攻撃を検出
  • 2021/01/02 16:20 UTC、このブログを公開
Sign up for the latest updates
~$15.9M Lost: Trusted Volumes & More | BlockSec Weekly
Security Insights

~$15.9M Lost: Trusted Volumes & 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

~$7.04M Lost: GiddyDefi, Volo Vault & More | BlockSec Weekly
Security Insights

~$7.04M Lost: GiddyDefi, Volo Vault & More | BlockSec Weekly

This BlockSec weekly security report covers eight attack incidents detected between April 20 and April 26, 2026, across Ethereum, Avalanche, Sui, Base, HyperLiquid, and MegaETH, with total estimated losses of approximately $7.04M. The highlighted incident is the $1.3M GiddyDefi exploit, where the attacker did not break any cryptography or use a flash loan but simply replayed an existing on-chain EIP-712 signature with the unsigned `aggregator` and `fromToken` fields swapped out for a malicious contract, demonstrating how partial signature coverage turns any historical signature into a generic permit. Other incidents include a $3.5M Volo Vault operator key compromise on Sui, a $1.5M Purrlend privileged-role takeover, a $413K SingularityFinance oracle misconfiguration, a $142.7K Scallop cross-pool index injection, a $72.35K Kipseli Router decimal mismatch, a $50.7K REVLoans (Juicebox) accounting pollution, and a $64K Custom Rebalancer arbitrary-call exploit.

Best Security Auditor for Web3

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

BlockSec Audit