Skip to content
Crypto Disclosed report Intermediate CVE-2022-32222

Node 18 reads openssl.cnf from /home/iojs/build/... upon startup.

Node.js 18 attempts to read an OpenSSL configuration file from a hardcoded build path that does not exist. An attacker on a shared host could create that path and potentially influence OpenSSL settings for other users.

msvrmiscovet Follow

Originally disclosed on HackerOne

Medium 6.6 View original
  • Triaged in 2 days
  • Fixed in 5 days
  • Disclosed after 13 months

NOTE! Thanks for submitting a report! Please replace all the [square] sections below with the pertinent details. Remember, the more detail you provide, the easier it is for us to triage and respond quickly, so be sure to take your time filling out the report!

Summary: I noticed that when Node 18 (18.4.0 on Ubuntu, 64-bit via Docker) starts, it attempts to read /home/iojs/build/ws/out/Release/obj.target/deps/openssl/openssl.cnf, which ordinarily doesn't exist. I haven't proven this out, but I suspect that if one were to create this file, it would be read and processed as a normal OpenSSF configuration file. The attack would be an attacker on a shared Linux host with a self-chosen username (iojs) being able to affect the OpenSSF configuration of other users. I believe the iojs home directory is something configured within the Node.js build/CI pipeline, as opposed to something internal to OpenSSL.

Description:

Steps To Reproduce:

  1. Install Node.js 18.4.0 on Ubuntu (wget 'https://nodejs.org/dist/v18.4.0/node-v18.4.0-linux-x64.tar.xz' && tar Jxvf ./node-v18.4.0-linux-x64.tar.xz && cd node-v18.4.0-linux-x64/bin and strace (sudo apt-get install strace).
  2. Run node (no parameters) under strace, and watch for open syscalls pointing to the openssf.cnf file (strace -f -ff -e trace=network,file,process -s 128 -D ./node 2>&1 | grep openssl)
  3. See the read attempt:
root@bd9a1157008b:/usr/src/app/node-v18.4.0-linux-x64/bin# strace -f -ff -e trace=network,file,process -s 128 -D ./node 2>&1 | grep openssl
[pid  1536] openat(AT_FDCWD, "/home/iojs/build/ws/out/Release/obj.target/deps/openssl/openssl.cnf", O_RDONLY) = -1 ENOENT (No such file or directory)

I did not see this occur when testing 16.15.1 (also Ubuntu, 64-bit), but I do see this in 17.0.0, which suggests it came in with the move to OpenSSL 3.0 (change log).

Impact:

I'm presuming that the openssl.cnf file is being read as part of OpenSSL's initialization; this is likely used to configure Node.js, though admittedly, it might be overwritten afterwards with a "correct" configuration.

Supporting Material/References:

N/A

Impact

The openssl.cnf file contains security configuration information for OpenSSL. It's possible that changing things like default ciphers could affect the security of an application using it. (Admittedly, I'm not super familiar with this -- I'm definitely making some assumptions.)

The original report as published on HackerOne, by msvrmiscovet. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Node.js build process hardcoded an OpenSSL configuration path from the build environment, which is then used at runtime.

Impact

An attacker on a shared Linux host could potentially affect the OpenSSL configuration of other users, which might weaken security settings like default ciphers.

What the attacker needed

Shared Linux host; attacker can create files in /home/iojs

How it was found

  1. Install Node.js 18.4.0 on Ubuntu and install strace.
  2. Run node under strace and filter for openssl-related file operations.
  3. Observe the attempt to open the openssl.cnf file at the hardcoded path.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When Node.js starts, it looks for a settings file for OpenSSL, the library that handles encryption. The path it looks at is a leftover from the build machine and normally doesn't exist. If someone else on the same computer creates that file, they might be able to change how encryption works for other users.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More from Node.js

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.