Skip to content

openssl bug when using Node.js 10.x or Node.js 11.x but Node.js 8.x is fine #24964

@hsgreen

Description

@hsgreen

I observed a very strange bug when I recently updated from using Node.js 8 to 11 (I also then tried 10.x and it had the same issue as 11.x).

I'm running in a Centos 7 (latest) docker container and install using these instructions.

I have a custom node module that I have built (I rebuild each time I install a new Node.js version), that uses another custom library that I have built that uses OpenSSL. The version of OpenSSL at the system level is standard Centos 7 OpenSSL 1.0.2k-fips. Within this custom library linked in as a shared library from my custom node module it makes the following openssl call:

m_certificate = X509_new();

On all versions of node this call succeeds and m_certificate is not NULL. However, the problem is on Node.js 10.x and 11.x one of the critical members of that object is still set to NULL after that call. This is the cert_info member. When cert_info is NULL it causes subsequent methods to set/update this certificate to seg fault, such as X509_time_adj_ex(X509_get_notBefore(m_certificate), 0, 0, &nowTime.tv_sec) because nearly all these OpenSSL methods/macros blindly call m_certificate->cert_info->....

I thought maybe it was a bug in the system installed OpenSSL, but when I downgraded to use the latest 8.x Node.js version, then the problem went away. It must be something with the OpenSSL configuration or build when using Node.js 10 and 11.

Is there anything in Node.js 10 and 11 that interacts with OpenSSL differently than 8.x or does the pre-built binary distros use a statically linked OpenSSL version that may be different than 8.x and may introduce this odd failure to allocate the cert_info member when calling X509_new()?

Metadata

Metadata

Assignees

No one assigned

    Labels

    addonsIssues and PRs related to native addons.cryptoIssues and PRs related to the crypto subsystem.questionIssues that look for answers.wontfixIssues that will not be fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions