GHSA-pqg4-j6r4-53mv: OS Command Injection

Published Oct 6, 2026
·
Updated

Impact

quote() emits a { comment } token as # followed by its text, which comments out the rest of the shell line, including the opening quote of any later string token. A line terminator in that later string ends the comment, and the rest of the string is parsed as shell input:

js quote(['echo', 'ok', { comment: 'x' }, 'a\nid;#']); // echo ok #x 'a // id;#'

Passed to sh, bash, dash, ksh, or zsh, this runs id.

parse() emits a comment token for a # in the middle of a word (for example http://example.com/#frag), so callers that combine parse() output with another untrusted string, such as quote(parse(untrustedCommand).concat(untrustedArg)), are affected. The fix for CVE-2026-9277 rejected line terminators in the comment's own text, but not in the tokens after it.

Exploitation requires an attacker-controlled string containing a line terminator that follows a { comment } token in the same quote() call.

Patches

Fixed in v1.11.0: quote() throws a TypeError when a string after a { comment } token contains a line terminator (\n, \r, U+2028, or U+2029).

Workarounds

Drop every token after a { comment } token before calling quote(), or reject line terminators in untrusted strings. Separately, do not append other shell text after quote() output that contains a comment, since the comment swallows it.

Affected Software

1 affected componentFixes available
npm/shell-quote>=1.8.4<1.11.0
1.11.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/shell-quote to a version that resolves this vulnerability.

    Fixed in 1.11.0
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.11.0
  3. Compensating control

    Before calling quote(), drop every token after a { comment } token, or reject untrusted strings containing line terminators (\n, \r, U+2028, or U+2029). Do not append other shell text after quote() output that contains a comment.

Event History

Oct 6, 2026
Advisory Published
via GitHub·01:40 PM
Data Sourced
via GitHub·01:40 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What conditions are required for exploitation?

An attacker must be able to control a string containing a line terminator that appears after a { comment } token in the same quote() call. The resulting quoted command must then be passed to a shell such as sh, bash, dash, ksh, or zsh.

2

Are applications that use parse() also at risk?

They can be. parse() can emit a comment token when a # appears in the middle of a word, so code that combines parse() output with another untrusted string before calling quote() is affected.

3

What can be done if upgrading is not immediately possible?

Drop every token following a { comment } token before calling quote(). This prevents later attacker-controlled strings from escaping the shell comment through a line terminator.

4

What versions contain the fix?

The issue is fixed in version 1.11.0. In that version, quote() throws a TypeError if a string after a { comment } token contains \n, \r, U+2028, or U+2029.

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