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

Permissions policies can be bypassed via Module._load and require.extensions (High) (CVE-2023-30587)

The experimental permissions policy mechanism in Node.js could be bypassed using Module._load() and require.extensions, allowing modules outside the policy.json definition to be loaded. An attacker could bypass restrictions on built-in modules such as child_process, potentially leading to remote code execution.

Matt Austin Follow

Originally disclosed on HackerOne

Bounty$1,165 High 7.7 View original
  • Triaged in 2 days
  • Fixed in 31 days
  • Paid in 31 days
  • Disclosed after 2 months

Summary by the program

Permissions policies can be bypassed via Module._load (HIGH)(CVE-2023-32002) The use of Module._load() can bypass the policy mechanism and require modules outside of the policy.json definition for a given module.

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

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

Thank you, to mattaustin for reporting this vulnerability and thank you Rafael Gonzaga and Bradley Farias for fixing it.

Full Security Advisory: https://nodejs.org/en/blog/vulnerability/august-2023-security-releases

The report

https://hackerone.com/reports/1960870

The use of Module._load() and require.extensions[".js"] 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.

Impact

Permission policies limit a project to a specific set of authorized node js built-in modules. For example a project could attempt to limit the use of child_process which could be bypassed leading to remote code execution.

The original report as published on HackerOne, by mattaustin. 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 enforcement did not cover the internal Module._load() function and the require.extensions hook, so these could be used to load modules that the policy intended to block.

Impact

An attacker could bypass restrictions on built-in modules such as child_process, potentially leading to remote code execution, though the policy mechanism is experimental and only affects users who enable it.

What the attacker needed

Node.js 16.x, 18.x, or 20.x; Experimental policy mechanism enabled

The fix

It was fixed according to the security advisory, though the text does not describe the fix details.

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 that lets you restrict which built-in modules a program can use, like a list of allowed tools. This report shows that a programmer could get around that list by using a special internal function, so they could load modules that were supposed to be blocked. If one of those blocked modules lets you run system commands, that could lead to running arbitrary code.

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 Matt Austin

View all

7 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.