CyberSecBulletin
CVE-2024-21896NVD status: Analyzed

Node: Path Traversal: 'dir/../../filename'

CVE-2024-21896 is a critical-severity path traversal: 'dir/../../filename' vulnerability in Node from Node.js, with a CVSS 3.1 base score of 9.8 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. The record lists versions 4.*, 5.*, 6.* as the first without the flaw, so updating Node to one of those releases or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 1.26% chance of exploitation within 30 days, higher than 70% of scored CVEs.

Patch this week

Critical severity: a successful attack would have severe impact.

What to do

  1. Update Node to 4.* or 5.* or 6.* or 7.*, whichever matches your release line, or a later version.
  2. Update Node.js to 20.11.1 or 21.6.2, whichever matches your release line, or a later version.
  3. Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.

Affected products and versions

VendorProductAffected versionsFixed in
Node.jsNode4.0 up to, but not including, 4.*; 5.0 up to, but not including, 5.*; 6.0 up to, but not including, 6.*; 7.0 up to, but not including, 7.*; 8.0 up to, but not including, 8.*; 9.0 up to, but not including, 9.*; 10.0 up to, but not including, 10.*; 11.0 up to, but not including, 11.*; and 9 more ranges4.*, 5.*, 6.*, 7.*, 8.*, 9.*
Node.jsnodejs21.6.1Not stated
Node.jsNode.js20.0.0 up to, but not including, 20.11.1; 21.0.0 up to, but not including, 21.6.220.11.1, 21.6.2

Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Attack vector
NetworkCan be exploited remotely over a network, including the internet.
Attack complexity
LowNo special conditions are needed; the attack works reliably.
Privileges required
NoneNo account or login is needed.
User interaction
NoneNo action by a victim is required.
Scope
UnchangedImpact stays within the vulnerable component.
Confidentiality
HighAll data handled by the component can be read.
Integrity
HighData or code can be modified at will.
Availability
HighThe component can be taken down completely.

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. Scored by NVD.

Scoring systemScoreSeverityScored by
CVSS 3.19.8CriticalNVD
CVSS 3.07.9HighCNA (hackerone.com)

Official description

The permission model protects itself against path traversal attacks by calling path.resolve() on any paths given by the user. If the path is to be treated as a Buffer, the implementation uses Buffer.from() to obtain a Buffer from the result of path.resolve(). By monkey-patching Buffer internals, namely, Buffer.prototype.utf8Write, the application can modify the result of path.resolve(), which leads to a path traversal vulnerability. This vulnerability affects all users using the experimental permission model in Node.js 20 and Node.js 21. Please note that at the time this CVE was issued, the permission model is an experimental feature of Node.js.

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Path Traversal: 'dir/../../filename'

The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize multiple internal../ sequences that can resolve to a location that is outside of that directory.

How developers prevent this class of flaw

  • Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.

More Path Traversal: 'dir/../../filename' vulnerabilities (CWE-27)

Timeline

  1. CVE record published.
  2. CISA published its SSVC assessment (exploitation: none, automatable: no, technical impact: total).
  3. Record last changed materially (score, affected products, status or references).

References

Third-party and government advisories

Other references

Other vulnerabilities in Node

All Node vulnerabilities

Spotted an error? Tell us.