Back to Blog

三殊犬安全事件分析

Code Auditing
July 21, 2021

7月21日,我们的DeFiRanger系统报告了几笔可疑交易。经过人工分析,我们确认这些交易是针对Sanshu Inu的攻击。具体来说,Sanshu Inu的Memstake合约被滥用deflation机制所攻击。 接下来,我们将通过多笔攻击交易来阐述攻击过程。

攻击流程

下图列出了攻击者(0x333)发起的一些交易。

攻击包含四个步骤,其中最关键的是第二步,它利用了ERC20代币的通缩机制来操纵Memstake智能合约的奖励计算。

  • 步骤1(准备):攻击者创建了两个攻击合约,第一个合约用于质押2049B的KEANU第二个是攻击合约。

  • 步骤2(操纵):攻击者首先通过闪电贷(《理解闪电贷及其在DeFi生态系统中的应用:迈向第一步》(SBC 2021))从uniswapV2 借入大量KEANU代币,然后使用步骤1中创建的第二个智能合约将代币存入/从中提取。由于KEANU具有通缩机制,每次交易会销毁2%的代币,因此实际存入Memestake的代币数量小于Memestake合约维护的user.amount值。攻击者重复此过程,使得Memestake中的KEANU代币数量减少到很小的数量(1e-07)。请参见交易0x00ed和下图。

  • 步骤3(获利):攻击者调用 Memestake.updatePool() 来更新 accMfundPerShare。该值依赖于KEANU代币的数量(在第二步中被操纵)。然后,攻击者获得了大量的Mfund(约6100万)。 有关更多详细信息,请参阅交易0xa945
  • 步骤4(兑换为WETH):攻击者将MFund和KEANU兑换为WETH,并通过Tornado.Cash洗钱。攻击者获得了55.9484578158357 ETH的利润。

杂项

有趣的是,攻击的第二/第三步与Flashbots有关。第二步用38 ETH购买KEANU(0x00ed)。该交易受到“沙盒攻击”(通过Flashbots)的攻击——这使得攻击者本人也成为了“沙盒攻击”的受害者。第三步(0xa945)在uniswap上出售MFund,这创造了一个套利机会,被Flashbots的搜索者捕获。

关于BlockSec

BlockSec是一家开创性的区块链安全公司,成立于2021年,由一群全球顶尖的安全专家组成。公司致力于提升新兴Web3世界的安全性和可用性,以促进其大规模采用。为此,BlockSec提供智能合约和EVM链安全审计服务,用于安全开发和主动威胁拦截的Phalcon平台,用于资金追踪和调查的MetaSleuth平台,以及供Web3构建者在加密世界高效冲浪的MetaDock扩展。

迄今为止,公司已为MetaMask、Uniswap Foundation、Compound、Forta和PancakeSwap等300多家尊贵客户提供服务,并在两轮融资中从Matrix Partners、Vitalbridge Capital和Fenbushi Capital等知名投资机构获得了数千万美元的投资。

官方网站:https://blocksec.com/

官方Twitter账号:https://twitter.com/BlockSecTeam

Sign up for the latest updates
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.

FATF’s New Stablecoin Report Signals a Shift to Secondary-Market Compliance
Knowledge

FATF’s New Stablecoin Report Signals a Shift to Secondary-Market Compliance

BlockSec interprets FATF’s March 2026 report on stablecoins and unhosted wallets, explains why supervision is shifting toward secondary-market P2P activity, breaks down the report’s main recommendations and red flags, and shows how on-chain monitoring, screening, and cross-chain tracing can help issuers and VASPs respond with stronger, more effective compliance controls.

Weekly Web3 Security Incident Roundup | Mar 16 – Mar 22, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Mar 16 – Mar 22, 2026

This BlockSec weekly security report covers seven DeFi attack incidents detected between March 16 and March 22, 2026, across Ethereum, BNB Chain, Polygon, and Polygon zkEVM, with total estimated losses of approximately $82.7M. The most significant event was the Resolv stablecoin protocol's infrastructure-key compromise, which led to over $80M in unauthorized USR minting and cross-protocol contagion across lending markets. Other incidents include a $2.15M donation attack combined with market manipulation on Venus Protocol, a $257K empty-market exploit on dTRINITY (Aave V3 fork), access control vulnerabilities in Fun.xyz and ShiMama, a weak-randomness exploit in BlindBox, and a redemption accounting flaw in Keom.

Best Security Auditor for Web3

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

BlockSec Audit