安全研究团队SafeDep在NPM包库中发现了伪装成mathjs库的恶意包,其中包括mathmain、mathsbase和math-universe三个受感染的包1。这些包跨越至少五个版本,在发布到NPM时被植入了加密的远程访问木马1。
木马的激活机制精心设计,需要调用者通过特定的3×3帕斯卡矩阵数据调用lusolve()函数才能触发1。恶意代码采用AES-GCM加密存储,密钥由帕斯卡矩阵的JSON字符串化形式通过scrypt算法生成256位加密密钥1。正常导入这些包不会激活木马,只有满足特定条件时才会解密有效载荷并执行1。
一旦激活,木马可执行远程代码、命令执行和数据窃取等恶意功能,通过Slack、Telegram等公共聊天服务以及区块链网络与攻击者进行通信1。SafeDep研究人员成功破解了加密方式,并发现两个部署使用相同的Alchemy项目密钥D2-TbkB2m05WXSnSDOCDI,表明这些攻击由同一攻击者操控1。公开的GitHub源代码库中并不包含恶意加载器代码,木马仅在NPM发布阶段被添加1。SafeDep于2026年9月17日开始分析此事件,并于9月19日确认存在三个恶意包1。
SafeDep security researchers discovered remote access trojans hidden within cloned versions of the mathjs library on the NPM package registry.1 The malicious packages, named mathmain, mathsbase, and math-universe, spanned at least five versions and contained encrypted payloads that required solving a specific mathematical equation to unlock.1 The trojan only activated when callers invoked the lusolve() function with data from a 3×3 Pascal matrix—the JSON stringified form of which served as the decryption key.1 This conditional trigger meant that simply importing the packages would not activate the malicious code.1
The researchers successfully broke the encryption scheme, which employed AES-GCM encryption with scrypt-generated 256-bit keys.1 Once decrypted, the payload enabled remote code execution, command execution, and data theft, with the attacker maintaining command and control through Slack and Telegram.1 Analysis revealed that two deployments shared an identical Alchemy project key (D2-TbkB2m05WXSnSDOCDI), indicating the attacks were orchestrated by the same threat actor.1 SafeDep initially analyzed the packages on September 17, 2026, and confirmed the presence of three malicious packages by September 19.1
Notably, the public GitHub repositories containing the source code showed no signs of malicious code—the trojans were injected only during the NPM publication process.1
评论
还没有评论,欢迎留下第一条。