Skip to content
Access control Disclosed report Advanced CVE-2023-30586

OpenSSL engines can be used to bypass and/or disable the Node.js permission model

Node.js 20's experimental permission model allows loading arbitrary OpenSSL engines via crypto.setEngine(), even when native addons are disallowed. An attacker could use a malicious engine to bypass or disable the permission model, escalating privileges.

tniessen Follow

Originally disclosed on HackerOne

Bounty$2,540 Medium View original
  • Triaged in 7 days
  • Fixed in 38 days
  • Paid in 38 days
  • Disclosed after 2 months

Summary by the program

###OpenSSL engines can be used to bypass the permission model (Medium) (CVE-2023-30586)

Node.js 20 allows loading arbitrary OpenSSL engines when the experimental permission model is enabled, which can bypass and/or disable the permission model.

The crypto.setEngine() API can be used to bypass the permission model when called with a compatible OpenSSL engine. The OpenSSL engine can, for example, disable the permission model in the host process by manipulating the process's stack memory to locate the permission model Permission::enabled_ in the host process's heap memory.

This vulnerability affects all users using the experimental permission model in Node.js 20.

The report

Summary: Node.js 20 allows loading arbitrary OpenSSL engines even when the permission model is enabled, which can bypass and/or disable the permission model.

Description: The permission model implementation permits loading arbitrary native code, e.g., through crypto.setEngine(), even when native addons are disallowed, which is the default configuration. Not only can this code bypass the permission system, it can also disable the permission system entirely, effectively allowing JavaScript code to escalate its own privileges.

Steps To Reproduce:

  1. Enable the permission model.
  2. Call, for example, crypto.setEngine() with a compatible OpenSSL engine.
  3. Arbitrary code execution occurs, unaffected by the permission model.

Impact

The permission model is supposed to restrict the capabilities of running code. However, exploiting this vulnerability allows an attacker to easily bypass the permission model entirely. The OpenSSL engine can, for example, disable the permission model in the host process, and subsequently executed JavaScript code will be unaffected by the previously enabled permission model. This allows running JavaScript code to effectively elevate its own permissions.

The original report as published on HackerOne, by tniessen. 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

The permission model implementation permits loading arbitrary native code through crypto.setEngine() even when native addons are disallowed.

Impact

An attacker could bypass or disable the permission model entirely, allowing JavaScript code to elevate its own permissions.

What the attacker needed

Node.js 20 with experimental permission model enabled; Ability to call crypto.setEngine(); A compatible OpenSSL engine

How it was found

  1. Enable the permission model.
  2. Call crypto.setEngine() with a compatible OpenSSL engine.
  3. Arbitrary code execution occurs, unaffected by the permission model.

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.

Node.js has an experimental feature called the permission model that is meant to limit what code can do, like a sandbox. However, a function called crypto.setEngine() lets you load extra native code (an OpenSSL engine) even when other native code is blocked. That loaded code can then turn off the permission model, so the sandbox fails.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by tniessen

View all

15 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.