IPBUF安全漏洞报告
English
CVE-2026-43893 CVSS 8.2 高危

CVE-2026-43893 exiftool-vendored 参数注入漏洞

披露日期: 2026-05-11

漏洞信息

漏洞编号
CVE-2026-43893
漏洞类型
参数注入
CVSS评分
8.2 高危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
exiftool-vendored

相关标签

参数注入exiftool-vendoredNode.jsCVE-2026-43893高危文件读取

漏洞概述

exiftool-vendored 是一个广泛使用的 Node.js 库,用于提供 ExifTool 的跨平台访问功能。在 35.19.0 之前的版本中,该库被披露存在一个高危安全漏洞(CVE-2026-43893)。漏洞成因在于库在启动 ExifTool 时使用了 `-stay_open True` 模式,并通过标准输入逐行读取参数。在此模式下,多个调用方提供的字符串未经充分过滤便被插入到 ExifTool 参数中。攻击者可以通过在这些字符串中注入换行符或回车符,将原本单一的参数分割为多个参数,从而实现参数注入。尽管目前尚未证实该漏洞可导致远程代码执行,但攻击者可利用此漏洞读取 ExifTool 进程权限下的任意文件,或将输出写入攻击者指定的文件系统路径。官方已在 35.19.0 版本中修复了此问题,增加了对不安全控制字符的拒绝机制。

技术细节

CVE-2026-43893 的核心在于参数注入。`exiftool-vendored` 为了提高性能,使用了 ExifTool 的 `-stay_open True -@ -` 模式。在这种持久化模式下,Node.js 进程与 ExifTool 子进程保持通信,并通过 stdin 发送指令。每个指令通常代表一个参数。

漏洞触发点在于,当应用程序将用户可控的字符串(如文件名、元数据标签值等)传递给 `exiftool-vendored` 的 API 时,库没有验证这些字符串中是否包含换行符(\n)、回车符(\r)或空字节(\0)。由于 ExifTool 按行解析 stdin 中的参数,一旦检测到换行符,它会认为当前参数结束,后续内容作为新的参数开始。

攻击者利用这一特性,可以构造恶意的输入字符串。例如,在一个原本用于指定文件名的参数中插入 `\n-TextOut\n/tmp/pwned.txt`。这会导致 ExifTool 不仅处理原文件名,还会执行 `-TextOut` 命令,将后续输出重定向到攻击者指定的路径。同理,通过注入特定的读取参数,攻击者可能诱导 ExifTool 读取服务器上的敏感配置文件(如 `/etc/passwd`)并将其内容包含在返回结果中。

由于 ExifTool 功能强大,参数众多,这种注入方式对系统的完整性和机密性构成了严重威胁(CVSS 完整性影响为高)。虽然目前没有公开的 RCE 漏洞利用代码,但文件读写能力已足够危险。修复后的 35.19.0 版本引入了严格的输入验证机制,会自动检测并拒绝包含上述控制字符的输入,从而从根本上切断了攻击链。

攻击链分析

STEP 1
步骤1:侦察
攻击者确认目标应用程序使用了 exiftool-vendored 库来处理图像文件,且版本低于 35.19.0。
STEP 2
步骤2:漏洞发现
攻击者找到应用程序中接受用户输入(如文件名、标签值)并将其传递给 exiftool-vendored API 的接口。
STEP 3
步骤3:构造载荷
攻击者在输入字符串中注入换行符(\n)或回车符(\r),后接恶意的 ExifTool 参数(例如读取文件的参数或写入路径的参数)。
STEP 4
步骤4:参数注入
应用程序将恶意字符串传递给 ExifTool。由于未过滤换行符,ExifTool 将输入解析为多个独立的命令行参数。
STEP 5
步骤5:执行攻击
ExifTool 执行注入的参数,导致读取敏感文件(如 /etc/passwd)或向任意路径写入文件,造成数据泄露或完整性破坏。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// Proof of Concept for CVE-2026-43893 // This demonstrates how a newline in a user-supplied string // can lead to argument injection in exiftool-vendored. const exiftool = require('exiftool-vendored').exiftool; async function exploit() { console.log("[+] Simulating CVE-2026-43893 Argument Injection"); // Scenario 1: Injecting a newline to split arguments // Suppose the application takes a filename from user input. // Normal input: "image.jpg" // Malicious input: "image.jpg\n-echo\n${/etc/passwd}" // The newline splits the 'filename' argument, injecting '-echo' and '${/etc/passwd}' as new commands. const maliciousInput = "image.jpg\n-echo\n${/etc/passwd}"; console.log(`[!] Malicious Payload prepared: ${JSON.stringify(maliciousInput)}`); console.log("[!] Payload contains a newline character (\\n) which splits the argument."); // Scenario 2: Attempting to write output to an arbitrary location // Using the newline to inject the '-o' (out) argument. const writePayload = "image.jpg\n-o\n/tmp/malicious_output.txt"; console.log(`[!] Write Payload prepared: ${JSON.stringify(writePayload)}`); console.log("[!] If processed by vulnerable exiftool-vendored (< 35.19.0), this could write output to /tmp/"); // Note: Actual execution requires a vulnerable environment and specific API usage. // The fix in 35.19.0 specifically checks for \n, \r, and \0 characters to prevent this. } exploit().catch(console.error);

影响范围

exiftool-vendored < 35.19.0

防御指南

临时缓解措施
如果无法立即升级,应在应用层面对所有传递给 exiftool-vendored 的字符串进行严格的输入清洗。确保在数据传递给库之前,使用正则表达式或替换函数移除所有换行符(\n)、回车符(\r)以及空字符(\0)。此外,应检查代码逻辑,避免将未经过滤的 HTTP 请求参数直接用于生成 ExifTool 的命令参数。

参考链接