Skip to contentSkip to conversation

Nodejs 20.18.2: Fix CVE-2025-55132

PATCH In review Anil Dongare -X (adongare - E INFOCHIPS PRIVATE LIMITED at Cisco) 2 participants 7 messages Feb 12 – Feb 17

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 Nodejs 20.18.2: Fix CVE-2025-55132

From: Anil Dongare <[email protected]>

Upstream Repository: https://github.com/nodejs/node.git

Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2025-55132
Type: Security Fix
CVE: CVE-2025-55132
Score: 5.3
Patch: https://github.com/nodejs/node/commit/ebbf942a83bc

---
 .../nodejs/nodejs/CVE-2025-55132.patch        | 178 ++++++++++++++++++
 .../recipes-devtools/nodejs/nodejs_20.18.2.bb |   1 +
 2 files changed, 179 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-55132.patch
meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-55132.patch new file +178 -0
new file mode 100644
index 0000000000..08c885473c
@@ -0,0 +1,178 @@
+From b89fc3633ec12b6d1da5b9978e6bb1c5fbacf021 Mon Sep 17 00:00:00 2001
+From: RafaelGSS <[email protected]>
+Date: Tue, 21 Oct 2025 18:25:31 -0300
+Subject: [PATCH 1/5] lib: disable futimes when permission model is enabled
+
+Refs: https://hackerone.com/reports/3390084
+PR-URL: https://github.com/nodejs-private/node-private/pull/748
+Reviewed-By: Matteo Collina <[email protected]>
+Reviewed-By: Anna Henningsen <[email protected]>
+CVE-ID: CVE-2025-55132
+
+CVE: CVE-2025-55132
+Upstream-Status: Backport [https://github.com/nodejs/node/commit/ebbf942a83bc]
+
+(cherry picked from commit ebbf942a83bc70d90a3bcb6712c7b67bc479fdf5)
+Signed-off-by: Anil Dongare <[email protected]>
+---
+ lib/fs.js                                     | 24 ++++++++++
+ test/fixtures/permission/fs-write.js          | 47 ++++++++++++++++++-
+ test/parallel/test-permission-fs-supported.js | 17 ++++++-
+ 3 files changed, 86 insertions(+), 2 deletions(-)
+
+diff --git a/lib/fs.js b/lib/fs.js
+index 64f0b5e88ed..9206a18663c 100644
+--- a/lib/fs.js
++++ b/lib/fs.js
+@@ -1274,6 +1274,11 @@ function rmSync(path, options) {
+ function fdatasync(fd, callback) {
+   const req = new FSReqCallback();
+   req.oncomplete = makeCallback(callback);
++
++  if (permission.isEnabled()) {
++    callback(new ERR_ACCESS_DENIED('fdatasync API is disabled when Permission Model is enabled.'));
++    return;
++  }
+   binding.fdatasync(fd, req);
+ }
+
+@@ -1285,6 +1290,9 @@ function fdatasync(fd, callback) {
+  * @returns {void}
+  */
+ function fdatasyncSync(fd) {
++  if (permission.isEnabled()) {
++    throw new ERR_ACCESS_DENIED('fdatasync API is disabled when Permission Model is enabled.');
++  }
+   binding.fdatasync(fd);
+ }
+
+@@ -1298,6 +1306,10 @@ function fdatasyncSync(fd) {
+ function fsync(fd, callback) {
+   const req = new FSReqCallback();
+   req.oncomplete = makeCallback(callback);
++  if (permission.isEnabled()) {
++    callback(new ERR_ACCESS_DENIED('fsync API is disabled when Permission Model is enabled.'));
++    return;
++  }
+   binding.fsync(fd, req);
+ }
+
+@@ -1308,6 +1320,9 @@ function fsync(fd, callback) {
+  * @returns {void}
+  */
+ function fsyncSync(fd) {
++  if (permission.isEnabled()) {
++    throw new ERR_ACCESS_DENIED('fsync API is disabled when Permission Model is enabled.');
++  }
+   binding.fsync(fd);
+ }
+
+@@ -2164,6 +2179,11 @@ function futimes(fd, atime, mtime, callback) {
+   mtime = toUnixTimestamp(mtime, 'mtime');
+   callback = makeCallback(callback);
+
++  if (permission.isEnabled()) {
++    callback(new ERR_ACCESS_DENIED('futimes API is disabled when Permission Model is enabled.'));
++    return;
++  }
++
+   const req = new FSReqCallback();
+   req.oncomplete = callback;
+   binding.futimes(fd, atime, mtime, req);
+@@ -2179,6 +2199,10 @@ function futimes(fd, atime, mtime, callback) {
+  * @returns {void}
+  */
+ function futimesSync(fd, atime, mtime) {
++  if (permission.isEnabled()) {
++    throw new ERR_ACCESS_DENIED('futimes API is disabled when Permission Model is enabled.');
++  }
++
+   binding.futimes(
+     fd,
+     toUnixTimestamp(atime, 'atime'),
+diff --git a/test/fixtures/permission/fs-write.js b/test/fixtures/permission/fs-write.js
+index 31e96860972..4b98b6d2b78 100644
+--- a/test/fixtures/permission/fs-write.js
++++ b/test/fixtures/permission/fs-write.js
+@@ -490,4 +490,49 @@ const relativeProtectedFolder = process.env.RELATIVEBLOCKEDFOLDER;
+   }, {
+     code: 'ERR_ACCESS_DENIED',
+   });
+-}
+\ No newline at end of file
++}
++
++// fs.utimes with read-only fd
++{
++  assert.throws(() => {
++    // blocked file is allowed to read
++    const fd = fs.openSync(blockedFile, 'r');
++    const date = new Date();
++    date.setFullYear(2100,0,1);
++
++    fs.futimes(fd, date, date, common.expectsError({
++      code: 'ERR_ACCESS_DENIED',
++    }));
++    fs.futimesSync(fd, date, date);
++  }, {
++    code: 'ERR_ACCESS_DENIED',
++  });
++}
++
++// fs.fdatasync with read-only fd
++{
++  assert.throws(() => {
++    // blocked file is allowed to read
++    const fd = fs.openSync(blockedFile, 'r');
++    fs.fdatasync(fd, common.expectsError({
++      code: 'ERR_ACCESS_DENIED',
++    }));
++    fs.fdatasyncSync(fd);
++  }, {
++    code: 'ERR_ACCESS_DENIED',
++  });
++}
++
++// fs.fsync with read-only fd
++{
++  assert.throws(() => {
++    // blocked file is allowed to read
++    const fd = fs.openSync(blockedFile, 'r');
++    fs.fsync(fd, common.expectsError({
++      code: 'ERR_ACCESS_DENIED',
++    }));
++    fs.fsyncSync(fd);
++  }, {
++    code: 'ERR_ACCESS_DENIED',
++  });
++}
+diff --git a/test/parallel/test-permission-fs-supported.js b/test/parallel/test-permission-fs-supported.js
+index 1062117798b..805365f28b3 100644
+--- a/test/parallel/test-permission-fs-supported.js
++++ b/test/parallel/test-permission-fs-supported.js
+@@ -77,7 +77,22 @@ const ignoreList = [
+   'unwatchFile',
+   ...syncAndAsyncAPI('lstat'),
+   ...syncAndAsyncAPI('realpath'),
+-  // fd required methods
++  // File descriptor–based metadata operations
++  //
++  // The kernel does not allow opening a file descriptor for an inode
++  // with write access if the inode itself is read-only. However, it still
++  // permits modifying the inode’s metadata (e.g., permission bits, ownership,
++  // timestamps) because you own the file. These changes can be made either
++  // by referring to the file by name (e.g., chmod) or through any existing
++  // file descriptor that identifies the same inode (e.g., fchmod).
++  //
++  // If the kernel required write access to change metadata, it would be
++  // impossible to modify the permissions of a file once it was made read-only.
++  // For that reason, syscalls such as fchmod, fchown, and futimes bypass
++  // the file descriptor’s access mode. Even a read-only ('r') descriptor
++  // can still update metadata. To prevent unintended modifications,
++  // these APIs are therefore blocked by default when permission model is
++  // enabled.
+   ...syncAndAsyncAPI('close'),
+   ...syncAndAsyncAPI('fchown'),
+   ...syncAndAsyncAPI('fchmod'),
+--
+2.43.7
meta-oe/recipes-devtools/nodejs/nodejs_20.18.2.bb +1 -0
index d757a7395c..67574a2ec1 100644
@@ -29,6 +29,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://zlib-fix-pointer-alignment.patch \
            file://0001-src-fix-build-with-GCC-15.patch \
            file://run-ptest \
+           file://CVE-2025-55132.patch \
            "
 SRC_URI:append:class-target = " \
            file://0001-Using-native-binaries.patch \
Signature · 1 line
2.44.1
#1 lore raw

PATCH 2/5 Nodejs 20.18.2: Fix CVE-2025-55130

From: Anil Dongare <[email protected]>

Upstream Repository: https://github.com/nodejs/node.git

Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2025-55130
Type: Security Fix
CVE: CVE-2025-55130
Score: 9.1
Patch: https://github.com/nodejs/node/commit/6b4849583ad6

---
 .../nodejs/nodejs/CVE-2025-55130.patch        | 315 ++++++++++++++++++
 .../recipes-devtools/nodejs/nodejs_20.18.2.bb |   1 +
 2 files changed, 316 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-55130.patch
meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-55130.patch new file +315 -0
new file mode 100644
index 0000000000..2e0b1a0fa7
@@ -0,0 +1,315 @@
+From b64d87994164e965a46f4144ea59a01e76c30efd Mon Sep 17 00:00:00 2001
+From: RafaelGSS <[email protected]>
+Date: Mon, 10 Nov 2025 19:27:51 -0300
+Subject: [PATCH] lib,permission: require full read and write to symlink APIs
+
+Refs: https://hackerone.com/reports/3417819
+Signed-off-by: RafaelGSS <[email protected]>
+PR-URL: https://github.com/nodejs-private/node-private/pull/760
+Reviewed-By: Matteo Collina <[email protected]>
+CVE-ID: CVE-2025-55130
+
+CVE: CVE-2025-55130
+Upstream-Status: Backport [https://github.com/nodejs/node/commit/6b4849583ad6]
+
+(cherry picked from commit 6b4849583ad655d96365d9c665dcdb7912b67e2c)
+Signed-off-by: Anil Dongare <[email protected]>
+---
+ lib/fs.js                                     | 34 ++++++-------------
+ lib/internal/fs/promises.js                   | 20 +++--------
+ .../permission/fs-symlink-target-write.js     | 18 ++--------
+ test/fixtures/permission/fs-symlink.js        | 18 ++++++++--
+ .../test-permission-fs-symlink-relative.js    | 10 +++---
+ test/parallel/test-permission-fs-symlink.js   | 14 ++++++++
+ 6 files changed, 52 insertions(+), 62 deletions(-)
+
+diff --git a/lib/fs.js b/lib/fs.js
+index 9206a18663c..4f9ff6da371 100644
+--- a/lib/fs.js
++++ b/lib/fs.js
+@@ -59,7 +59,6 @@ const {
+ } = constants;
+
+ const pathModule = require('path');
+-const { isAbsolute } = pathModule;
+ const { isArrayBufferView } = require('internal/util/types');
+
+ const binding = internalBinding('fs');
+@@ -1744,18 +1743,12 @@ function symlink(target, path, type_, callback_) {
+   const type = (typeof type_ === 'string' ? type_ : null);
+   const callback = makeCallback(arguments[arguments.length - 1]);
+
+-  if (permission.isEnabled()) {
+-    // The permission model's security guarantees fall apart in the presence of
+-    // relative symbolic links. Thus, we have to prevent their creation.
+-    if (BufferIsBuffer(target)) {
+-      if (!isAbsolute(BufferToString(target))) {
+-        callback(new ERR_ACCESS_DENIED('relative symbolic link target'));
+-        return;
+-      }
+-    } else if (typeof target !== 'string' || !isAbsolute(toPathIfFileURL(target))) {
+-      callback(new ERR_ACCESS_DENIED('relative symbolic link target'));
+-      return;
+-    }
++  // Due to the nature of Node.js runtime, symlinks has different edge cases that can bypass
++  // the permission model security guarantees. Thus, this API is disabled unless fs.read
++  // and fs.write permission has been given.
++  if (permission.isEnabled() && !permission.has('fs')) {
++    callback(new ERR_ACCESS_DENIED('fs.symlink API requires full fs.read and fs.write permissions.'));
++    return;
+   }
+
+   target = getValidatedPath(target, 'target');
+@@ -1815,16 +1808,11 @@ function symlinkSync(target, path, type) {
+     }
+   }
+
+-  if (permission.isEnabled()) {
+-    // The permission model's security guarantees fall apart in the presence of
+-    // relative symbolic links. Thus, we have to prevent their creation.
+-    if (BufferIsBuffer(target)) {
+-      if (!isAbsolute(BufferToString(target))) {
+-        throw new ERR_ACCESS_DENIED('relative symbolic link target');
+-      }
+-    } else if (typeof target !== 'string' || !isAbsolute(toPathIfFileURL(target))) {
+-      throw new ERR_ACCESS_DENIED('relative symbolic link target');
+-    }
++  // Due to the nature of Node.js runtime, symlinks has different edge cases that can bypass
++  // the permission model security guarantees. Thus, this API is disabled unless fs.read
++  // and fs.write permission has been given.
++  if (permission.isEnabled() && !permission.has('fs')) {
++    throw new ERR_ACCESS_DENIED('fs.symlink API requires full fs.read and fs.write permissions.');
+   }
+
+   target = getValidatedPath(target, 'target');
+diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js
+index 8314cf29a85..f734f93d763 100644
+--- a/lib/internal/fs/promises.js
++++ b/lib/internal/fs/promises.js
+@@ -17,7 +17,6 @@ const {
+   Symbol,
+   Uint8Array,
+   FunctionPrototypeBind,
+-  uncurryThis,
+ } = primordials;
+
+ const { fs: constants } = internalBinding('constants');
+@@ -31,8 +30,6 @@ const {
+
+ const binding = internalBinding('fs');
+ const { Buffer } = require('buffer');
+-const { isBuffer: BufferIsBuffer } = Buffer;
+-const BufferToString = uncurryThis(Buffer.prototype.toString);
+
+ const {
+   codes: {
+@@ -88,8 +85,6 @@ const {
+   kValidateObjectAllowNullable,
+ } = require('internal/validators');
+ const pathModule = require('path');
+-const { isAbsolute } = pathModule;
+-const { toPathIfFileURL } = require('internal/url');
+ const {
+   kEmptyObject,
+   lazyDOMException,
+@@ -983,16 +978,11 @@ async function symlink(target, path, type_) {
+     }
+   }
+
+-  if (permission.isEnabled()) {
+-    // The permission model's security guarantees fall apart in the presence of
+-    // relative symbolic links. Thus, we have to prevent their creation.
+-    if (BufferIsBuffer(target)) {
+-      if (!isAbsolute(BufferToString(target))) {
+-        throw new ERR_ACCESS_DENIED('relative symbolic link target');
+-      }
+-    } else if (typeof target !== 'string' || !isAbsolute(toPathIfFileURL(target))) {
+-      throw new ERR_ACCESS_DENIED('relative symbolic link target');
+-    }
++  // Due to the nature of Node.js runtime, symlinks has different edge cases that can bypass
++  // the permission model security guarantees. Thus, this API is disabled unless fs.read
++  // and fs.write permission has been given.
++  if (permission.isEnabled() && !permission.has('fs')) {
++    throw new ERR_ACCESS_DENIED('fs.symlink API requires full fs.read and fs.write permissions.');
+   }
+
+   target = getValidatedPath(target, 'target');
+diff --git a/test/fixtures/permission/fs-symlink-target-write.js b/test/fixtures/permission/fs-symlink-target-write.js
+index c17d674d59e..6e07bfa838e 100644
+--- a/test/fixtures/permission/fs-symlink-target-write.js
++++ b/test/fixtures/permission/fs-symlink-target-write.js
+@@ -26,8 +26,7 @@ const writeOnlyFolder = process.env.WRITEONLYFOLDER;
+     fs.symlinkSync(path.join(readOnlyFolder, 'file'), path.join(readWriteFolder, 'link-to-read-only'), 'file');
+   }, common.expectsError({
+     code: 'ERR_ACCESS_DENIED',
+-    permission: 'FileSystemWrite',
+-    resource: path.toNamespacedPath(path.join(readOnlyFolder, 'file')),
++    message: 'fs.symlink API requires full fs.read and fs.write permissions.',
+   }));
+   assert.throws(() => {
+     fs.linkSync(path.join(readOnlyFolder, 'file'), path.join(readWriteFolder, 'link-to-read-only'));
+@@ -37,18 +36,6 @@ const writeOnlyFolder = process.env.WRITEONLYFOLDER;
+     resource: path.toNamespacedPath(path.join(readOnlyFolder, 'file')),
+   }));
+
+-  // App will be able to symlink to a writeOnlyFolder
+-  fs.symlink(path.join(readWriteFolder, 'file'), path.join(writeOnlyFolder, 'link-to-read-write'), 'file', (err) => {
+-    assert.ifError(err);
+-    // App will won't be able to read the symlink
+-    fs.readFile(path.join(writeOnlyFolder, 'link-to-read-write'), common.expectsError({
+-      code: 'ERR_ACCESS_DENIED',
+-      permission: 'FileSystemRead',
+-    }));
+-
+-    // App will be able to write to the symlink
+-    fs.writeFile(path.join(writeOnlyFolder, 'link-to-read-write'), 'some content', common.mustSucceed());
+-  });
+   fs.link(path.join(readWriteFolder, 'file'), path.join(writeOnlyFolder, 'link-to-read-write2'), (err) => {
+     assert.ifError(err);
+     // App will won't be able to read the link
+@@ -66,8 +53,7 @@ const writeOnlyFolder = process.env.WRITEONLYFOLDER;
+     fs.symlinkSync(path.join(readWriteFolder, 'file'), path.join(readOnlyFolder, 'link-to-read-only'), 'file');
+   }, common.expectsError({
+     code: 'ERR_ACCESS_DENIED',
+-    permission: 'FileSystemWrite',
+-    resource: path.toNamespacedPath(path.join(readOnlyFolder, 'link-to-read-only')),
++    message: 'fs.symlink API requires full fs.read and fs.write permissions.',
+   }));
+   assert.throws(() => {
+     fs.linkSync(path.join(readWriteFolder, 'file'), path.join(readOnlyFolder, 'link-to-read-only'));
+diff --git a/test/fixtures/permission/fs-symlink.js b/test/fixtures/permission/fs-symlink.js
+index 4cf3b45f0eb..ba60f7811bd 100644
+--- a/test/fixtures/permission/fs-symlink.js
++++ b/test/fixtures/permission/fs-symlink.js
+@@ -54,7 +54,6 @@ const symlinkFromBlockedFile = process.env.EXISTINGSYMLINK;
+     fs.readFileSync(blockedFile);
+   }, common.expectsError({
+     code: 'ERR_ACCESS_DENIED',
+-    permission: 'FileSystemRead',
+   }));
+   assert.throws(() => {
+     fs.appendFileSync(blockedFile, 'data');
+@@ -68,7 +67,6 @@ const symlinkFromBlockedFile = process.env.EXISTINGSYMLINK;
+     fs.symlinkSync(regularFile, blockedFolder + '/asdf', 'file');
+   }, common.expectsError({
+     code: 'ERR_ACCESS_DENIED',
+-    permission: 'FileSystemWrite',
+   }));
+   assert.throws(() => {
+     fs.linkSync(regularFile, blockedFolder + '/asdf');
+@@ -82,7 +80,6 @@ const symlinkFromBlockedFile = process.env.EXISTINGSYMLINK;
+     fs.symlinkSync(blockedFile, path.join(__dirname, '/asdf'), 'file');
+   }, common.expectsError({
+     code: 'ERR_ACCESS_DENIED',
+-    permission: 'FileSystemRead',
+   }));
+   assert.throws(() => {
+     fs.linkSync(blockedFile, path.join(__dirname, '/asdf'));
+@@ -90,4 +87,19 @@ const symlinkFromBlockedFile = process.env.EXISTINGSYMLINK;
+     code: 'ERR_ACCESS_DENIED',
+     permission: 'FileSystemRead',
+   }));
++}
++
++// fs.symlink API is blocked by default
++{
++  assert.throws(() => {
++    fs.symlinkSync(regularFile, regularFile);
++  }, common.expectsError({
++    message: 'fs.symlink API requires full fs.read and fs.write permissions.',
++    code: 'ERR_ACCESS_DENIED',
++  }));
++
++  fs.symlink(regularFile, regularFile, common.expectsError({
++    message: 'fs.symlink API requires full fs.read and fs.write permissions.',
++    code: 'ERR_ACCESS_DENIED',
++  }));
+ }
+\ No newline at end of file
+diff --git a/test/parallel/test-permission-fs-symlink-relative.js b/test/parallel/test-permission-fs-symlink-relative.js
+index 4cc7d920593..9080f16c663 100644
+--- a/test/parallel/test-permission-fs-symlink-relative.js
++++ b/test/parallel/test-permission-fs-symlink-relative.js
+@@ -1,4 +1,4 @@
+-// Flags: --experimental-permission --allow-fs-read=* --allow-fs-write=*
++// Flags: --experimental-permission --allow-fs-read=*
+ 'use strict';
+
+ const common = require('../common');
+@@ -10,7 +10,7 @@ const { symlinkSync, symlink, promises: { symlink: symlinkAsync } } = require('f
+
+ const error = {
+   code: 'ERR_ACCESS_DENIED',
+-  message: /relative symbolic link target/,
++  message: /symlink API requires full fs\.read and fs\.write permissions/,
+ };
+
+ for (const targetString of ['a', './b/c', '../d', 'e/../f', 'C:drive-relative', 'ntfs:alternate']) {
+@@ -27,14 +27,14 @@ for (const targetString of ['a', './b/c', '../d', 'e/../f', 'C:drive-relative',
+   }
+ }
+
+-// Absolute should not throw
++// Absolute should throw too
+ for (const targetString of [path.resolve('.')]) {
+   for (const target of [targetString, Buffer.from(targetString)]) {
+     for (const path of [__filename]) {
+       symlink(target, path, common.mustCall((err) => {
+         assert(err);
+-        assert.strictEqual(err.code, 'EEXIST');
+-        assert.match(err.message, /file already exists/);
++        assert.strictEqual(err.code, error.code);
++        assert.match(err.message, error.message);
+       }));
+     }
+   }
+diff --git a/test/parallel/test-permission-fs-symlink.js b/test/parallel/test-permission-fs-symlink.js
+index c7d753c267c..268a8ecb9aa 100644
+--- a/test/parallel/test-permission-fs-symlink.js
++++ b/test/parallel/test-permission-fs-symlink.js
+@@ -21,15 +21,26 @@ const commonPathWildcard = path.join(__filename, '../../common*');
+ const blockedFile = fixtures.path('permission', 'deny', 'protected-file.md');
+ const blockedFolder = tmpdir.resolve('subdirectory');
+ const symlinkFromBlockedFile = tmpdir.resolve('example-symlink.md');
++const allowedFolder = tmpdir.resolve('allowed-folder');
++const traversalSymlink = path.join(allowedFolder, 'deep1', 'deep2', 'deep3', 'gotcha');
+
+ {
+   tmpdir.refresh();
+   fs.mkdirSync(blockedFolder);
++  // Create deep directory structure for path traversal test
++  fs.mkdirSync(allowedFolder);
++  fs.writeFileSync(path.resolve(allowedFolder, '../protected-file.md'), 'protected');
++  fs.mkdirSync(path.join(allowedFolder, 'deep1'));
++  fs.mkdirSync(path.join(allowedFolder, 'deep1', 'deep2'));
++  fs.mkdirSync(path.join(allowedFolder, 'deep1', 'deep2', 'deep3'));
+ }
+
+ {
+   // Symlink previously created
++  // fs.symlink API is allowed when full-read and full-write access
+   fs.symlinkSync(blockedFile, symlinkFromBlockedFile);
++  // Create symlink for path traversal test - symlink points to parent directory
++  fs.symlinkSync(allowedFolder, traversalSymlink);
+ }
+
+ {
+@@ -38,6 +49,7 @@ const symlinkFromBlockedFile = tmpdir.resolve('example-symlink.md');
+     [
+       '--experimental-permission',
+       `--allow-fs-read=${file}`, `--allow-fs-read=${commonPathWildcard}`, `--allow-fs-read=${symlinkFromBlockedFile}`,
++      `--allow-fs-read=${allowedFolder}`,
+       `--allow-fs-write=${symlinkFromBlockedFile}`,
+       file,
+     ],
+@@ -47,6 +59,8 @@ const symlinkFromBlockedFile = tmpdir.resolve('example-symlink.md');
+         BLOCKEDFOLDER: blockedFolder,
+         BLOCKEDFILE: blockedFile,
+         EXISTINGSYMLINK: symlinkFromBlockedFile,
++        TRAVERSALSYMLINK: traversalSymlink,
++        ALLOWEDFOLDER: allowedFolder,
+       },
+     }
+   );
+--
+2.43.7
meta-oe/recipes-devtools/nodejs/nodejs_20.18.2.bb +1 -0
index 67574a2ec1..7c97c7282c 100644
@@ -30,6 +30,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://0001-src-fix-build-with-GCC-15.patch \
            file://run-ptest \
            file://CVE-2025-55132.patch \
+           file://CVE-2025-55130.patch \
            "
 SRC_URI:append:class-target = " \
            file://0001-Using-native-binaries.patch \
Signature · 1 line
2.44.1
#2 lore raw

PATCH 3/5 Nodejs 20.18.2: Fix CVE-2025-59466

In reply to Anil Dongare -X (adongare - E INFOCHIPS PRIVATE LIMITED at Cisco)

From: Anil Dongare <[email protected]>

Upstream Repository: https://github.com/nodejs/node.git

Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2025-59466
Type: Security Fix
CVE: CVE-2025-59466
Score: 7.5
Patch: https://github.com/nodejs/node/commit/ddadc31f09af

---
 .../nodejs/nodejs/CVE-2025-59466.patch        | 508 ++++++++++++++++++
 .../recipes-devtools/nodejs/nodejs_20.18.2.bb |   1 +
 2 files changed, 509 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-59466.patch
meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-59466.patch new file +508 -0
new file mode 100644
index 0000000000..6121432697
@@ -0,0 +1,508 @@
+From c5cad9d8ec0bccc8136903823c079da7cc6b1930 Mon Sep 17 00:00:00 2001
+From: Matteo Collina <[email protected]>
+Date: Tue, 9 Dec 2025 23:50:18 +0100
+Subject: [PATCH 3/6] src: rethrow stack overflow exceptions in async_hooks
+
+When a stack overflow exception occurs during async_hooks callbacks
+(which use TryCatchScope::kFatal), detect the specific "Maximum call
+stack size exceeded" RangeError and re-throw it instead of immediately
+calling FatalException. This allows user code to catch the exception
+with try-catch blocks instead of requiring uncaughtException handlers.
+
+The implementation adds IsStackOverflowError() helper to detect stack
+overflow RangeErrors and re-throws them in TryCatchScope destructor
+instead of calling FatalException.
+
+This fixes the issue where async_hooks would cause stack overflow
+exceptions to exit with code 7 (kExceptionInFatalExceptionHandler)
+instead of being catchable.
+
+Fixes: https://github.com/nodejs/node/issues/37989
+Ref: https://hackerone.com/reports/3456295
+PR-URL: https://github.com/nodejs-private/node-private/pull/773
+Refs: https://hackerone.com/reports/3456295
+Reviewed-By: Robert Nagy <[email protected]>
+Reviewed-By: Paolo Insogna <[email protected]>
+Reviewed-By: Marco Ippolito <[email protected]>
+Reviewed-By: Rafael Gonzaga <[email protected]>
+Reviewed-By: Anna Henningsen <[email protected]>
+CVE-ID: CVE-2025-59466
+
+CVE: CVE-2025-59466
+Upstream-Status: Backport [https://github.com/nodejs/node/commit/ddadc31f09af]
+
+(cherry picked from commit ddadc31f09afdbab7545c86cc0f17d137beb8048)
+Signed-off-by: Anil Dongare <[email protected]>
+---
+ src/async_wrap.cc                             |  9 ++-
+ src/debug_utils.cc                            |  3 +-
+ src/node_errors.cc                            | 71 ++++++++++++++--
+ src/node_errors.h                             |  2 +-
+ src/node_report.cc                            |  3 +-
+ ...async-hooks-stack-overflow-nested-async.js | 80 +++++++++++++++++++
+ ...st-async-hooks-stack-overflow-try-catch.js | 47 +++++++++++
+ .../test-async-hooks-stack-overflow.js        | 47 +++++++++++
+ ...andler-stack-overflow-on-stack-overflow.js | 29 +++++++
+ ...caught-exception-handler-stack-overflow.js | 29 +++++++
+ 10 files changed, 306 insertions(+), 14 deletions(-)
+ create mode 100644 test/parallel/test-async-hooks-stack-overflow-nested-async.js
+ create mode 100644 test/parallel/test-async-hooks-stack-overflow-try-catch.js
+ create mode 100644 test/parallel/test-async-hooks-stack-overflow.js
+ create mode 100644 test/parallel/test-uncaught-exception-handler-stack-overflow-on-stack-overflow.js
+ create mode 100644 test/parallel/test-uncaught-exception-handler-stack-overflow.js
+
+diff --git a/src/async_wrap.cc b/src/async_wrap.cc
+index 65829a31a36..2b6fa142385 100644
+--- a/src/async_wrap.cc
++++ b/src/async_wrap.cc
+@@ -67,7 +67,8 @@ static const char* const provider_names[] = {
+ void AsyncWrap::DestroyAsyncIdsCallback(Environment* env) {
+   Local<Function> fn = env->async_hooks_destroy_function();
+
+-  TryCatchScope try_catch(env, TryCatchScope::CatchMode::kFatal);
++  TryCatchScope try_catch(env,
++                          TryCatchScope::CatchMode::kFatalRethrowStackOverflow);
+
+   do {
+     std::vector<double> destroy_async_id_list;
+@@ -96,7 +97,8 @@ void Emit(Environment* env, double async_id, AsyncHooks::Fields type,
+
+   HandleScope handle_scope(env->isolate());
+   Local<Value> async_id_value = Number::New(env->isolate(), async_id);
+-  TryCatchScope try_catch(env, TryCatchScope::CatchMode::kFatal);
++  TryCatchScope try_catch(env,
++                          TryCatchScope::CatchMode::kFatalRethrowStackOverflow);
+   USE(fn->Call(env->context(), Undefined(env->isolate()), 1, &async_id_value));
+ }
+
+@@ -668,7 +670,8 @@ void AsyncWrap::EmitAsyncInit(Environment* env,
+     object,
+   };
+
+-  TryCatchScope try_catch(env, TryCatchScope::CatchMode::kFatal);
++  TryCatchScope try_catch(env,
++                          TryCatchScope::CatchMode::kFatalRethrowStackOverflow);
+   USE(init_fn->Call(env->context(), object, arraysize(argv), argv));
+ }
+
+diff --git a/src/debug_utils.cc b/src/debug_utils.cc
+index 9d36082db67..7d85ab72615 100644
+--- a/src/debug_utils.cc
++++ b/src/debug_utils.cc
+@@ -333,7 +333,8 @@ void DumpJavaScriptBacktrace(FILE* fp) {
+   }
+
+   Local<StackTrace> stack;
+-  if (!GetCurrentStackTrace(isolate).ToLocal(&stack)) {
++  if (!GetCurrentStackTrace(isolate).ToLocal(&stack) ||
++      stack->GetFrameCount() == 0) {
+     return;
+   }
+
+diff --git a/src/node_errors.cc b/src/node_errors.cc
+index 69e474257b0..f984fd4c3d9 100644
+--- a/src/node_errors.cc
++++ b/src/node_errors.cc
+@@ -188,7 +188,7 @@ static std::string GetErrorSource(Isolate* isolate,
+ }
+
+ static std::atomic<bool> is_in_oom{false};
+-static std::atomic<bool> is_retrieving_js_stacktrace{false};
++static thread_local std::atomic<bool> is_retrieving_js_stacktrace{false};
+ MaybeLocal<StackTrace> GetCurrentStackTrace(Isolate* isolate, int frame_count) {
+   if (isolate == nullptr) {
+     return MaybeLocal<StackTrace>();
+@@ -216,9 +216,6 @@ MaybeLocal<StackTrace> GetCurrentStackTrace(Isolate* isolate, int frame_count) {
+       StackTrace::CurrentStackTrace(isolate, frame_count, options);
+
+   is_retrieving_js_stacktrace.store(false);
+-  if (stack->GetFrameCount() == 0) {
+-    return MaybeLocal<StackTrace>();
+-  }
+
+   return scope.Escape(stack);
+ }
+@@ -293,7 +290,8 @@ void PrintStackTrace(Isolate* isolate,
+
+ void PrintCurrentStackTrace(Isolate* isolate, StackTracePrefix prefix) {
+   Local<StackTrace> stack;
+-  if (GetCurrentStackTrace(isolate).ToLocal(&stack)) {
++  if (GetCurrentStackTrace(isolate).ToLocal(&stack) &&
++      stack->GetFrameCount() > 0) {
+     PrintStackTrace(isolate, stack, prefix);
+   }
+ }
+@@ -664,13 +662,52 @@ v8::ModifyCodeGenerationFromStringsResult ModifyCodeGenerationFromStrings(
+   };
+ }
+
++// Check if an exception is a stack overflow error (RangeError with
++// "Maximum call stack size exceeded" message). This is used to handle
++// stack overflow specially in TryCatchScope - instead of immediately
++// exiting, we can use the red zone to re-throw to user code.
++static bool IsStackOverflowError(Isolate* isolate, Local<Value> exception) {
++  if (!exception->IsNativeError()) return false;
++
++  Local<Object> err_obj = exception.As<Object>();
++  Local<String> constructor_name = err_obj->GetConstructorName();
++
++  // Must be a RangeError
++  Utf8Value name(isolate, constructor_name);
++  if (name.ToStringView() != "RangeError") return false;
++
++  // Check for the specific stack overflow message
++  Local<Context> context = isolate->GetCurrentContext();
++  Local<Value> message_val;
++  if (!err_obj->Get(context, String::NewFromUtf8Literal(isolate, "message"))
++           .ToLocal(&message_val)) {
++    return false;
++  }
++
++  if (!message_val->IsString()) return false;
++
++  Utf8Value message(isolate, message_val.As<String>());
++  return message.ToStringView() == "Maximum call stack size exceeded";
++}
++
+ namespace errors {
+
+ TryCatchScope::~TryCatchScope() {
+-  if (HasCaught() && !HasTerminated() && mode_ == CatchMode::kFatal) {
++  if (HasCaught() && !HasTerminated() && mode_ != CatchMode::kNormal) {
+     HandleScope scope(env_->isolate());
+     Local<v8::Value> exception = Exception();
+     Local<v8::Message> message = Message();
++
++    // Special handling for stack overflow errors in async_hooks: instead of
++    // immediately exiting, re-throw the exception. This allows the exception
++    // to propagate to user code's try-catch blocks.
++    if (mode_ == CatchMode::kFatalRethrowStackOverflow &&
++        IsStackOverflowError(env_->isolate(), exception)) {
++      ReThrow();
++      Reset();
++      return;
++    }
++
+     EnhanceFatalException enhance = CanContinue() ?
+         EnhanceFatalException::kEnhance : EnhanceFatalException::kDontEnhance;
+     if (message.IsEmpty())
+@@ -1221,8 +1258,26 @@ void TriggerUncaughtException(Isolate* isolate,
+   if (env->can_call_into_js()) {
+     // We do not expect the global uncaught exception itself to throw any more
+     // exceptions. If it does, exit the current Node.js instance.
+-    errors::TryCatchScope try_catch(env,
+-                                    errors::TryCatchScope::CatchMode::kFatal);
++    // Special case: if the original error was a stack overflow and calling
++    // _fatalException causes another stack overflow, rethrow it to allow
++    // user code's try-catch blocks to potentially catch it.
++    auto is_stack_overflow = [&] {
++      return IsStackOverflowError(env->isolate(), error);
++    };
++    // Without a JS stack, rethrowing may or may not do anything.
++    // TODO(addaleax): In V8, expose a way to check whether there is a JS stack
++    // or TryCatch that would capture the rethrown exception.
++    auto has_js_stack = [&] {
++      HandleScope handle_scope(env->isolate());
++      Local<StackTrace> stack;
++      return GetCurrentStackTrace(env->isolate(), 1).ToLocal(&stack) &&
++             stack->GetFrameCount() > 0;
++    };
++    errors::TryCatchScope::CatchMode mode =
++        is_stack_overflow() && has_js_stack()
++            ? errors::TryCatchScope::CatchMode::kFatalRethrowStackOverflow
++            : errors::TryCatchScope::CatchMode::kFatal;
++    errors::TryCatchScope try_catch(env, mode);
+     // Explicitly disable verbose exception reporting -
+     // if process._fatalException() throws an error, we don't want it to
+     // trigger the per-isolate message listener which will call this
+diff --git a/src/node_errors.h b/src/node_errors.h
+index ac07b96b5ca..0b60e521df1 100644
+--- a/src/node_errors.h
++++ b/src/node_errors.h
+@@ -265,7 +265,7 @@ namespace errors {
+
+ class TryCatchScope : public v8::TryCatch {
+  public:
+-  enum class CatchMode { kNormal, kFatal };
++  enum class CatchMode { kNormal, kFatal, kFatalRethrowStackOverflow };
+
+   explicit TryCatchScope(Environment* env, CatchMode mode = CatchMode::kNormal)
+       : v8::TryCatch(env->isolate()), env_(env), mode_(mode) {}
+diff --git a/src/node_report.cc b/src/node_report.cc
+index 5368d8eef2f..f7ec2c6ed0e 100644
+--- a/src/node_report.cc
++++ b/src/node_report.cc
+@@ -463,7 +463,8 @@ static void PrintJavaScriptStack(JSONWriter* writer,
+                                  const char* trigger) {
+   HandleScope scope(isolate);
+   Local<v8::StackTrace> stack;
+-  if (!GetCurrentStackTrace(isolate, MAX_FRAME_COUNT).ToLocal(&stack)) {
++  if (!GetCurrentStackTrace(isolate, MAX_FRAME_COUNT).ToLocal(&stack) ||
++      stack->GetFrameCount() == 0) {
+     PrintEmptyJavaScriptStack(writer);
+     return;
+   }
+diff --git a/test/parallel/test-async-hooks-stack-overflow-nested-async.js b/test/parallel/test-async-hooks-stack-overflow-nested-async.js
+new file mode 100644
+index 00000000000..779f8d75ae2
+--- /dev/null
++++ b/test/parallel/test-async-hooks-stack-overflow-nested-async.js
+@@ -0,0 +1,80 @@
++'use strict';
++
++// This test verifies that stack overflow during deeply nested async operations
++// with async_hooks enabled can be caught by try-catch. This simulates real-world
++// scenarios like processing deeply nested JSON structures where each level
++// creates async operations (e.g., database calls, API requests).
++
++require('../common');
++const assert = require('assert');
++const { spawnSync } = require('child_process');
++
++if (process.argv[2] === 'child') {
++  const { createHook } = require('async_hooks');
++
++  // Enable async_hooks with all callbacks (simulates APM tools)
++  createHook({
++    init() {},
++    before() {},
++    after() {},
++    destroy() {},
++    promiseResolve() {},
++  }).enable();
++
++  // Simulate an async operation (like a database call or API request)
++  async function fetchThing(id) {
++    return { id, data: `data-${id}` };
++  }
++
++  // Recursively process deeply nested data structure
++  // This will cause stack overflow when the nesting is deep enough
++  function processData(data, depth = 0) {
++    if (Array.isArray(data)) {
++      for (const item of data) {
++        // Create a promise to trigger async_hooks init callback
++        fetchThing(depth);
++        processData(item, depth + 1);
++      }
++    }
++  }
++
++  // Create deeply nested array structure iteratively (to avoid stack overflow
++  // during creation)
++  function createNestedArray(depth) {
++    let result = 'leaf';
++    for (let i = 0; i < depth; i++) {
++      result = [result];
++    }
++    return result;
++  }
++
++  // Create a very deep nesting that will cause stack overflow during processing
++  const deeplyNested = createNestedArray(50000);
++
++  try {
++    processData(deeplyNested);
++    // Should not complete successfully - the nesting is too deep
++    console.log('UNEXPECTED: Processing completed without error');
++    process.exit(1);
++  } catch (err) {
++    assert.strictEqual(err.name, 'RangeError');
++    assert.match(err.message, /Maximum call stack size exceeded/);
++    console.log('SUCCESS: try-catch caught the stack overflow in nested async');
++    process.exit(0);
++  }
++} else {
++  // Parent process - spawn the child and check exit code
++  const result = spawnSync(
++    process.execPath,
++    [__filename, 'child'],
++    { encoding: 'utf8', timeout: 30000 }
++  );
++
++  // Should exit successfully (try-catch worked)
++  assert.strictEqual(result.status, 0,
++                     `Expected exit code 0, got ${result.status}.\n` +
++                     `stdout: ${result.stdout}\n` +
++                     `stderr: ${result.stderr}`);
++  // Verify the error was handled by try-catch
++  assert.match(result.stdout, /SUCCESS: try-catch caught the stack overflow/);
++}
+diff --git a/test/parallel/test-async-hooks-stack-overflow-try-catch.js b/test/parallel/test-async-hooks-stack-overflow-try-catch.js
+new file mode 100644
+index 00000000000..43338905e78
+--- /dev/null
++++ b/test/parallel/test-async-hooks-stack-overflow-try-catch.js
+@@ -0,0 +1,47 @@
++'use strict';
++
++// This test verifies that when a stack overflow occurs with async_hooks
++// enabled, the exception can be caught by try-catch blocks in user code.
++
++require('../common');
++const assert = require('assert');
++const { spawnSync } = require('child_process');
++
++if (process.argv[2] === 'child') {
++  const { createHook } = require('async_hooks');
++
++  createHook({ init() {} }).enable();
++
++  function recursive(depth = 0) {
++    // Create a promise to trigger async_hooks init callback
++    new Promise(() => {});
++    return recursive(depth + 1);
++  }
++
++  try {
++    recursive();
++    // Should not reach here
++    process.exit(1);
++  } catch (err) {
++    assert.strictEqual(err.name, 'RangeError');
++    assert.match(err.message, /Maximum call stack size exceeded/);
++    console.log('SUCCESS: try-catch caught the stack overflow');
++    process.exit(0);
++  }
++
++  // Should not reach here
++  process.exit(2);
++} else {
++  // Parent process - spawn the child and check exit code
++  const result = spawnSync(
++    process.execPath,
++    [__filename, 'child'],
++    { encoding: 'utf8', timeout: 30000 }
++  );
++
++  assert.strictEqual(result.status, 0,
++                     `Expected exit code 0 (try-catch worked), got ${result.status}.\n` +
++                     `stdout: ${result.stdout}\n` +
++                     `stderr: ${result.stderr}`);
++  assert.match(result.stdout, /SUCCESS: try-catch caught the stack overflow/);
++}
+diff --git a/test/parallel/test-async-hooks-stack-overflow.js b/test/parallel/test-async-hooks-stack-overflow.js
+new file mode 100644
+index 00000000000..aff41969dbd
+--- /dev/null
++++ b/test/parallel/test-async-hooks-stack-overflow.js
+@@ -0,0 +1,47 @@
++'use strict';
++
++// This test verifies that when a stack overflow occurs with async_hooks
++// enabled, the uncaughtException handler is still called instead of the
++// process crashing with exit code 7.
++
++const common = require('../common');
++const assert = require('assert');
++const { spawnSync } = require('child_process');
++
++if (process.argv[2] === 'child') {
++  const { createHook } = require('async_hooks');
++
++  let handlerCalled = false;
++
++  function recursive() {
++    // Create a promise to trigger async_hooks init callback
++    new Promise(() => {});
++    return recursive();
++  }
++
++  createHook({ init() {} }).enable();
++
++  process.on('uncaughtException', common.mustCall((err) => {
++    assert.strictEqual(err.name, 'RangeError');
++    assert.match(err.message, /Maximum call stack size exceeded/);
++    // Ensure handler is only called once
++    assert.strictEqual(handlerCalled, false);
++    handlerCalled = true;
++  }));
++
++  setImmediate(recursive);
++} else {
++  // Parent process - spawn the child and check exit code
++  const result = spawnSync(
++    process.execPath,
++    [__filename, 'child'],
++    { encoding: 'utf8', timeout: 30000 }
++  );
++
++  // Should exit with code 0 (handler was called and handled the exception)
++  // Previously would exit with code 7 (kExceptionInFatalExceptionHandler)
++  assert.strictEqual(result.status, 0,
++                     `Expected exit code 0, got ${result.status}.\n` +
++                     `stdout: ${result.stdout}\n` +
++                     `stderr: ${result.stderr}`);
++}
+diff --git a/test/parallel/test-uncaught-exception-handler-stack-overflow-on-stack-overflow.js b/test/parallel/test-uncaught-exception-handler-stack-overflow-on-stack-overflow.js
+new file mode 100644
+index 00000000000..1923b7f24d9
+--- /dev/null
++++ b/test/parallel/test-uncaught-exception-handler-stack-overflow-on-stack-overflow.js
+@@ -0,0 +1,29 @@
++'use strict';
++
++// This test verifies that when the uncaughtException handler itself causes
++// a stack overflow, the process exits with a non-zero exit code.
++// This is important to ensure we don't silently swallow errors.
++
++require('../common');
++const assert = require('assert');
++const { spawnSync } = require('child_process');
++
++if (process.argv[2] === 'child') {
++  function f() { f(); }
++  process.on('uncaughtException', f);
++  f();
++} else {
++  // Parent process - spawn the child and check exit code
++  const result = spawnSync(
++    process.execPath,
++    [__filename, 'child'],
++    { encoding: 'utf8', timeout: 30000 }
++  );
++
++  // Should exit with non-zero exit code since the uncaughtException handler
++  // itself caused a stack overflow.
++  assert.notStrictEqual(result.status, 0,
++                        `Expected non-zero exit code, got ${result.status}.\n` +
++                        `stdout: ${result.stdout}\n` +
++                        `stderr: ${result.stderr}`);
++}
+diff --git a/test/parallel/test-uncaught-exception-handler-stack-overflow.js b/test/parallel/test-uncaught-exception-handler-stack-overflow.js
+new file mode 100644
+index 00000000000..050cd0923ee
+--- /dev/null
++++ b/test/parallel/test-uncaught-exception-handler-stack-overflow.js
+@@ -0,0 +1,29 @@
++'use strict';
++
++// This test verifies that when the uncaughtException handler itself causes
++// a stack overflow, the process exits with a non-zero exit code.
++// This is important to ensure we don't silently swallow errors.
++
++require('../common');
++const assert = require('assert');
++const { spawnSync } = require('child_process');
++
++if (process.argv[2] === 'child') {
++  function f() { f(); }
++  process.on('uncaughtException', f);
++  throw new Error('X');
++} else {
++  // Parent process - spawn the child and check exit code
++  const result = spawnSync(
++    process.execPath,
++    [__filename, 'child'],
++    { encoding: 'utf8', timeout: 30000 }
++  );
++
++  // Should exit with non-zero exit code since the uncaughtException handler
++  // itself caused a stack overflow.
++  assert.notStrictEqual(result.status, 0,
++                        `Expected non-zero exit code, got ${result.status}.\n` +
++                        `stdout: ${result.stdout}\n` +
++                        `stderr: ${result.stderr}`);
++}
+--
+2.43.7
meta-oe/recipes-devtools/nodejs/nodejs_20.18.2.bb +1 -0
index 7c97c7282c..779c70dbd0 100644
@@ -31,6 +31,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://run-ptest \
            file://CVE-2025-55132.patch \
            file://CVE-2025-55130.patch \
+           file://CVE-2025-59466.patch \
            "
 SRC_URI:append:class-target = " \
            file://0001-Using-native-binaries.patch \
Signature · 1 line
2.44.1
#3 lore raw

PATCH 4/5 Nodejs 20.18.2: Fix CVE-2026-21637

In reply to Anil Dongare -X (adongare - E INFOCHIPS PRIVATE LIMITED at Cisco)

From: Anil Dongare <[email protected]>

Upstream Repository: https://github.com/nodejs/node.git

Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2026-21637
Type: Security Fix
CVE: CVE-2026-21637
Score: 7.5
Patch: https://github.com/nodejs/node/commit/25d6799df65c

---
 .../nodejs/nodejs/CVE-2026-21637.patch        | 616 ++++++++++++++++++
 .../recipes-devtools/nodejs/nodejs_20.18.2.bb |   1 +
 2 files changed, 617 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/CVE-2026-21637.patch
meta-oe/recipes-devtools/nodejs/nodejs/CVE-2026-21637.patch new file +616 -0
new file mode 100644
index 0000000000..cdf23af7c1
@@ -0,0 +1,616 @@
+From ba66644cc25154598c4c3988abf812022e32b8e4 Mon Sep 17 00:00:00 2001
+From: Matteo Collina <[email protected]>
+Date: Mon, 22 Dec 2025 18:25:33 +0100
+Subject: [PATCH 4/6] tls: route callback exceptions through error handlers
+
+Wrap pskCallback and ALPNCallback invocations in try-catch blocks
+to route exceptions through owner.destroy() instead of letting them
+become uncaught exceptions. This prevents remote attackers from
+crashing TLS servers or causing resource exhaustion.
+
+Fixes: https://hackerone.com/reports/3473882
+PR-URL: https://github.com/nodejs-private/node-private/pull/782
+PR-URL: https://github.com/nodejs-private/node-private/pull/796
+Reviewed-By: Matteo Collina <[email protected]>
+CVE-ID: CVE-2026-21637
+
+CVE: CVE-2026-21637
+Upstream-Status: Backport [https://github.com/nodejs/node/commit/25d6799df65c]
+
+(cherry picked from commit 25d6799df65cd08f5fd057cae23e00a81bf33757)
+Signed-off-by: Anil Dongare <[email protected]>
+---
+ lib/_tls_wrap.js                              | 157 ++++----
+ test/parallel/test-tls-alpn-server-client.js  |  32 +-
+ ...ls-psk-alpn-callback-exception-handling.js | 334 ++++++++++++++++++
+ 3 files changed, 442 insertions(+), 81 deletions(-)
+ create mode 100644 test/parallel/test-tls-psk-alpn-callback-exception-handling.js
+
+diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
+index 4eb7b7ffa69..c3e48a6cbc8 100644
+--- a/lib/_tls_wrap.js
++++ b/lib/_tls_wrap.js
+@@ -233,39 +233,44 @@ function callALPNCallback(protocolsBuffer) {
+   const handle = this;
+   const socket = handle[owner_symbol];
+
+-  const servername = handle.getServername();
++  try {
++    const servername = handle.getServername();
+
+-  // Collect all the protocols from the given buffer:
+-  const protocols = [];
+-  let offset = 0;
+-  while (offset < protocolsBuffer.length) {
+-    const protocolLen = protocolsBuffer[offset];
+-    offset += 1;
++    // Collect all the protocols from the given buffer:
++    const protocols = [];
++    let offset = 0;
++    while (offset < protocolsBuffer.length) {
++      const protocolLen = protocolsBuffer[offset];
++      offset += 1;
+
+-    const protocol = protocolsBuffer.slice(offset, offset + protocolLen);
+-    offset += protocolLen;
++      const protocol = protocolsBuffer.slice(offset, offset + protocolLen);
++      offset += protocolLen;
+
+-    protocols.push(protocol.toString('ascii'));
+-  }
++      protocols.push(protocol.toString('ascii'));
++    }
+
+-  const selectedProtocol = socket[kALPNCallback]({
+-    servername,
+-    protocols,
+-  });
++    const selectedProtocol = socket[kALPNCallback]({
++      servername,
++      protocols,
++    });
+
+-  // Undefined -> all proposed protocols rejected
+-  if (selectedProtocol === undefined) return undefined;
++    // Undefined -> all proposed protocols rejected
++    if (selectedProtocol === undefined) return undefined;
+
+-  const protocolIndex = protocols.indexOf(selectedProtocol);
+-  if (protocolIndex === -1) {
+-    throw new ERR_TLS_ALPN_CALLBACK_INVALID_RESULT(selectedProtocol, protocols);
+-  }
+-  let protocolOffset = 0;
+-  for (let i = 0; i < protocolIndex; i++) {
+-    protocolOffset += 1 + protocols[i].length;
+-  }
++    const protocolIndex = protocols.indexOf(selectedProtocol);
++    if (protocolIndex === -1) {
++      throw new ERR_TLS_ALPN_CALLBACK_INVALID_RESULT(selectedProtocol, protocols);
++    }
++    let protocolOffset = 0;
++    for (let i = 0; i < protocolIndex; i++) {
++      protocolOffset += 1 + protocols[i].length;
++    }
+
+-  return protocolOffset;
++    return protocolOffset;
++  } catch (err) {
++    socket.destroy(err);
++    return undefined;
++  }
+ }
+
+ function requestOCSP(socket, info) {
+@@ -372,63 +377,75 @@ function onnewsession(sessionId, session) {
+
+ function onPskServerCallback(identity, maxPskLen) {
+   const owner = this[owner_symbol];
+-  const ret = owner[kPskCallback](owner, identity);
+-  if (ret == null)
+-    return undefined;
+
+-  let psk;
+-  if (isArrayBufferView(ret)) {
+-    psk = ret;
+-  } else {
+-    if (typeof ret !== 'object') {
+-      throw new ERR_INVALID_ARG_TYPE(
+-        'ret',
+-        ['Object', 'Buffer', 'TypedArray', 'DataView'],
+-        ret,
++  try {
++    const ret = owner[kPskCallback](owner, identity);
++    if (ret == null)
++      return undefined;
++
++    let psk;
++    if (isArrayBufferView(ret)) {
++      psk = ret;
++    } else {
++      if (typeof ret !== 'object') {
++        throw new ERR_INVALID_ARG_TYPE(
++          'ret',
++          ['Object', 'Buffer', 'TypedArray', 'DataView'],
++          ret,
++        );
++      }
++      psk = ret.psk;
++      validateBuffer(psk, 'psk');
++    }
++
++    if (psk.length > maxPskLen) {
++      throw new ERR_INVALID_ARG_VALUE(
++        'psk',
++        psk,
++        `Pre-shared key exceeds ${maxPskLen} bytes`,
+       );
+     }
+-    psk = ret.psk;
+-    validateBuffer(psk, 'psk');
+-  }
+
+-  if (psk.length > maxPskLen) {
+-    throw new ERR_INVALID_ARG_VALUE(
+-      'psk',
+-      psk,
+-      `Pre-shared key exceeds ${maxPskLen} bytes`,
+-    );
++    return psk;
++  } catch (err) {
++    owner.destroy(err);
++    return undefined;
+   }
+-
+-  return psk;
+ }
+
+ function onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
+   const owner = this[owner_symbol];
+-  const ret = owner[kPskCallback](hint);
+-  if (ret == null)
+-    return undefined;
+
+-  validateObject(ret, 'ret');
++  try {
++    const ret = owner[kPskCallback](hint);
++    if (ret == null)
++      return undefined;
++
++    validateObject(ret, 'ret');
++
++    validateBuffer(ret.psk, 'psk');
++    if (ret.psk.length > maxPskLen) {
++      throw new ERR_INVALID_ARG_VALUE(
++        'psk',
++        ret.psk,
++        `Pre-shared key exceeds ${maxPskLen} bytes`,
++      );
++    }
+
+-  validateBuffer(ret.psk, 'psk');
+-  if (ret.psk.length > maxPskLen) {
+-    throw new ERR_INVALID_ARG_VALUE(
+-      'psk',
+-      ret.psk,
+-      `Pre-shared key exceeds ${maxPskLen} bytes`,
+-    );
+-  }
++    validateString(ret.identity, 'identity');
++    if (Buffer.byteLength(ret.identity) > maxIdentityLen) {
++      throw new ERR_INVALID_ARG_VALUE(
++        'identity',
++        ret.identity,
++        `PSK identity exceeds ${maxIdentityLen} bytes`,
++      );
++    }
+
+-  validateString(ret.identity, 'identity');
+-  if (Buffer.byteLength(ret.identity) > maxIdentityLen) {
+-    throw new ERR_INVALID_ARG_VALUE(
+-      'identity',
+-      ret.identity,
+-      `PSK identity exceeds ${maxIdentityLen} bytes`,
+-    );
++    return { psk: ret.psk, identity: ret.identity };
++  } catch (err) {
++    owner.destroy(err);
++    return undefined;
+   }
+-
+-  return { psk: ret.psk, identity: ret.identity };
+ }
+
+ function onkeylog(line) {
+diff --git a/test/parallel/test-tls-alpn-server-client.js b/test/parallel/test-tls-alpn-server-client.js
+index 8f1a4b8e439..1ef32ca5938 100644
+--- a/test/parallel/test-tls-alpn-server-client.js
++++ b/test/parallel/test-tls-alpn-server-client.js
+@@ -252,25 +252,35 @@ function TestALPNCallback() {
+ function TestBadALPNCallback() {
+   // Server always returns a fixed invalid value:
+   const serverOptions = {
++    key: loadPEM('agent2-key'),
++    cert: loadPEM('agent2-cert'),
+     ALPNCallback: common.mustCall(() => 'http/5')
+   };
+
+-  const clientsOptions = [{
+-    ALPNProtocols: ['http/1', 'h2'],
+-  }];
++  const server = tls.createServer(serverOptions);
+
+-  process.once('uncaughtException', common.mustCall((error) => {
++  // Error should be emitted via tlsClientError, not as uncaughtException
++  server.on('tlsClientError', common.mustCall((error, socket) => {
+     assert.strictEqual(error.code, 'ERR_TLS_ALPN_CALLBACK_INVALID_RESULT');
++    socket.destroy();
+   }));
+
+-  runTest(clientsOptions, serverOptions, function(results) {
+-    // Callback returns 'http/5' => doesn't match client ALPN => error & reset
+-    assert.strictEqual(results[0].server, undefined);
+-    const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL'];
+-    assert.ok(allowedErrors.includes(results[0].client.error.code), `'${results[0].client.error.code}' was not one of ${allowedErrors}.`);
++  server.listen(0, serverIP, common.mustCall(() => {
++    const client = tls.connect({
++      port: server.address().port,
++      host: serverIP,
++      rejectUnauthorized: false,
++      ALPNProtocols: ['http/1', 'h2'],
++    }, common.mustNotCall());
+
+-    TestALPNOptionsCallback();
+-  });
++    client.on('error', common.mustCall((err) => {
++      // Client gets reset when server handles error via tlsClientError
++      const allowedErrors = ['ECONNRESET', 'ERR_SSL_TLSV1_ALERT_NO_APPLICATION_PROTOCOL'];
++      assert.ok(allowedErrors.includes(err.code), `'${err.code}' was not one of ${allowedErrors}.`);
++      server.close();
++      TestALPNOptionsCallback();
++    }));
++  }));
+ }
+
+ function TestALPNOptionsCallback() {
+diff --git a/test/parallel/test-tls-psk-alpn-callback-exception-handling.js b/test/parallel/test-tls-psk-alpn-callback-exception-handling.js
+new file mode 100644
+index 00000000000..93bf7396d2a
+--- /dev/null
++++ b/test/parallel/test-tls-psk-alpn-callback-exception-handling.js
+@@ -0,0 +1,334 @@
++'use strict';
++
++// This test verifies that exceptions in pskCallback and ALPNCallback are
++// properly routed through tlsClientError instead of becoming uncaught
++// exceptions. This is a regression test for a vulnerability where callback
++// validation errors would bypass all standard TLS error handlers.
++//
++// The vulnerability allows remote attackers to crash TLS servers or cause
++// resource exhaustion (file descriptor leaks) when pskCallback or ALPNCallback
++// throw exceptions during validation.
++
++const common = require('../common');
++
++if (!common.hasCrypto)
++  common.skip('missing crypto');
++
++const assert = require('assert');
++const { describe, it } = require('node:test');
++const tls = require('tls');
++const fixtures = require('../common/fixtures');
++
++const CIPHERS = 'PSK+HIGH';
++const TEST_TIMEOUT = 5000;
++
++// Helper to create a promise that rejects on uncaughtException or timeout
++function createTestPromise() {
++  const { promise, resolve, reject } = Promise.withResolvers();
++  let settled = false;
++
++  const cleanup = () => {
++    if (!settled) {
++      settled = true;
++      process.removeListener('uncaughtException', onUncaught);
++      clearTimeout(timeout);
++    }
++  };
++
++  const onUncaught = (err) => {
++    cleanup();
++    reject(new Error(
++      `Uncaught exception instead of tlsClientError: ${err.code || err.message}`
++    ));
++  };
++
++  const timeout = setTimeout(() => {
++    cleanup();
++    reject(new Error('Test timed out - tlsClientError was not emitted'));
++  }, TEST_TIMEOUT);
++
++  process.on('uncaughtException', onUncaught);
++
++  return {
++    resolve: (value) => {
++      cleanup();
++      resolve(value);
++    },
++    reject: (err) => {
++      cleanup();
++      reject(err);
++    },
++    promise,
++  };
++}
++
++describe('TLS callback exception handling', () => {
++
++  // Test 1: PSK server callback returning invalid type should emit tlsClientError
++  it('pskCallback returning invalid type emits tlsClientError', async (t) => {
++    const server = tls.createServer({
++      ciphers: CIPHERS,
++      pskCallback: () => {
++        // Return invalid type (string instead of object/Buffer)
++        return 'invalid-should-be-object-or-buffer';
++      },
++      pskIdentityHint: 'test-hint',
++    });
++
++    t.after(() => server.close());
++
++    const { promise, resolve, reject } = createTestPromise();
++
++    server.on('tlsClientError', common.mustCall((err, socket) => {
++      try {
++        assert.ok(err instanceof Error);
++        assert.strictEqual(err.code, 'ERR_INVALID_ARG_TYPE');
++        socket.destroy();
++        resolve();
++      } catch (e) {
++        reject(e);
++      }
++    }));
++
++    server.on('secureConnection', common.mustNotCall(() => {
++      reject(new Error('secureConnection should not fire'));
++    }));
++
++    await new Promise((res) => server.listen(0, res));
++
++    const client = tls.connect({
++      port: server.address().port,
++      host: '127.0.0.1',
++      ciphers: CIPHERS,
++      checkServerIdentity: () => {},
++      pskCallback: () => ({
++        psk: Buffer.alloc(32),
++        identity: 'test-identity',
++      }),
++    });
++
++    client.on('error', () => {});
++
++    await promise;
++  });
++
++  // Test 2: PSK server callback throwing should emit tlsClientError
++  it('pskCallback throwing emits tlsClientError', async (t) => {
++    const server = tls.createServer({
++      ciphers: CIPHERS,
++      pskCallback: () => {
++        throw new Error('Intentional callback error');
++      },
++      pskIdentityHint: 'test-hint',
++    });
++
++    t.after(() => server.close());
++
++    const { promise, resolve, reject } = createTestPromise();
++
++    server.on('tlsClientError', common.mustCall((err, socket) => {
++      try {
++        assert.ok(err instanceof Error);
++        assert.strictEqual(err.message, 'Intentional callback error');
++        socket.destroy();
++        resolve();
++      } catch (e) {
++        reject(e);
++      }
++    }));
++
++    server.on('secureConnection', common.mustNotCall(() => {
++      reject(new Error('secureConnection should not fire'));
++    }));
++
++    await new Promise((res) => server.listen(0, res));
++
++    const client = tls.connect({
++      port: server.address().port,
++      host: '127.0.0.1',
++      ciphers: CIPHERS,
++      checkServerIdentity: () => {},
++      pskCallback: () => ({
++        psk: Buffer.alloc(32),
++        identity: 'test-identity',
++      }),
++    });
++
++    client.on('error', () => {});
++
++    await promise;
++  });
++
++  // Test 3: ALPN callback returning non-matching protocol should emit tlsClientError
++  it('ALPNCallback returning invalid result emits tlsClientError', async (t) => {
++    const server = tls.createServer({
++      key: fixtures.readKey('agent2-key.pem'),
++      cert: fixtures.readKey('agent2-cert.pem'),
++      ALPNCallback: () => {
++        // Return a protocol not in the client's list
++        return 'invalid-protocol-not-in-list';
++      },
++    });
++
++    t.after(() => server.close());
++
++    const { promise, resolve, reject } = createTestPromise();
++
++    server.on('tlsClientError', common.mustCall((err, socket) => {
++      try {
++        assert.ok(err instanceof Error);
++        assert.strictEqual(err.code, 'ERR_TLS_ALPN_CALLBACK_INVALID_RESULT');
++        socket.destroy();
++        resolve();
++      } catch (e) {
++        reject(e);
++      }
++    }));
++
++    server.on('secureConnection', common.mustNotCall(() => {
++      reject(new Error('secureConnection should not fire'));
++    }));
++
++    await new Promise((res) => server.listen(0, res));
++
++    const client = tls.connect({
++      port: server.address().port,
++      host: '127.0.0.1',
++      rejectUnauthorized: false,
++      ALPNProtocols: ['http/1.1', 'h2'],
++    });
++
++    client.on('error', () => {});
++
++    await promise;
++  });
++
++  // Test 4: ALPN callback throwing should emit tlsClientError
++  it('ALPNCallback throwing emits tlsClientError', async (t) => {
++    const server = tls.createServer({
++      key: fixtures.readKey('agent2-key.pem'),
++      cert: fixtures.readKey('agent2-cert.pem'),
++      ALPNCallback: () => {
++        throw new Error('Intentional ALPN callback error');
++      },
++    });
++
++    t.after(() => server.close());
++
++    const { promise, resolve, reject } = createTestPromise();
++
++    server.on('tlsClientError', common.mustCall((err, socket) => {
++      try {
++        assert.ok(err instanceof Error);
++        assert.strictEqual(err.message, 'Intentional ALPN callback error');
++        socket.destroy();
++        resolve();
++      } catch (e) {
++        reject(e);
++      }
++    }));
++
++    server.on('secureConnection', common.mustNotCall(() => {
++      reject(new Error('secureConnection should not fire'));
++    }));
++    await new Promise((res) => server.listen(0, res));
++
++    const client = tls.connect({
++      port: server.address().port,
++      host: '127.0.0.1',
++      rejectUnauthorized: false,
++      ALPNProtocols: ['http/1.1'],
++    });
++
++    client.on('error', () => {});
++
++    await promise;
++  });
++
++  // Test 5: PSK client callback returning invalid type should emit error event
++  it('client pskCallback returning invalid type emits error', async (t) => {
++    const PSK = Buffer.alloc(32);
++
++    const server = tls.createServer({
++      ciphers: CIPHERS,
++      pskCallback: () => PSK,
++      pskIdentityHint: 'test-hint',
++    });
++
++    t.after(() => server.close());
++
++    const { promise, resolve, reject } = createTestPromise();
++
++    server.on('secureConnection', common.mustNotCall(() => {
++      reject(new Error('secureConnection should not fire'));
++    }));
++
++    await new Promise((res) => server.listen(0, res));
++
++    const client = tls.connect({
++      port: server.address().port,
++      host: '127.0.0.1',
++      ciphers: CIPHERS,
++      checkServerIdentity: () => {},
++      pskCallback: () => {
++        // Return invalid type - should cause validation error
++        return 'invalid-should-be-object';
++      },
++    });
++
++    client.on('error', common.mustCall((err) => {
++      try {
++        assert.ok(err instanceof Error);
++        assert.strictEqual(err.code, 'ERR_INVALID_ARG_TYPE');
++        resolve();
++      } catch (e) {
++        reject(e);
++      }
++    }));
++
++    await promise;
++  });
++
++  // Test 6: PSK client callback throwing should emit error event
++  it('client pskCallback throwing emits error', async (t) => {
++    const PSK = Buffer.alloc(32);
++
++    const server = tls.createServer({
++      ciphers: CIPHERS,
++      pskCallback: () => PSK,
++      pskIdentityHint: 'test-hint',
++    });
++
++    t.after(() => server.close());
++
++    const { promise, resolve, reject } = createTestPromise();
++
++    server.on('secureConnection', common.mustNotCall(() => {
++      reject(new Error('secureConnection should not fire'));
++    }));
++
++    await new Promise((res) => server.listen(0, res));
++
++    const client = tls.connect({
++      port: server.address().port,
++      host: '127.0.0.1',
++      ciphers: CIPHERS,
++      checkServerIdentity: () => {},
++      pskCallback: () => {
++        throw new Error('Intentional client PSK callback error');
++      },
++    });
++
++    client.on('error', common.mustCall((err) => {
++      try {
++        assert.ok(err instanceof Error);
++        assert.strictEqual(err.message, 'Intentional client PSK callback error');
++        resolve();
++      } catch (e) {
++        reject(e);
++      }
++    }));
++
++    await promise;
++  });
++});
+--
+2.43.7
meta-oe/recipes-devtools/nodejs/nodejs_20.18.2.bb +1 -0
index 779c70dbd0..68eb40bc1d 100644
@@ -32,6 +32,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://CVE-2025-55132.patch \
            file://CVE-2025-55130.patch \
            file://CVE-2025-59466.patch \
+           file://CVE-2026-21637.patch \
            "
 SRC_URI:append:class-target = " \
            file://0001-Using-native-binaries.patch \
Signature · 1 line
2.44.1
#4 lore raw

PATCH 5/5 Nodejs 20.18.2: Fix CVE-2025-59465

In reply to Anil Dongare -X (adongare - E INFOCHIPS PRIVATE LIMITED at Cisco)

From: Anil Dongare <[email protected]>

Upstream Repository: https://github.com/nodejs/node.git

Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2025-59465
Type: Security Fix
CVE: CVE-2025-59465
Score: 7.5
Patch: https://github.com/nodejs/node/commit/eb8e41f8dbe6

---
 .../nodejs/nodejs/CVE-2025-59465.patch        | 49 +++++++++++++++++++
 .../recipes-devtools/nodejs/nodejs_20.18.2.bb |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-59465.patch
meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-59465.patch new file +49 -0
new file mode 100644
index 0000000000..81d64609c3
@@ -0,0 +1,49 @@
+From 27ddb91569c1bd9c72dbc557e53458b9ebfbc573 Mon Sep 17 00:00:00 2001
+From: RafaelGSS <[email protected]>
+Date: Fri, 31 Oct 2025 16:27:48 -0300
+Subject: [PATCH 5/6] lib: add TLSSocket default error handler
+
+This prevents the server from crashing due to an unhandled rejection
+when a TLSSocket connection is abruptly destroyed during initialization
+and the user has not attached an error handler to the socket.
+e.g:
+
+```js
+const server = http2.createSecureServer({ ... })
+server.on('secureConnection', socket => {
+  socket.on('error', err => {
+    console.log(err)
+  })
+})
+```
+
+PR-URL: https://github.com/nodejs-private/node-private/pull/797
+Fixes: https://github.com/nodejs/node/issues/44751
+Refs: https://hackerone.com/bugs?subject=nodejs&report_id=3262404
+Reviewed-By: Matteo Collina <[email protected]>
+Reviewed-By: Anna Henningsen <[email protected]>
+CVE-ID: CVE-2025-59465
+
+CVE: CVE-2025-59465
+Upstream-Status: Backport [https://github.com/nodejs/node/commit/eb8e41f8dbe6]
+
+(cherry picked from commit eb8e41f8dbe6de127fb11baca725e1b469612434)
+Signed-off-by: Anil Dongare <[email protected]>
+---
+ lib/_tls_wrap.js | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js
+index c3e48a6cbc8..d9c7e32174d 100644
+--- a/lib/_tls_wrap.js
++++ b/lib/_tls_wrap.js
+@@ -1268,6 +1268,7 @@ function tlsConnectionListener(rawSocket) {
+   socket[kErrorEmitted] = false;
+   socket.on('close', onSocketClose);
+   socket.on('_tlsError', onSocketTLSError);
++  socket.on('error', onSocketTLSError);
+ }
+
+ // AUTHENTICATION MODES
+--
+2.43.7
meta-oe/recipes-devtools/nodejs/nodejs_20.18.2.bb +1 -0
index 68eb40bc1d..b1c9057557 100644
@@ -33,6 +33,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://CVE-2025-55130.patch \
            file://CVE-2025-59466.patch \
            file://CVE-2026-21637.patch \
+           file://CVE-2025-59465.patch \
            "
 SRC_URI:append:class-target = " \
            file://0001-Using-native-binaries.patch \
Signature · 1 line
2.44.1
#5 lore raw
In reply to Anil Dongare -X (adongare - E INFOCHIPS PRIVATE LIMITED at Cisco)

Can you please check if these are still needed after the changes in:

https://git.openembedded.org/meta-openembedded-contrib/log/?h=anujm/scarthgap

Quoted 226 lines · On Thu, Feb 12, 2026 at 6:32 PM Anil Dongare -X (adongare - E INFOCHIPS…

From: Anil Dongare <[email protected]>

Upstream Repository: https://github.com/nodejs/node.git

Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2025-55132
Type: Security Fix
CVE: CVE-2025-55132
Score: 5.3
Patch: https://github.com/nodejs/node/commit/ebbf942a83bc

---
 .../nodejs/nodejs/CVE-2025-55132.patch        | 178 ++++++++++++++++++
 .../recipes-devtools/nodejs/nodejs_20.18.2.bb |   1 +
 2 files changed, 179 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-55132.patch
meta-oe/recipes-devtools/nodejs/nodejs/CVE-2025-55132.patch new file +178 -0
new file mode 100644
index 0000000000..08c885473c
@@ -0,0 +1,178 @@
+From b89fc3633ec12b6d1da5b9978e6bb1c5fbacf021 Mon Sep 17 00:00:00 2001
+From: RafaelGSS <[email protected]>
+Date: Tue, 21 Oct 2025 18:25:31 -0300
+Subject: [PATCH 1/5] lib: disable futimes when permission model is enabled
+
+Refs: https://hackerone.com/reports/3390084
+PR-URL: https://github.com/nodejs-private/node-private/pull/748
+Reviewed-By: Matteo Collina <[email protected]>
+Reviewed-By: Anna Henningsen <[email protected]>
+CVE-ID: CVE-2025-55132
+
+CVE: CVE-2025-55132
+Upstream-Status: Backport [https://github.com/nodejs/node/commit/ebbf942a83bc]
+
+(cherry picked from commit ebbf942a83bc70d90a3bcb6712c7b67bc479fdf5)
+Signed-off-by: Anil Dongare <[email protected]>
+---
+ lib/fs.js                                     | 24 ++++++++++
+ test/fixtures/permission/fs-write.js          | 47 ++++++++++++++++++-
+ test/parallel/test-permission-fs-supported.js | 17 ++++++-
+ 3 files changed, 86 insertions(+), 2 deletions(-)
+
+diff --git a/lib/fs.js b/lib/fs.js
+index 64f0b5e88ed..9206a18663c 100644
+--- a/lib/fs.js
++++ b/lib/fs.js
+@@ -1274,6 +1274,11 @@ function rmSync(path, options) {
+ function fdatasync(fd, callback) {
+   const req = new FSReqCallback();
+   req.oncomplete = makeCallback(callback);
++
++  if (permission.isEnabled()) {
++    callback(new ERR_ACCESS_DENIED('fdatasync API is disabled when Permission Model is enabled.'));
++    return;
++  }
+   binding.fdatasync(fd, req);
+ }
+
+@@ -1285,6 +1290,9 @@ function fdatasync(fd, callback) {
+  * @returns {void}
+  */
+ function fdatasyncSync(fd) {
++  if (permission.isEnabled()) {
++    throw new ERR_ACCESS_DENIED('fdatasync API is disabled when Permission Model is enabled.');
++  }
+   binding.fdatasync(fd);
+ }
+
+@@ -1298,6 +1306,10 @@ function fdatasyncSync(fd) {
+ function fsync(fd, callback) {
+   const req = new FSReqCallback();
+   req.oncomplete = makeCallback(callback);
++  if (permission.isEnabled()) {
++    callback(new ERR_ACCESS_DENIED('fsync API is disabled when Permission Model is enabled.'));
++    return;
++  }
+   binding.fsync(fd, req);
+ }
+
+@@ -1308,6 +1320,9 @@ function fsync(fd, callback) {
+  * @returns {void}
+  */
+ function fsyncSync(fd) {
++  if (permission.isEnabled()) {
++    throw new ERR_ACCESS_DENIED('fsync API is disabled when Permission Model is enabled.');
++  }
+   binding.fsync(fd);
+ }
+
+@@ -2164,6 +2179,11 @@ function futimes(fd, atime, mtime, callback) {
+   mtime = toUnixTimestamp(mtime, 'mtime');
+   callback = makeCallback(callback);
+
++  if (permission.isEnabled()) {
++    callback(new ERR_ACCESS_DENIED('futimes API is disabled when Permission Model is enabled.'));
++    return;
++  }
++
+   const req = new FSReqCallback();
+   req.oncomplete = callback;
+   binding.futimes(fd, atime, mtime, req);
+@@ -2179,6 +2199,10 @@ function futimes(fd, atime, mtime, callback) {
+  * @returns {void}
+  */
+ function futimesSync(fd, atime, mtime) {
++  if (permission.isEnabled()) {
++    throw new ERR_ACCESS_DENIED('futimes API is disabled when Permission Model is enabled.');
++  }
++
+   binding.futimes(
+     fd,
+     toUnixTimestamp(atime, 'atime'),
+diff --git a/test/fixtures/permission/fs-write.js b/test/fixtures/permission/fs-write.js
+index 31e96860972..4b98b6d2b78 100644
+--- a/test/fixtures/permission/fs-write.js
++++ b/test/fixtures/permission/fs-write.js
+@@ -490,4 +490,49 @@ const relativeProtectedFolder = process.env.RELATIVEBLOCKEDFOLDER;
+   }, {
+     code: 'ERR_ACCESS_DENIED',
+   });
+-}
+\ No newline at end of file
++}
++
++// fs.utimes with read-only fd
++{
++  assert.throws(() => {
++    // blocked file is allowed to read
++    const fd = fs.openSync(blockedFile, 'r');
++    const date = new Date();
++    date.setFullYear(2100,0,1);
++
++    fs.futimes(fd, date, date, common.expectsError({
++      code: 'ERR_ACCESS_DENIED',
++    }));
++    fs.futimesSync(fd, date, date);
++  }, {
++    code: 'ERR_ACCESS_DENIED',
++  });
++}
++
++// fs.fdatasync with read-only fd
++{
++  assert.throws(() => {
++    // blocked file is allowed to read
++    const fd = fs.openSync(blockedFile, 'r');
++    fs.fdatasync(fd, common.expectsError({
++      code: 'ERR_ACCESS_DENIED',
++    }));
++    fs.fdatasyncSync(fd);
++  }, {
++    code: 'ERR_ACCESS_DENIED',
++  });
++}
++
++// fs.fsync with read-only fd
++{
++  assert.throws(() => {
++    // blocked file is allowed to read
++    const fd = fs.openSync(blockedFile, 'r');
++    fs.fsync(fd, common.expectsError({
++      code: 'ERR_ACCESS_DENIED',
++    }));
++    fs.fsyncSync(fd);
++  }, {
++    code: 'ERR_ACCESS_DENIED',
++  });
++}
+diff --git a/test/parallel/test-permission-fs-supported.js b/test/parallel/test-permission-fs-supported.js
+index 1062117798b..805365f28b3 100644
+--- a/test/parallel/test-permission-fs-supported.js
++++ b/test/parallel/test-permission-fs-supported.js
+@@ -77,7 +77,22 @@ const ignoreList = [
+   'unwatchFile',
+   ...syncAndAsyncAPI('lstat'),
+   ...syncAndAsyncAPI('realpath'),
+-  // fd required methods
++  // File descriptor–based metadata operations
++  //
++  // The kernel does not allow opening a file descriptor for an inode
++  // with write access if the inode itself is read-only. However, it still
++  // permits modifying the inode’s metadata (e.g., permission bits, ownership,
++  // timestamps) because you own the file. These changes can be made either
++  // by referring to the file by name (e.g., chmod) or through any existing
++  // file descriptor that identifies the same inode (e.g., fchmod).
++  //
++  // If the kernel required write access to change metadata, it would be
++  // impossible to modify the permissions of a file once it was made read-only.
++  // For that reason, syscalls such as fchmod, fchown, and futimes bypass
++  // the file descriptor’s access mode. Even a read-only ('r') descriptor
++  // can still update metadata. To prevent unintended modifications,
++  // these APIs are therefore blocked by default when permission model is
++  // enabled.
+   ...syncAndAsyncAPI('close'),
+   ...syncAndAsyncAPI('fchown'),
+   ...syncAndAsyncAPI('fchmod'),
+--
+2.43.7
meta-oe/recipes-devtools/nodejs/nodejs_20.18.2.bb +1 -1
index d757a7395c..67574a2ec1 100644
@@ -29,6 +29,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://zlib-fix-pointer-alignment.patch \
            file://0001-src-fix-build-with-GCC-15.patch \
            file://run-ptest \
+           file://CVE-2025-55132.patch \
            "
 SRC_URI:append:class-target = " \
            file://0001-Using-native-binaries.patch \
--

2.44.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#124348): https://lists.openembedded.org/g/openembedded-devel/message/124348
Mute This Topic: https://lists.openembedded.org/mt/117772145/3616702
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw

Hi Anuj,
Thanks for pointing this out.
I have checked the changes in your branch and confirmed the upgrade to Node.js 20.20.0. Since this version upgrade covers the fix for CVE-2025-55132, my patch for 20.18.2 is no longer needed. Please feel free to discard this patch series.
Thanks,
Anil Dongare.