零时科技 || Spectra攻击事件分析

币界网Published on 2024-07-26Last updated on 2024-07-26

币界网报道:

AZvLVBueS8dPHk3YIbziS3gpLnKyfry9IYBrqrSW.jpeg

背景介绍

2024年7月23日,我们监控到一笔Ethereum链上攻击交易:https://etherscan.io/tx/0x491cf8b2a5753fdbf3096b42e0a16bc109b957dc112d6537b1ed306e483d0744

被攻击的项目为Spectra Protocol,Spectra协议是无需许可的,意味着其服务完全开放供公众使用。任何人都可以随意创建新的市场、交换收益衍生品或成为流动性提供者。此次攻击中,攻击者共获利188, 013asdCRV,折合73, 325USD。 

攻击及事件分析

首先,攻击者查询了asd CRV Token中,地址 0x279a7dbfae376427ffac52fcb0883147d42165ff对Spectra Protocol的授权额度与该地址的asd CRV余额。

图片

接着,攻击者调用execute函数开始针对Spectra Protocol进行攻击,execute函数代码如下:

图片

最终,输入数据会调用_dispatch,该函数的代码如下:

图片

由上述代码我们可以看出,该代码根据_commandType来决定执行哪些操作,在此次攻击中,_commandType为0x12 ,所以command=0x12&0x3f=0x12,对应的值为KYBER_SWAP

图片

所以,攻击者调用代码段如下。我们可以看到,该代码的kyberRoutertargetData均可以被控制,意味着攻击者可以利用Spectra Protocol合约调用任意合约并传入任意参数。

图片

我们将攻击者的inputs数据解析出来如下:

图片

我们可以发现,kyberRouter已经被操纵为地址:

0x43e54c2e7b3e294de3a155785f52ab49d87b9922

tokenIn已经被操纵为地址:

0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

tokenOut被操纵为地址:

0xba8ce86147ded54c0879c9a954f9754a472704aa

我们可以看到Constants.ETH为:

0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

图片

所以,代码进入到如下流程

图片

其中,targetData经过解析如下:

图片

由于,transferFrom的signature为0x23b872dd;所以,transferFrom对应的参数from为:

0x279a7dbfae376427ffac52fcb0883147d42165ff

to为:

0xba8ce86147ded54c0879c9a954f9754a472704aa

value为:

188,013,365,080,870,249,823,427

又因为,kyberRouter被控制为:

0x43e54c2e7b3e294de3a155785f52ab49d87b9922,即asdCRVToken。

所以,攻击者相当于操纵了Spectra Protocol从0x279a7dbfae376427ffac52fcb0883147d42165ff转了188,013,365,080,870,249,823,427asdCRV到地址0xba8ce86147ded54c0879c9a954f9754a472704aa(此地址为攻击者控制的地址)。

至此,攻击者完成攻击。 

总结

本次漏洞的成因是被攻击合约对攻击者传入参数校验不严格,导致攻击者可以通过构造特殊的inputData来使受害者合约调用任意合约并传入任意参数。最终,攻击者利用特殊的参数,使得受害者合约通过transferFrom将授权给其合约的代币转入到攻击者控制的地址。建议项目方在设计代码运行逻辑时要多方验证,合约上线前审计时尽量选择多个审计公司交叉审计。 

Related Reads

Summary of Kevin Warsh's Past Remarks: How Will This Prospective 'New Head' Upend the Fed?

Kevin Warsh, nominated by President Trump to replace Fed Chair Powell, is poised to introduce sweeping reforms at the Federal Reserve. His agenda includes structural changes, advocating for lower policy rates, a fundamentally new approach to inflation, a significantly smaller balance sheet, safeguarding Fed independence, narrowing the Fed’s mandate, improving coordination with the Treasury, and reducing communication “noise” from policymakers. Warsh has criticized current monetary policy as “broken” and called for “fundamental regime change,” arguing that continuity is meaningless when the Fed has lost credibility. He believes interest rates should be lower and that a smaller balance sheet would help achieve that, describing the current one as “multiple trillions of dollars larger than necessary.” On inflation, he attributes its rise to cognitive errors at the Fed—including overreliance on flawed models, neglect of money supply, and blaming external factors rather than excessive government spending. He also suggests AI could lead to a structural decline in prices. He strongly defends Fed independence as its “most important asset” and warns against mission creep, which he says risks its core objectives and increases political vulnerability. He proposes closer coordination with the Treasury to align balance sheet and debt issuance plans, clarifying expectations for markets. Regarding communication, Warsh supports transparency but criticizes the current “cacophony of voices” and “forward guidance” that creates ambiguity. He has urged Fed officials to speak less frequently to avoid market confusion.

marsbit9m ago

Summary of Kevin Warsh's Past Remarks: How Will This Prospective 'New Head' Upend the Fed?

marsbit9m ago

Arbitrum Pretends to Be the Hacker, 'Steals' Back the Money Lost by KelpDAO

Title: Arbitrum Poses as Hacker to Recover Stolen Funds from KelpDAO Last week, KelpDAO suffered a hack resulting in nearly $300 million in losses, marking the largest DeFi security incident this year. Approximately 30,765 ETH (worth over $70 million) remained on an Arbitrum address controlled by the attacker. In an unprecedented move, Arbitrum’s Security Council utilized its emergency authority to upgrade the Inbox bridge contract, adding a function that allowed them to impersonate the hacker’s address and initiate a transfer without access to its private key. The council’s action, approved by 9 of its 12 members, moved the stolen ETH to a frozen address in a single transaction before reverting the contract to its original state. The operation was coordinated with law enforcement, which attributed the attack to North Korea’s Lazarus Group. Community reactions are divided: some praise the recovery of funds, while others question the centralization of power, as the council can upgrade core contracts without governance votes. However, such emergency mechanisms are common among major L2s. Despite the partial recovery, over $292 million was stolen in total, with more than $100 million in bad debt on Aave and remaining funds scattered across other chains. The incident highlights escalating security challenges in DeFi, with state-sponsored hackers employing advanced tactics and L2s responding with elevated countermeasures.

marsbit19m ago

Arbitrum Pretends to Be the Hacker, 'Steals' Back the Money Lost by KelpDAO

marsbit19m ago

iQiyi Is Too Impatient

The article "iQiyi Is Too Impatient" discusses the controversy surrounding the Chinese streaming platform IQiyi's recent announcement of an "AI Actor Library" during its 2026 World Conference. IQiyi claimed over 100 actors, including well-known names like Zhang Ruoyun and Yu Hewei, had joined the initiative. CEO Gong Yu suggested AI could enable actors to "star in 14 dramas a year instead of 4" and that "live-action filming might become a world cultural heritage." The announcement quickly sparked backlash. Multiple actors named in the list issued urgent statements denying they had signed any AI-related authorization agreements. This forced IQiyi to clarify that inclusion in the library only indicated a willingness to *consider* AI projects, with separate negotiations required for any specific role. The incident, which trended on social media with hashtags like "IQiyi is crazy," is presented as a sign of the company's growing desperation. Facing intense competition from short-video platforms like Douyin and Kuaishou, as well as Bilibili and Xiaohongshu, IQiyi's financial performance has weakened, with revenues declining for two consecutive years. The author argues that IQiyi is "too impatient" to tell a compelling AI story to reassure the market, especially as it pursues a listing on the Hong Kong stock exchange. The piece concludes by outlining three key "AI questions" IQiyi must answer: defining its role as a tool provider versus a content creator, balancing the "coldness" of AI with the human element audiences desire, and properly managing the interests of platforms, actors, and viewers. The core dilemma is that while AI can reduce costs and increase efficiency, it risks creating homogenized, formulaic content and devaluing human performers.

marsbit1h ago

iQiyi Is Too Impatient

marsbit1h ago

Trading

Spot
Futures

Hot Articles

Discussions

Welcome to the HTX Community. Here, you can stay informed about the latest platform developments and gain access to professional market insights. Users' opinions on the price of ETH (ETH) are presented below.

活动图片