AI Security AI安全 2h ago Updated 2h ago 更新于 2小时前 46

Trojanized Newtonsoft.Json Fork Hides Game-Rigging Code in a Working Library 特洛伊化的Newtonsoft.Json分支在工作库中隐藏游戏作弊代码

A NuGet package named "Newtonsoftt.Json.Net" (typosquatting the popular Newtonsoft.Json library) was discovered containing a trojanized fork designed to rig live game results on the Digitain betting platform. The malware exhibits highly targeted behavior, remaining benign for general users while activating only when specific conditions are met, such as the initialization of `JsonConvert.DefaultSettings` and the presence of Digitain’s specific backend methods. The attack evolved through three gen 安全研究人员在NuGet上发现名为“Newtonsoftt.Json.Net”的拼写错误包,实为针对在线博彩平台Digitain的木马化分支。 该恶意库伪装成正常的JSON处理库,仅在特定目标服务器初始化时激活,通过注入随机延迟和反射技术规避检测。 攻击者利用泄露的内部仓库URL访问FG-Crash后端源码,篡改游戏结果并将数据伪装成遥测数据外泄至C2服务器。 攻击具有高度针对性,非目标用户安装后仅获得正常工作的库而无恶意行为,增加了隐蔽性和检测难度。 建议开发者立即移除该包、封锁C2地址,并通过packages.lock.json锁定Newtonsoft.Json版本以防御供应链攻击。

65
Hot 热度
70
Quality 质量
60
Impact 影响力

Analysis 深度分析

TL;DR

  • A NuGet package named "Newtonsoftt.Json.Net" (typosquatting the popular Newtonsoft.Json library) was discovered containing a trojanized fork designed to rig live game results on the Digitain betting platform.
  • The malware exhibits highly targeted behavior, remaining benign for general users while activating only when specific conditions are met, such as the initialization of JsonConvert.DefaultSettings and the presence of Digitain’s specific backend methods.
  • The attack evolved through three generations, progressing from a local proof-of-concept to sophisticated exfiltration using obfuscation tools like ConfuserEx, ultimately sending rigged data to a hardcoded C2 server disguised as telemetry.
  • Security researchers from JFrog highlighted the package's stealth capabilities, noting that it leaks internal repository URLs in metadata, suggesting the attacker had prior access to the victim's source code.

Why It Matters

This incident represents a significant evolution in supply chain attacks, moving beyond generic credential theft to precise, business-logic exploitation within specific enterprise environments. It demonstrates how attackers can weaponize widely used open-source dependencies to target niche infrastructure without triggering broad alarms, making traditional security monitoring less effective. For AI and software engineering communities, it underscores the critical need for dependency pinning and rigorous auditing of third-party libraries, especially those with slight naming variations.

Technical Details

  • Targeting Mechanism: The trojan checks for the existence of specific methods in the host environment related to Digitain’s FG-Crash backend. It only executes malicious logic if these methods are present, ensuring invisibility to non-targeted applications.
  • Activation Trigger: Malicious code is invoked via the DefaultSettings property setter of JsonConvert. The attacker introduced randomized delays to evade static analysis and behavioral detection during the initialization phase.
  • Evolution of Payload: The package versions span three generations: Gen-1 was a local-only rigging test; Gen-2 added exfiltration hidden behind reflection and ConfuserEx obfuscation; Gen-3 stabilized the exfiltration path, with the final version (11.0.11) appearing unobfuscated, possibly due to an accidental clean build.
  • Data Exfiltration: Rigged game results are sent to the IP address 185.126.237[.]64:5341 using the HTTP header X-Seq-ApiKey: theperfectheist2025, masquerading as legitimate telemetry data to avoid network-level suspicion.
  • Metadata Leakage: All seven published versions contained an internal Digitain repository URL in their package metadata, providing evidence that the attacker likely had insider knowledge or access to the victim's development environment.

Industry Insight

  • Enhanced Dependency Auditing: Organizations must implement strict dependency locking (e.g., packages.lock.json) and verify package hashes against official sources to prevent the installation of typosquatted libraries, even if they appear functionally correct.
  • Behavioral Monitoring for Supply Chains: Traditional signature-based detection is insufficient for targeted supply chain attacks. Security teams should monitor for anomalous outbound traffic patterns and unexpected API calls from standard libraries, particularly those involving unusual headers or destinations.
  • Risk of Insider Threats: The presence of internal URLs in the package metadata suggests potential insider involvement or compromised developer credentials. Companies should enforce least-privilege access controls and regularly audit external communications from development environments to mitigate insider risks.

TL;DR

  • 安全研究人员在NuGet上发现名为“Newtonsoftt.Json.Net”的拼写错误包,实为针对在线博彩平台Digitain的木马化分支。
  • 该恶意库伪装成正常的JSON处理库,仅在特定目标服务器初始化时激活,通过注入随机延迟和反射技术规避检测。
  • 攻击者利用泄露的内部仓库URL访问FG-Crash后端源码,篡改游戏结果并将数据伪装成遥测数据外泄至C2服务器。
  • 攻击具有高度针对性,非目标用户安装后仅获得正常工作的库而无恶意行为,增加了隐蔽性和检测难度。
  • 建议开发者立即移除该包、封锁C2地址,并通过packages.lock.json锁定Newtonsoft.Json版本以防御供应链攻击。

为什么值得看

这篇文章揭示了软件供应链攻击的新趋势:从通用的信息窃取转向针对特定业务逻辑的高精度破坏。对于依赖第三方库的企业,特别是涉及金融或游戏业务的开发者,这提供了关于如何识别和防御隐蔽性极强的定向恶意包的宝贵案例。

技术解析

  • 攻击载体与分发:恶意包“Newtonsoftt.Json.Net”是知名库Newtonsoft.Json的13.0版本分支,发布了7个版本(11.0.4至11.0.11),累计下载约1,200次,随后被作者下架但未从注册中心完全删除。
  • 触发机制与隐蔽性:木马通过修改JsonConvert.DefaultSettings属性setter激活,引入随机延迟以绕过静态分析和动态监控。它仅修补FG-Crash后端特有的方法,对非目标系统表现为正常库,实现了“白盒”伪装。
  • 恶意功能演进:攻击代码经历了三代迭代:Gen-1为本地篡改概念验证;Gen-2增加通过反射和ConfuserEx混淆的外泄功能;Gen-3稳定了外泄路径,最终版本甚至去除了混淆,疑似意外发布。
  • 数据外泄与情报:攻击者将篡改后的游戏结果发送至硬编码的C2地址(185.126.237[.]64:5341),并使用自定义Header X-Seq-ApiKey: theperfectheist2025。包元数据中泄露的内部URL证实攻击者曾拥有Digitain部分源代码权限。

行业启示

  • 依赖管理需强化版本锁定:仅依赖包名匹配不足以防范拼写错误攻击,企业应强制使用packages.lock.json等机制锁定依赖版本和哈希值,防止意外引入恶意或篡改的分支。
  • 关注供应链中的定向威胁:传统的恶意软件多追求广泛传播,但针对特定高价值目标的“狙击式”供应链攻击日益增多,安全团队需加强对第三方库行为异常(如特定API调用、网络外联)的深度监控。
  • 内部资产保护至关重要:此次攻击成功的关键在于攻击者掌握了目标系统的内部结构信息,表明开发环境、源代码仓库及内部文档的安全防护同样需要严格管控,以防成为供应链攻击的情报来源。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Security 安全 Open Source 开源