MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

Odaily星球日报Опубликовано 2023-11-02Обновлено 2023-11-02

Введение

揭露黑客是如何利用治理提案和协议漏洞对Onyx Protocol发起这场攻击。

11 月 1 日,MetaScout 监测到以太坊上的借贷协议 Onyx Protocol 遭受了一次闪电贷攻击,损失了 210 万美元。根本原因是黑客盯上并首先执行了添加新市场的提案,以及 Compound 分叉协议中存咋 id 精度损失问题。

MetaTrust Labs 据此对该事件进行了深入的研究和分析,揭露黑客是如何利用治理提案和协议漏洞对 Onyx Protocol 发起这场攻击。

关于 Onyx Protocol

Onyx Protocol(https://docs.onyx.org/)是一个借贷市场,旨在为以太坊网络上的用户提供安全和无需信任的信贷和借贷服务。

MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

在 2023 年 10 月 29 日,Onyx Protocol(https://x.com/OnyxProtocol/status/1718348637158137858?s=20)启动了提案 OIP-22 ,以将$PEPE 添加到市场中。然而遗憾的是,该提案被黑客盯上并加以攻击了。

MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

同时,从 Onyx 链上部署的合约来看,它是 Compound 衍生协议,由于遭受攻击,其 TVL 从 286 万美元下降到 55 万美元。

MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

攻击行动

MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

攻击损失

两笔攻击交易的总损失约为 214 万美元

MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

攻击者

0xdec2F31C3984F3440540DC78Ef21b1369d4eF767 0x5083956303a145f70ba9f3d80c5e6cb5ac842706

攻击合约

0x052ad2f779c1b557d9637227036ccaad623fceaa

受攻击合约

代理合约:https://etherscan.io/address/0x5fdbcd61bc9bd4b6d3fd1f49a5d253165ea11750 

实现合约:https://etherscan.io/address/0x9dcb6bc351ab416f35aeab1351776e2ad295abc4#code

治理合约

https://etherscan.io/address/0xdec2f31c3984f3440540dc78ef21b1369d4ef767

攻击步骤

TL;DR

以攻击交易0x f 7 c 216 为例

1. 黑客(0x 085 bDf)首先执行提案 OIP-22 以添加一个名为 oPEPE(0x 5 fdbcd)的新市场

MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

2. 在新市场添加后的一分钟内,从 AAVE 启动了一个闪电贷并获得了 4, 000 个$WETH

  1. 将 4, 000 个$WETH 兑换成 2, 520, 870, 348, 093 个$PEPE

  2. 将所有的$PEPE 转移到地址0x f 8 e 153 

    MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

  3. 在上述地址0x f 8 e 153 创建合约,使用 1 个$PEPE 铸造了 50, 000, 000, 000, 000, 000, 000 个$oPEPE,赎回了绝大部分$oPEPE,仅剩下 2 wei 给 oPEPE 市场

  4. 将 2, 520, 870, 348, 093 个$PEPE 转移到 oPEPE 并以$oPEPE 进入市场

  5. 借入 334 个$ETH

  6. 由于精度损失问题,仅赎回了 1 wei 的$oPEPE 就换取了 2, 520, 870, 348, 093 个$PEPE

  7. 汇率 = (总现金 + 总借出 - 总储备)/总供应 = 2, 520, 870, 348, 093, 423, 681, 390, 050, 791, 472 / 2 = 1, 260, 435, 174, 046, 711, 840, 695, 025, 395, 736 

    赎回金额 = 2, 520, 870, 348, 093, 423, 681, 390, 050, 791, 470 

    由于受到交易截断,赎回令牌 = 赎回金额 / 汇率 = 1 

    MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?清算借款人(0x f 8 e 153)的 881, 647, 840 wei $PEPE

    赎回了 856, 961, 701 wei $PEPE

  8. 从步骤 b 到步骤 f 重复以上步骤,借入$USDC、$USDT、$PAXG、$DAI、$WBTC 和$LINK,兑换成$ETH

3. 用 4, 002 个$WETH 还清 AAVE 的闪电贷,从中获得了 1156.9 个$ETH 的利润

根本原因

  • 一方面,黑客非常熟悉 Compound 协议的精度损失问题,并提前注意到了 Onyx Protocol 的漏洞,因此,黑客可能早早的意识到了提案 OIP-22 中的问题,一旦提案激活并准备好执行,黑客抢先执行该提案,并在仅仅一分钟后就发动了攻击。

  • 另一方面,精度损失漏洞是攻击的根本原因。黑客操纵了 totalSupply 使其变成一个极小的值即 2 ,并将 totalCash 增加到极大的值,即2520870348093423681390050791471,以放大 exchangeRate,从而导致在赎回时产生计算截断。

MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

安全建议

  • 对治理提案进行详细的审计,不仅限于智能合约,特别是在初始化场景和其他边缘情况下;

  • 考虑在市场初始化时添加少量份额以防止操纵,尤其是对于 Compound 协议;

  • 建议采用监控系统,在紧急情况发生时暂停协议。如果 Onyx 已经有一个监控系统,第二次攻击交易发生超过半小时后可能会被阻止以减少损失。另外,整合一个内存池阻塞系统会非常有益。这个系统可以有效地检测攻击者在执行攻击时在内存池中的攻击交易,允许进行预防性阻止以避免损失。

资金流向

截稿时,攻击者(0x 085 bDf)已使用另一个受控地址(0x 4 c 9 c 86)将 1140 个$ETH 转移到混币平台 Tornado.Cash

MetaTrust:Onyx的治理和漏洞是如何沦为黑客的“金铲子”?

另一位攻击者仍然将窃取的代币保留在钱包中(0x 508395)

同类攻击案例

这个漏洞类似于 2023 年 4 月 15 日的 Hundred Finance 遭受的黑客攻击,该攻击导致损失约 700 万美元。 交易链接:0x6e9ebcdebbabda04fa9f2e3bc21ea8b2e4fb4bf4f4670cb8483e2f0b2604f451

关于 MetaTrust Labs

MetaTrust Labs 是新加坡南洋理工大学孵化的领先Web3人工智能安全工具和代码审计服务提供商。我们提供先进的 AI 解决方案,赋予开发者和项目相关者保护Web3应用程序和智能合约的能力。我们的综合服务包括 AI 安全扫描、代码审计、智能合约监控和交易监控。在 MetaTrust Labs,我们致力于保护Web3领域,使构建者能够充满信心和可靠地进行创新。

Website: metatrust.io

Twitter: @MetatrustLabs

Похожее

Near Returns to the AI Stage: Transformation into a Public Chain Due to 'Payroll Difficulties,' Agent and Privacy Emerge as New Growth Narratives

NEAR Returns to AI Origins: From Payroll Struggles to Blockchain, Now Focusing on AI Agents and Privacy NEAR Protocol's journey began not with grand blockchain ambitions, but from a practical hurdle: its AI startup founders, including Transformer paper co-author Illia Polosukhin, couldn't efficiently pay international developers in 2017. This led them to pivot and build a high-performance, scalable blockchain. After years navigating various crypto narratives like sharding and cross-chain interoperability, NEAR is now leveraging its AI roots to re-enter the AI arena. A key driver is its "NEAR Intents" layer, which abstracts complex cross-chain transactions. Users simply state their goal (e.g., swap BTC for ETH), and a solver network finds the optimal route. This system has processed over $20B in cross-chain volume, generating significant fee revenue. A major growth area is private transactions via "Confidential Intents/Swaps," which hide trade details until settlement to protect against MEV and front-running. Remarkably, private swaps recently accounted for over 40% of NEAR's transaction volume, highlighting strong demand but also potential regulatory scrutiny. With its AI-founder pedigree, NEAR is positioning itself at the intersection of blockchain, AI agents, and privacy, aiming to become infrastructure for the emerging agent economy while navigating the challenges of its rapid adoption.

marsbit1 ч. назад

Near Returns to the AI Stage: Transformation into a Public Chain Due to 'Payroll Difficulties,' Agent and Privacy Emerge as New Growth Narratives

marsbit1 ч. назад

From Ethereum to AI's 'CROPS': What Exactly is This Set of 'Slow Variables' That Vitalik Repeatedly Emphasizes?

In recent discussions, Vitalik Buterin has frequently emphasized the concept of "CROPS," a framework defining core values for Ethereum's development. CROPS stands for Censorship Resistance, Capture Resistance, Open Source, Privacy, and Security. Initially outlined in the Ethereum Foundation's "EF Mandate," it represents a commitment to user sovereignty, ensuring that the network resists external control, remains open, protects privacy, and prioritizes security. The relevance of CROPS extends beyond Ethereum's foundational principles, becoming crucial in the context of AI integration. As AI agents begin handling wallet operations and automated transactions, the risk increases that users may cede control over their digital assets, privacy, and intentions to centralized AI service providers. A "CROPS AI" would therefore emphasize local execution where possible, privacy-preserving remote model calls (e.g., using zero-knowledge proofs), and transparent, verifiable processes to maintain user agency. Vitalik highlights a significant convergence between "CROPS Ethereum access layer" and "CROPS AI." Both address the same fundamental challenge: how users can access powerful services—be it blockchain data via RPCs or AI models—without exposing sensitive information or relinquishing ultimate control. This intersection points toward a future digital entry point that is more private, secure, and user-controlled. Ultimately, CROPS is not merely an abstract ideal but a practical guidepost. It steers development—from protocol resilience and wallet design to AI agent safety—towards a future where users retain self-sovereignty even as digital systems grow more complex and powerful. In an era of accelerating AI adoption, these "slow variables" of censorship resistance, openness, privacy, and security may define Ethereum's enduring value.

marsbit1 ч. назад

From Ethereum to AI's 'CROPS': What Exactly is This Set of 'Slow Variables' That Vitalik Repeatedly Emphasizes?

marsbit1 ч. назад

Silicon Valley 'Startup Guru' Steve Hoffman: Web3 + AI Could Be a Trap

Silicon Valley investor and "Godfather of Startups" Steve Hoffman warns that combining Web3 with AI is likely a trap, not a promising venture. In an interview, Hoffman argues that while AI is a foundational technology touching all industries, Web3 adds complexity, friction, and regulatory risk without solving mainstream consumer or business needs. He advises founders to focus on deep, specialized applications where startups can out-iterate giants, rather than on generic features easily replicated by large tech companies. Hoffman observes that Silicon Valley will lead foundational AI research, while China excels at rapid, large-scale application and commercialization, particularly in robotics. He stresses that AI-driven autonomous agents capable of collaborative, multi-step tasks are 2-4 years away, which will cause significant job displacement. The solution is not to slow AI but to redesign business models around human-AI collaboration and reform social systems like education and retraining. For startups, Hoffman recommends focusing on vertical, expertise-heavy domains to build defensibility. He sees major opportunities in AI fraud detection and cybersecurity. Key founder mindsets include systemic thinking over feature-focus, relentless customer centricity, building adaptive teams, and deeply understanding AI's capabilities and limits. Hoffman is also leading a non-profit initiative to establish university centers aimed at training future leaders in responsible, human-value-aligned AI innovation.

marsbit2 ч. назад

Silicon Valley 'Startup Guru' Steve Hoffman: Web3 + AI Could Be a Trap

marsbit2 ч. назад

Token Inefficient, Economy Tokenless

The article "Tokens Aren't Economical, Economics Aren't Tokenized" analyzes a pivotal shift in the AI industry from a technology-driven narrative to one dominated by capital efficiency. It highlights two concurrent trends: a severe capital shortage due to the exorbitant and recurring costs of compute (e.g., OpenAI's high burn rate) and a wave of corporate spin-offs where major tech companies are separating their AI units (like Kuaishou's Kling and Baidu's Kunlunxin). The core argument is that AI's "anti-internet" business model, where user growth increases costs rather than profits, has created a disconnect between high valuations and actual cash flow. Spin-offs address this by allowing AI assets to be valued independently. Within a parent company, they are seen as cost centers, but as standalone entities, they are priced based on their growth potential and scarcity in the primary market, leading to massive valuation premiums (e.g., Kling's estimated value tripling post-spin-off). The industry is at an inflection point, moving from "model worship" to "value realization." The competition is evolving from a pure compute (GPU) race to a broader focus on systemic efficiency and full-stack engineering (involving CPUs and orchestration) to achieve viable commercialization. The year 2026 is framed as a critical moment where the industry must definitively answer how to economically translate AI capability into tangible business value, reshaping the sector's future power structure.

marsbit3 ч. назад

Token Inefficient, Economy Tokenless

marsbit3 ч. назад

Торговля

Спот
Фьючерсы
活动图片