CVE-2026-57998: better-npm-audit OS Command Injection via registry flag

Published Aug 22, 2026
·
Updated

better-npm-audit through 3.11.0, and the 4.0.0-rc.2 prerelease, builds its npm audit command by interpolating the user-supplied --registry option into a command string in src/handlers/handleInput.ts without validation or quoting, then passes that string to childprocess.exec() in index.ts, which spawns a shell. A registry value containing shell metacharacters such as a semicolon, pipe, or command substitution executes arbitrary operating system commands with the privileges of the process running the audit.

Affected Software

1 affected component
npm/better-npm-audit>3.11.0<=4.0.0-rc.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade better-npm-audit to a version that resolves this vulnerability.

    Fixed in 4.0.0-rc.2
  2. Upgrade

    Upgrade better-npm-audit to a version that resolves this vulnerability.

    Fixed in 3.11.0
  3. Configuration

    Do not pass a --registry value that contains shell metacharacters such as semicolons (;), pipes (|), or command substitution characters; provide only a plain registry URL/domain with no shell metacharacters to avoid command injection through interpolation into an exec()-spawned shell.

    better-npm-audit CLI --registry option = validated/quoted (no shell metacharacters)
  4. Compensating control

    Ensure any wrapper or automation that runs better-npm-audit restricts/validates the user-supplied --registry parameter to an allowlist of expected registry domains/URLs before invoking better-npm-audit, so untrusted input cannot reach the exec()-based command string.

Event History

Aug 22, 2026
CVE Published
via MITRE·12:26 PM
Data Sourced
via MITRE·12:26 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·01:16 PM
DescriptionSeverityWeakness
Aug 20, 58611
Event
via NVD·01:46 AM

Frequently Asked Questions

1

Who is exposed to this issue?

Any environment running better-npm-audit through 3.11.0 or the 4.0.0-rc.2 prerelease is exposed when an attacker can influence the value passed to its --registry option. The injected command runs with the privileges of the process that runs the audit.

2

Does exploitation require an authenticated account or special permissions?

No special application privileges are described. Exploitation requires the attacker to cause a malicious --registry value to be used and requires user interaction according to the supplied CVSS vector.

3

What can be done if patching is not immediately possible?

Do not pass untrusted values to --registry. Restrict the option to validated registry URLs and prevent shell metacharacters, including semicolons, pipes, and command-substitution syntax, from reaching the command.

4

How can I determine whether a deployment is affected?

Check whether better-npm-audit is at version 3.11.0 or earlier, or is using the 4.0.0-rc.2 prerelease. Also review scripts, CI configuration, and user-controlled inputs that supply the --registry option.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203