Node.js CVE-2025-27210 and CVE-2025-27209: Risks and Fixes
On 15 July 2025 Node.js released fixes for two high-severity flaws. CVE-2025-27210 lets attackers bypass path traversal protections on Windows by using reserved device names such as CON, PRN or AUX, which path.normalize() and path.join() did not handle safely; it affects Node.js 20.x, 22.x and 24.x on Windows.
Topic: Cyber Threats, Scams & Online Safety in Cybersecurity & Ethical Hacking · News & analysis
Quick answer: On 15 July 2025 Node.js released fixes for two high-severity flaws. CVE-2025-27210 lets attackers bypass path traversal protections on Windows by using reserved device names such as CON, PRN or AUX, which path.normalize() and path.join() did not handle safely; it affects Node.js 20.x, 22.x and 24.x on Windows. CVE-2025-27209 is a hash collision denial of service (HashDoS) caused by a change to string hashing in the V8 engine used by Node.js 24.x. Upgrade to 20.19.4, 22.17.1 or 24.4.1 or later, and validate file paths against an allowed base directory.
Key takeaways
- Fixed versions: 20.19.4, 22.17.1 and 24.4.1.
- CVE-2025-27210 affects Windows only and completes an earlier fix for CVE-2025-23084.
- CVE-2025-27209 is a denial of service issue in the 24.x line.
- Normalising a path is not the same as validating it.
- Run supported Node.js versions so security releases reach you.
Table of Contents
- What Are the Two Vulnerabilities?
- How Does CVE-2025-27210 Work?
- How Does CVE-2025-27209 Work?
- How Do You Check if You Are Affected?
- How Do You Fix It?
- How Should Code Handle File Paths Safely?
- What Are the Wider Lessons?
- References
What Are the Two Vulnerabilities?
| CVE | Type | Affected | Fixed in |
|---|---|---|---|
| CVE-2025-27210 | Path traversal on Windows (device names) | 20.x, 22.x, 24.x on Windows | 20.19.4, 22.17.1, 24.4.1 |
| CVE-2025-27209 | HashDoS in V8 string hashing | 24.x | 24.4.1 |
Both are listed in the Node.js July 2025 security release.
How Does CVE-2025-27210 Work?
Windows treats certain names as devices rather than files, including CON, PRN, AUX, NUL, COM1 and LPT1, as listed in Microsoft's file naming rules. Earlier in 2025, Node.js fixed CVE-2025-23084, a Windows path traversal issue in path functions. That fix was incomplete: paths built with device names could still be normalised into locations outside the intended directory. An application that joins user input to a base folder and trusts the result could then read or write files it should not (CWE-22).
How Does CVE-2025-27209 Work?
The V8 version in Node.js 24.0.0 changed how string hashes are computed (to rapidhash). That reintroduced the possibility of hash collision attacks: an attacker who sends many keys that collide, for example in a JSON body or query string, can make hash table operations very slow and tie up the server. The fix in 24.4.1 restores protection.
How Do You Check if You Are Affected?
# Installed version
node -v
# Running on Windows?
node -p "process.platform"
# Find Node.js versions pinned in Docker images or CI
grep -R "node:" Dockerfile* .github/workflows 2>/dev/null
You are affected by CVE-2025-27210 if the output is win32 and the version is below the fixed release for your line. Everyone on 24.x below 24.4.1 is affected by CVE-2025-27209.
How Do You Fix It?
- Upgrade to 20.19.4, 22.17.1 or 24.4.1, or any later release in your line.
- Rebuild container images and redeploy; base images do not update themselves.
- Move off end-of-life lines (check the release schedule); they do not get security fixes.
- Limit request body sizes and parameter counts as general HashDoS mitigation.
How Should Code Handle File Paths Safely?
Resolve the path, then confirm it is still inside the allowed folder, and reject device names explicitly on Windows:
const path = require('path');
const BASE = path.resolve('C:/app/uploads');
const RESERVED = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i;
function safePath(userInput) {
const full = path.resolve(BASE, userInput);
if (!full.startsWith(BASE + path.sep)) throw new Error('outside base');
if (full.split(path.sep).some(p => RESERVED.test(p))) throw new Error('reserved name');
return full;
}
Better still, avoid using user input as a file name at all: store files under generated IDs and keep the original name in a database.
What Are the Wider Lessons?
- Patch runtimes as well as application dependencies; include Node.js in vulnerability scanning.
- Test path handling on every platform you deploy to.
- Incomplete fixes happen; subscribe to the Node.js security announcements.
Related: API security tips and common security misconfigurations. WebAsha offers secure coding training.
References
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0