慢雾:Stars Arena 被黑简析

web3caff2023-10-27 tarihinde yayınlandı2023-10-27 tarihinde güncellendi

Özet

本文将简析攻击者是如何利用 Stars Arena 的重入漏洞获利。

本文将简析攻击者是如何利用 Stars Arena 的重入漏洞获利。
作者:慢雾安全团队,慢雾科技
背景
据慢雾 MistEye 系统安全预警,2023 年 10 月 7 日,Avalanche 链上社交协议 Stars Arena 遭攻击,损失约 290 万美元。慢雾安全团队简析该攻击事件并将结果分享如下。
相关信息
攻击者地址:
https://snowtrace.io/address/0xa2ebf3fcd757e9be1e58b643b6b5077d11b4ad7a
攻击合约:
https://snowtrace.io/address/0x7f283edc5ec7163de234e6a97fdfb16ff2d2c7ac
https://snowtrace.io/address/dd9afc0e3c43951659c8ebe7aef9ee40879863ea
攻击交易:
https://snowtrace.io/tx/0x4f37ffecdad598f53b8d5a2d9df98e3c00fbda4328585eb9947a412b5fe17ac5
攻击核心
攻击者利用重入漏洞,篡改自己存款份额所对应的价格。随后在卖出时,又因该恶意操纵的价格计算依赖,导致类似的价格操控。通过精确计算重入时更新的份额价格,攻击者窃取了合约中的资金。
交易分析
我们可以发现攻击交易中存在一笔重入调用,我们通过反编译代码逐步分析调用方式。

攻击者先创建攻击合约(0x7f283 和 0xdd9af),通过攻击合约调用 Stars Arena: Shares 合约的 0xe9ccf3a3 方法,然后存入 1 枚 AVAX 代币。

根据反编译后的代码一步步跟踪,攻击者首先用的 0xe9ccf3a3 方法是一个类似于存款的函数,其中会调用 0x326c 和 0x2058 方法。0x326c 方法仅作为参数返回的调用,而 0x2058 方法类似于一个处理某种代币购买或交换的函数,该方法通过 0xe9ccf3a3 所传入的 AVAX 代币数额及地址来进行下一步操作及份额和费用的计算。

跟进 0x2058 方法第 92 行的调用逻辑,可以发现 0x1a9b 方法为一个计算函数,计算出的结果是一个类似于价格的值,其返回值为新计算出的 v24 / 0xde0b6b3a7640000 或者是 _initialPrice。
之后的 109 行,110 行及 116 行的 0x307c 和 0x30ef 方法中就存在 low-level call 的调用,而 0x30ef 的 call 还是对 varg1 也就是传入的 0xdd9af 攻击合约地址的外部调用。函数没有防重入锁的约束,并且在执行完外部调用后,此方法才会向下执行之后的 if 判断来更新 field0.length 及 field0 参数。毫无疑问,重入就是在此处发生的。

我们再来看攻击者在重入调用中构造的数据。

重入外部调用的是 0x5632b2e4 方法,并传入攻击者所构造的的 4 个参数,这些参数通过进制转化 153005ce00 为 91000000000。
正如上面讲到的,对 0x5632b2e4 方法的外部调用是执行在 if (varg0 == _getMyShares[address(varg1)][msg.sender]) 判断之前。这时 field0.lengt 值为 0, 并未更新。攻击者正好通过这个方式绕过 0x5632b2e4 方法中的判断,将 msg.sender 也就是攻击合约 0xdd9af 的以下 4 个参数状态都修改为了外部调用是时构造的数据。

通过以上操作之后,攻击者调用了 sellShares 来卖出自己的份额,获得了 266,102.97278 枚 AVAX。

深入 sellShares 函数,函数起先就调用了 0x1a9b 方法,而在之前的 0x2058 方法中就曾存在调用,是处理某种代币购买或交换的函数。我们可以发现,在 0x1a9b 方法中的 0x2329 方法会更新 owner_9f[varg0],而这个参数在重入时就已经被修改为攻击者所构造的 91000000000。

回到 0x1a9b 方法中,根据之前恶意构造的值重新计算(计算数额见注释)。

经过以上计算,新计算出的份额所对应的价格发生了改变,计算出的结果为 274,333.061476814e18。再经过一系列的费用收取过后,攻击者在没有修改份额的情况下使用恶意构造操纵的价格,卖出份额,成功获利。
总结
本次攻击的核心在于重入攻击所造成的价格计算依赖更新,进而导致了类似恶意价格操控。慢雾安全团队建议项目方应尽可能在经过多家安全公司审计后,再进行合约的部署发布;同时在编码时应尽可能满足 Checks-Effects-Interactions 编码规范,添加防重入锁。
免责声明:作为区块链信息平台,本站所发布文章仅代表作者及嘉宾个人观点,与 Web3Caff 立场无关。文章内的信息仅供参考,均不构成任何投资建议及要约,并请您遵守所在国家或地区的相关法律法规。

İlgili Okumalar

Macroeconomic Origins of the African Payments Market Structure

Africa’s payment landscape exhibits the world’s highest mobile money penetration and fastest cryptocurrency adoption. This is not a market anomaly but a macroeconomic inevitability driven by deep structural factors: a vast, young population, heavy reliance on commodity exports and remittances generating massive cross‑border payment needs, and a chronically underdeveloped formal banking system plagued by de‑risking, high inflation, and currency instability. This vacuum has allowed mobile money (e.g., M‑Pesa) to become the primary payment channel domestically, while cryptocurrencies—particularly stablecoins—serve as a store of value against local‑currency depreciation and a lower‑cost cross‑border medium. The key divide is the Sahara: North Africa integrates with the MENA oil‑centric financial system, while Sub‑Saharan Africa, facing acute dollar shortages and fragmented currencies, is the epicenter of this fintech surge. Structural reliance on dollars, driven by trade deficits and weak local currency credibility, creates persistent dollar scarcity, which crypto and mobile payments effectively address. Efforts like the Pan‑African Payment and Settlement System (PAPSS) aim at de‑dollarization, but these alternatives will remain essential as long as underlying economic constraints—commodity dependence, limited industrialization, and financial exclusion—persist.

marsbit6 dk önce

Macroeconomic Origins of the African Payments Market Structure

marsbit6 dk önce

AAOI Defies Trend with Over 10% Surge, 'New Stock God' Serenity Predicts Potential to Double Again

On June 4th, despite a significant sell-off in the broader AI and semiconductor sector triggered by Broadcom's disappointing guidance, Applied Optoelectronics (AAOI) surged over 11%, showcasing a sharp divergence in market sentiment. Broadcom's warning about potential supply chain diversification by key customer Google and a weaker-than-expected outlook punctured the high-flying AI valuation narrative. This led to heavy selling in names like Broadcom (-12.6%) and Micron (-7%), with funds rotating into traditional industrial stocks. AAOI defied this trend. The stock has experienced high volatility recently, driven by bullish analyst coverage, notably from Rosenblatt which raised its price target to $220. Key catalysts include initial 800G optical module revenue from Amazon, potential certification from Oracle, and strong demand across its product portfolio. The company has reported cumulative orders for 800G/1.6T modules exceeding $324 million and is aggressively expanding manufacturing capacity in Texas, targeting an annualized run-rate of $1.4 billion for its module business by Q3 2027. However, AAOI's fundamentals present a mixed picture. Its Q1 2026 results missed expectations, showing a GAAP net loss, and Q2 guidance points to merely breakeven adjusted EPS. Risks include a delayed 800G production ramp to the second half of the year and high dependence on a few key cloud customers. Recent stock sales by company executives near price highs also noted. The article suggests AAOI's rally reflects a market beginning to differentiate within the AI ecosystem. While Broadcom's issues prompted a reassessment of custom ASIC and customer concentration risks, funds flowing into AAOI indicate a belief that the "physical bottleneck" narrative for optical connectivity—where supply remains tight—remains intact and is somewhat decoupled from the current sector weakness. The sustainability of AAOI's premium valuation now hinges on the successful execution of its production plans and upcoming quarterly results.

marsbit13 dk önce

AAOI Defies Trend with Over 10% Surge, 'New Stock God' Serenity Predicts Potential to Double Again

marsbit13 dk önce

Worried about AI's Self-Evolution, Anthropic Intends to Stop Training?

In early 2026, Anthropic signaled a significant shift in its public narrative regarding AI development timelines and safety. In June, its Anthropic Institute published a detailed article, "When AI builds itself," presenting internal data suggesting accelerating AI self-improvement. Key figures included over 80% of merged code being written by Claude and a 52x speedup in certain optimization tasks. The article outlined three future scenarios, with the most speculative being full recursive self-improvement (RSI), where AI autonomously builds better successors. Anthropic stated RSI is "possible" and may arrive faster than most institutions are prepared for. This narrative pivot followed a series of strategic moves. In January, CEO Dario Amodei wrote about a powerful self-improvement feedback loop. In February, Anthropic revised its Responsible Scaling Policy, removing a core commitment to pause training if capabilities outstripped safety controls, citing the risk of falling behind competitors. This change coincided with reported pressure from the US Department of Defense. By May, Anthropic's valuation had soared to $965 billion. Anthropic's stance was mirrored by other industry leaders. DeepMind CEO Demis Hassabis adjusted his AGI timeline to "by 2029" and admitted to using provocative language like "foothills of the singularity" to create urgency. OpenAI also released a model claiming a key role in its own creation process. The article's carefully calibrated tone—presenting dramatic data alongside qualifying footnotes—exemplifies a balancing act between signaling technological acceleration and managing commercial, regulatory, and safety imperatives. External experts offered contrasting interpretations of the same data, from warnings of catastrophic risk akin to Chernobyl to skepticism that current automation merely handles "grunt work," not genius. The coordinated narrative shift among top labs highlights the complex interplay between perceived technical inflection points and strategic communication aimed at investors, regulators, and the public.

marsbit16 dk önce

Worried about AI's Self-Evolution, Anthropic Intends to Stop Training?

marsbit16 dk önce

İşlemler

Spot
Futures

Popüler Makaleler

ZRX Nasıl Satın Alınır

HTX.com’a hoş geldiniz! ZRX(0X) (ZRX) satın alma işlemlerini basit ve kullanışlı bir hâle getirdik. Adım adım açıkladığımız rehberimizi takip ederek kripto yolculuğunuza başlayın. 1. Adım: HTX Hesabınızı OluşturunHTX'te ücretsiz bir hesap açmak için e-posta adresinizi veya telefon numaranızı kullanın. Sorunsuzca kaydolun ve tüm özelliklerin kilidini açın. Hesabımı Aç2. Adım: Kripto Satın Al Bölümüne Gidin ve Ödeme Yönteminizi SeçinKredi/Banka Kartı: Visa veya Mastercard'ınızı kullanarak anında ZRX(0X) (ZRX) satın alın.Bakiye: Sorunsuz bir şekilde işlem yapmak için HTX hesap bakiyenizdeki fonları kullanın.Üçüncü Taraflar: Kullanımı kolaylaştırmak için Google Pay ve Apple Pay gibi popüler ödeme yöntemlerini ekledik.P2P: HTX'teki diğer kullanıcılarla doğrudan işlem yapın.Borsa Dışı (OTC): Yatırımcılar için kişiye özel hizmetler ve rekabetçi döviz kurları sunuyoruz.3. Adım: ZRX(0X) (ZRX) Varlıklarınızı SaklayınZRX(0X) (ZRX) satın aldıktan sonra HTX hesabınızda saklayın. Alternatif olarak, blok zinciri transferi yoluyla başka bir yere gönderebilir veya diğer kripto para birimlerini takas etmek için kullanabilirsiniz.4. Adım: ZRX(0X) (ZRX) Varlıklarınızla İşlem YapınHTX'in spot piyasasında ZRX(0X) (ZRX) ile kolayca işlemler yapın.Hesabınıza erişin, işlem çiftinizi seçin, işlemlerinizi gerçekleştirin ve gerçek zamanlı olarak izleyin. Hem yeni başlayanlar hem de deneyimli yatırımcılar için kullanıcı dostu bir deneyim sunuyoruz.

154 Toplam GörüntülenmeYayınlanma 2024.12.10Güncellenme 2026.06.02

ZRX Nasıl Satın Alınır

Tartışmalar

HTX Topluluğuna hoş geldiniz. Burada, en son platform gelişmeleri hakkında bilgi sahibi olabilir ve profesyonel piyasa görüşlerine erişebilirsiniz. Kullanıcıların ZRX (ZRX) fiyatı hakkındaki görüşleri aşağıda sunulmaktadır.

活动图片