50万美元的血泪教训:一个简单的签名如何导致资产被盗?

区块律动Published on 2022-08-30Last updated on 2022-08-30

Abstract

你可能很难想象,Metamask 中一个简单的签名就能掏空你的钱包。

你可能很难想象,Metamask 中一个简单的签名就能掏空你的钱包。但这样的事却发生在了一名资深用户身上,今天他因一个漏洞损失了近 50 万 USDC 。如果不多加小心的话,你可能就是下一个他。所以,今天我想和大家讲讲这件事的来龙去脉,告诉大家以后如何注意此类问题。

那是在一个安静的午后时分,Joe(化名)突然发现自己的钱包被转走了 46.9 万 USDC。这次转账并不简单,肯定不是攻击者能做出的行为,因为他们根本不可能得到 Joe 钱包的权限。那就说明,转走他所有 USDC 的应该是某个恶意合约。

在讲述今天的故事之前,我需要先向大家解释一些术语。USDC 是以太坊上的一个具有多种功能的合约,规定了我们可以如何使用 USDC。

在众多功能当中,我们需要特别关注下面两项功能:

转账(transfer)

代转(transferFrom)

当你需要在钱包之间转移 USDC,或其他 ERC20s 时,就需要用到转账功能。它可以将 Token 从调用者(调用该功能的地址)转移到其他地址。如果有人能以你的名义恶意使用该功能,那么他一定得先掌握了你钱包的全部权限才行。

当你与合约产生互动时,它们会通过代转功能来转移你的 Token,具体金额由你提前预设好的比例决定。因此,如果你允许一项合约转移无限量的 USDC,那么理论上它就可以拿走你所有的 USDC。

现在让我们回到 Joe 的故事当中,转走他全部 USDC 的确实就是 transferFrom 功能。然而,只有当 Joe 批准合约使用他的 USDC 时,transferFrom 才能发挥作用。但事实上,Joe 坚信自己没有批准任何事项。

可是,DeBank 的交易记录清楚地显示,在漏洞发生前 10 分钟,该恶意合约可以无限使用账户中的 USDC。那么问题就在于,如果不是 Joe 本人的话,究竟是谁给了该合约这一项批准呢?我只能说,Joe 确实批准了这一操作,但却是在他不知情的情况下完成的。

Etherscan 上的信息显示,Joe 本人确实没有调用该功能,真正批准了这一额度的是其他地址,这才让恶意合约得以花光 Joe 全部的 USDC。

我们不禁疑问,别人怎么能代替我给予合约许可呢?

许可功能的引入原本是为了改善以太坊的用户体验,它只需一个签名就可以让用户在不提交交易的情况下修改批准金额。也就是说,只要有了你的签名,任何人都可以调用许可功能,并更新你对合约的批准额度。

当你使用 1inch dApp 时,你就可以体验到这一功能。如果你想在上面出售 USDC,那你并不需要事先批准,只需要签上你的名字就够了。有了这个签名,1inch 便获取了你全部 USDC 的使用权限。虽然 1inch 不会无缘无故花光你所有的 USDC,但这却给了恶意合约机会。

Joe 一定是不小心在一个恶意网站上签署了这样的信息。不幸的是,那一次他用的是热钱包,签名只是随手点击一下就完成了。如果他用的是硬件钱包的话,就需要在外部设备上签署信息,那么还会有一个思考的时间。

有了 Joe 的签名,其他地址便可以提交一个带有许可功能的交易,这样恶意合约就获取了 Joe 钱包全部 USDC 的使用权限。然后,只要它调用 transferFrom 功能,就可以转走全部这些资金了。

所以说,一个看似小小的签名却可以引来巨大的灾难。在某些情况下,Metamask 会在你准备签名是对你发出警告,告知你其中的危险性。签署一个信息可能是危险的。但一些技术层面上的批准签名却不会收到预警,但这些一旦滥用往往会造成巨额的损失。

如何避免今后遇到类似的问题?

1. 不要在 Metamask 中签署一切内容;

2. 花点时间了解你所签署的内容;

3. 对传统的批准事项要格外小心。

Related Reads

STRC 跌破面值,比特币财库实验进入下半场

The price of STRC, Strategy's dividend-paying preferred stock, has fallen below its $100 face value, triggering a re-evaluation of the "bitcoin treasury" corporate model. This highlights a critical tension: the company's asset base consists of high-volatility, non-cash-flow-generating Bitcoin, while its capital structure requires continuous cash payouts for dividends and interest. The decline of STRC signals that market pressure is shifting from asset price volatility to the pricing of the company's financing tools. Strategy's core model involves a three-step conversion: turning equity into Bitcoin exposure, converting Bitcoin holdings into capital market credit, and packaging non-yielding BTC into cash-paying securities like STRC. While Strategy holds a massive 847,363 BTC, the focus is now on cash flow mismatches. The company faces annual preferred stock dividend obligations of approximately $1.7 billion, far exceeding the cash flow from its legacy software business. Its ability to meet these obligations relies on continued access to capital markets. The market is now scrutinizing which of three potential costs becomes untenable first: rising dividend costs to attract investors, dilution costs from issuing more common stock, or the reputational cost of selling BTC—a move contrary to its "hodl" narrative. For the broader crypto market, a constrained Strategy means the potential loss of a predictable, narrative-driven marginal buyer for Bitcoin. The STRC discount serves as a reminder that the longevity of such models depends not just on Bitcoin's price, but also on financing windows, cash reserves, and investor willingness to pay a "trust premium" for the structure.

marsbit29m ago

STRC 跌破面值,比特币财库实验进入下半场

marsbit29m ago

Standard Chartered Bank’s 50-Fold Fantasy: Predicting AAVE to Reach $3,500

Standard Chartered Bank has issued an optimistic research report predicting that the AAVE token could surge 50-fold to $3,500 by 2030. This forecast is based on the projection that the total value locked (TVL) in DeFi will grow 37x to approximately $2.7 trillion, driven by stablecoin expansion and the tokenization of real-world assets (RWA). The bank's model links Aave's potential valuation directly to its protocol revenue, which is primarily driven by net interest margins. The report highlights Aave's current dominant position, noting it captures over 80% of the net earnings ("protocol retained earnings") in the lending sector while holding only about half of its TVL. It also points to the recent launch of the Aave V4 architecture and a healthy revenue stream of $142 million in 2025 as positive fundamentals. Grayscale's separate analysis, applying traditional valuation metrics like DCF, concluded AAVE is currently undervalued. However, the article notes significant challenges. Aave's peer-to-pool lending model suffers from inherent capital inefficiency, with an estimated $52 million annual "deadweight loss" due to idle funds needed for liquidity buffers. This structural flaw was exposed during the April KelpDAO exploit, which locked a WETH pool at 100% utilization for days. Emerging protocols like Morpho, with more efficient point-to-point models, are cited as growing competitive threats. In summary, while institutional forecasts paint a macro picture of massive growth fueled by RWA adoption, Aave's path forward hinges on addressing its core structural limitations and competitive pressures within the evolving DeFi lending landscape.

链捕手1h ago

Standard Chartered Bank’s 50-Fold Fantasy: Predicting AAVE to Reach $3,500

链捕手1h ago

Tidal Investment: We Remain Bullish on the AI Industry Chain, But the Reasons Have Changed

Tidal Investment remains optimistic about the AI industry chain, but the rationale has shifted. The market narrative has changed. While recent large-scale IPOs (e.g., SpaceX) and major fundraising plans by tech giants like Alphabet and Meta have caused some nervousness, this isn't a sign of an AI peak. The focus has moved from the initial question of AI's viability to the sustainability of massive investment cycles. The key players—primarily the major cloud providers—are not slowing down; their capital expenditure (Capex) guidance for 2026 has been increased across the board (e.g., Alphabet to $180B, Amazon to $200B). This investment cycle is proving resilient and difficult to stop. Unlike traditional hardware cycles, current AI Capex is distributed across multiple physical layers—computing, memory, networking, and critically, power infrastructure. Bottlenecks are shifting from chips to elements like electricity, transformers, and cooling systems, which have much longer lead times and cannot be easily pre-built like fiber optics during the dot-com bubble. Supply chain data (e.g., Eaton's 240% YoY data center orders) confirms this broad-based, project-driven expansion. Market concerns are acknowledged but viewed differently. First, while Capex growth currently outpaces revenue growth, raising ROI questions, this mirrors the early scaling phase of cloud computing itself. A change in view would require concrete signals like downward Capex revisions or missed AI product targets, which haven't materialized by mid-2026. Second, comparisons to the 2000 dot-com bust are flawed. That crash was driven by a massive, parallel oversupply of cheap capacity (fiber). The current cycle faces *supply constraints* in critical, capital-intensive physical infrastructure that cannot be overbuilt as easily. In conclusion, the wave of fundraising reflects the next, more complex act of the AI story. Physical bottlenecks and sustained high Capex plans suggest this is not the finale but an ongoing, capital-intensive build-out phase. The script has changed, but the play is far from over.

marsbit2h ago

Tidal Investment: We Remain Bullish on the AI Industry Chain, But the Reasons Have Changed

marsbit2h ago

Trading

Spot
Futures
活动图片