OpenSSL engines can be used to bypass and/or disable the permission model
The Node.js permission model allowed loading arbitrary OpenSSL engines even when native addons were disallowed, so code could run outside the model's restrictions. An attacker could use this to bypass or disable the permission model and escalate privileges.
- Disclosed after 2 months
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:
- Enable the permission model.
- Call, for example,
crypto.setEngine()with a compatible OpenSSL engine. - 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.
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 permission model did not block the loading of native OpenSSL engines through crypto.setEngine(), even though native addons were disallowed by default.
Impact
An attacker could bypass or disable the permission model entirely, allowing running JavaScript code to elevate its own permissions.
What the attacker needed
Permission model enabled; ability to call crypto.setEngine(); a compatible OpenSSL engine
How it was found
- Enable the permission model.
- Call crypto.setEngine() with a compatible OpenSSL engine.
- 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.
The permission model is a Node.js feature meant to limit what running code can do. This report found that a function for loading OpenSSL engines could still load native code, which runs outside those limits. That native code could then turn off the permission model, letting the JavaScript do more than it should.
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.