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

Policy-restricted modules can escalate to higher privileges by impersonating other modules in a policy list using module.constructor.createRequire()

The experimental policy mechanism in Node.js could be bypassed using module.constructor.createRequire() to load modules outside the policy.json definition.

haxatron1 Follow

Originally disclosed on HackerOne

Medium 6.7 View original
  • Triaged in 7 days
  • Fixed in 41 days
  • Disclosed after 42 days

Summary by the program

The use of module.constructor.createRequire() can bypass the policy mechanism and require modules outside of the policy.json definition for a given module.

This vulnerability affects all users using the experimental policy mechanism in all active release lines: 16.x, 18.x and, 20.x.

Please note that at the time this CVE was issued, the policy is an experimental feature of Node.js.

The original report as published on HackerOne, by haxatron1. 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 policy check did not account for modules created through module.constructor.createRequire(), so the resulting require function was not subject to the same policy restrictions.

What the attacker needed

Policy mechanism enabled; ability to run code in a restricted module

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 a policy that is meant to limit which modules a piece of code is allowed to load. This report says that a particular built-in function could be used to get around that limit and load other modules anyway. That matters because the policy is supposed to stop code from gaining more power than it should have.

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 haxatron1

View all

30 more disclosed reports, best first.

More from Node.js

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.