CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-9277

CVE-2026-9277: OS Command Injection in shell-quote via Object-Token Line Terminator Parsing Defect

Alon Barad
Alon Barad
Software Engineer

Jun 9, 2026·6 min read·86 visits

Executive Summary (TL;DR)

An OS command injection vulnerability in shell-quote < 1.8.4 allows arbitrary command execution. The quote() function fails to escape line terminators within object-tokens due to a regular expression omission, enabling attackers to inject newlines that act as command separators in POSIX shells.

A technical breakdown of the OS command injection vulnerability in the shell-quote NPM package (CVE-2026-9277 / GHSA-w7jw-789q-3m8p). The bug resides in the character-by-character backslash-escaping logic applied to the .op field of object-tokens within the quote() function, which fails to match and escape line terminators due to a regex matching oversight in JavaScript. This allows unauthenticated remote attackers to execute arbitrary shell commands if they can control inputs processed by this library.

Vulnerability Overview

The NPM package shell-quote is designed to provide utility functions for parsing and quoting shell commands in Node.js environments. Its core functionality allows developers to safely serialize arrays of parameters into sanitized shell commands or parse complex terminal input strings into structured representation arrays. Because the library is frequently utilized prior to invoking shell executors such as child_process.exec or child_process.spawn, any failure to securely escape metacharacters can lead to command execution vulnerabilities.

CVE-2026-9277 (tracked as GHSA-w7jw-789q-3m8p) represents a critical command injection flaw identified within the quote() function. When serializing an array containing object-tokens (representing operators, globs, or comments), the library attempts to dynamically escape special characters. However, a regular expression matching defect allows line terminators to pass through unescaped.

The vulnerability exposes a broad attack surface in applications that pass structured or partially structured inputs to the command formatter. If an attacker can manipulate elements within the array passed to quote(), or inject values parsed during environment variable expansion in parse(), they can achieve arbitrary command execution under the context of the running application process.

Root Cause Analysis

The technical root cause of CVE-2026-9277 lies in the character-by-character backslash-escaping logic applied to the .op property of object-tokens. Within the quote() function, the library iterates over input array elements. If an element is identified as an object containing an .op field, the library attempts to escape each character of the operator string using the JavaScript regular expression arg.op.replace(/(.)/g, '\\$1').

In ECMAScript engines, the dot (.) character class matches any single character except line terminators. Because the dot-all (/s) modifier is absent in this pattern, the regular expression ignores the Carriage Return (\r, U+000D), Line Feed (\n, U+000A), Line Separator (U+2028), and Paragraph Separator (U+2029). As a result, the replacement expression \\$1 is never executed for these line terminators.

When the serialized output is constructed, these line terminators are written into the final string with zero escaping or sanitization. In POSIX-compliant shells (such as sh, bash, dash, or zsh), a literal newline is treated as an implicit command separator. When the shell interpreter parses the final string, it executes the commands sequentially, completely separating the original command context from the injected suffix commands.

Code Analysis

The vulnerable code block inside quote() processes the token's operator as shown below:

// Vulnerable logic in shell-quote <= 1.8.3
if (arg && typeof arg === 'object') {
    if (arg.op === 'glob') {
        return arg.pattern;
    }
    // Character-by-character escape attempts using dot class
    // This regex does not match line terminators (\n, \r)
    return arg.op.replace(/(.)/g, '\\$1');
}

An analysis of the fix implemented in commit 1518179 shows that the maintainers chose to eliminate the dynamic character-by-character escaping strategy entirely. Instead, they transitioned to strict schema and type validation for all object-tokens.

// Patched logic in shell-quote 1.8.4
// Rather than trying to escape free-form operators, shape validation is applied
if (arg && typeof arg === 'object') {
    if (arg.op === 'glob') {
        if (typeof arg.pattern !== 'string' || /[\r\n]/.test(arg.pattern)) {
            throw new TypeError('glob pattern must be a string and cannot contain line terminators');
        }
        return arg.pattern;
    }
    if (typeof arg.op === 'string' && controlOperators.indexOf(arg.op) !== -1) {
        return arg.op;
    }
    throw new TypeError('Invalid operator: ' + arg.op);
}

The patch evaluates the object properties against structural limits. If an object is configured as a glob, the program checks for line terminators. If the object-token uses an operator, it must match one of the items inside controlOperators array (e.g. &&, ||, ;). Any input that deviates from this strict configuration raises a TypeError and halts the process.

Exploitation Methodology

Exploitation requires that an application exposes either the inputs of quote() or the custom environment variable expansion callback of parse() to attacker-controlled data. In a direct object injection scenario, the target application accepts JSON payloads and passes them to quote() without validation.

The diagram below models the sequence of execution leading to arbitrary command execution.

In secondary attack vectors, the application leverages parse(cmd, envFn). The envFn is a developer-supplied callback designed to resolve shell variables. If the callback resolves a variable to an object-token whose operator is sourced from external input, an injection occurs. For instance, if an HTTP header determines the value returned by envFn as { op: "&&\nid" }, the returned token is subsequently passed back to quote(), which fails to escape the newline.

POSIX shell engines interpret the unescaped newline as a command separator. While other characters within the payload such as i and d are escaped as \i\d, the shell strips these redundant backslashes, yielding the executable instruction id.

Impact Assessment

The impact of CVE-2026-9277 is categorized as high, with an assigned CVSS v3.1 base score of 8.1. An exploit allows an unauthenticated remote attacker to execute arbitrary OS commands within the context of the underlying Node.js application process. This can lead to complete compromise of the host system, horizontal privilege escalation, and lateral movement within the network.

Because the injected shell command executes with the permissions of the Node.js process, applications running as a high-privilege user or root are highly vulnerable. Attackers can leverage this access to extract environmental variables, read application source code, download malicious binaries, or establish persistent reverse shell connections.

The risk remains elevated for cloud-native configurations where environment variables often store database credentials, API keys, and cloud provider IAM metadata tokens. The lack of complex prerequisites other than exposing input serialization vectors makes applications processing multi-tenant structured configuration particularly susceptible.

Remediation and Defense

The primary remediation is upgrading the shell-quote package dependency to version 1.8.4 or later. This can be accomplished by updating the dependency declaration within the project's package.json file and executing a package manager update cycle.

npm install shell-quote@1.8.4

In environments where immediate dependency upgrades are blocked by legacy system constraints, teams must deploy input validation layers. Applications should enforce schema validation on all inputs parsed by, or passed to, the library. Ensuring that any array processed by quote() contains strictly string elements, or validating that any object-token lacks line terminators, effectively mitigates the vulnerability vector.

Additionally, developers should analyze any implementation of custom environment callbacks in parse(). Ensuring that the envFn only returns sanitized string values and never passes raw, unvalidated object-tokens prevents nested serialization exploitation paths.

Technical Appendix

CVSS Score
8.1/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
0.07%
Top 79% most exploited

Affected Systems

Node.js applications running shell-quote < 1.8.4

Affected Versions Detail

Product
Affected Versions
Fixed Version
shell-quote
ljharb
>= 1.1.0, < 1.8.41.8.4
AttributeDetail
CWE IDCWE-78 / CWE-77
Attack VectorNetwork (AV:N)
CVSS Severity8.1 (High)
EPSS Score0.00068
Exploit StatusProof of Concept
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1059Command and Scripting Interpreter
Execution
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The software constructs an OS command using externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.

Known Exploits & Detection

Research AdvisoryConceptual proof of concept detailing object token command injection using custom op payloads

Vulnerability Timeline

Official advisory published on GitHub Security Advisory Database (GHSA-w7jw-789q-3m8p).
2026-05-22
CVE-2026-9277 assigned and published to CVE.org.
2026-05-22
CVE-2026-9277 indexed in the National Vulnerability Database (NVD).
2026-05-22
Public disclosure and technical discussion published on the oss-security mailing list.
2026-05-23
CVE-2026-9277 analysis and update records finalized on NVD.
2026-05-23

References & Sources

  • [1]https://github.com/advisories/GHSA-w7jw-789q-3m8p
  • [2]https://github.com/ljharb/shell-quote/security/advisories/GHSA-w7jw-789q-3m8p
  • [3]http://www.openwall.com/lists/oss-security/2026/05/23/2
  • [4]https://github.com/ljharb/shell-quote
  • [5]https://www.npmjs.com/package/shell-quote

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 8 hours ago•CVE-2026-54068
5.9

CVE-2026-54068: Unauthenticated Server-Side Template Injection and SQLite Exfiltration in SiYuan PKM

An authentication bypass in the SiYuan personal knowledge management system before version 3.7.0 exposes a dynamic icon rendering endpoint. This endpoint processes client-supplied Go template directives. By submitting a crafted request, an unauthenticated remote attacker can leverage registered database template functions to execute arbitrary read-only SQL queries and exfiltrate workspace contents.

Amit Schendel
Amit Schendel
5 views•5 min read
•about 9 hours ago•CVE-2026-54069
9.1

CVE-2026-54069: Authentication Bypass in SiYuan Note via Origin Header Spoofing

CVE-2026-54069 is a critical authentication bypass vulnerability in the SiYuan Note personal knowledge management system. The flaw is located in the HTTP server's middleware handling API authorization, which unconditionally trusts requests carrying a 'chrome-extension://' scheme in the Origin HTTP header, granting administrative access without validating API tokens.

Alon Barad
Alon Barad
4 views•5 min read
•about 9 hours ago•CVE-2026-54089
9.1

CVE-2026-54089: Authentication Bypass by Spoofing in File Browser

CVE-2026-54089 is a critical authentication bypass vulnerability in File Browser affecting instances configured with proxy-based authentication. An unauthenticated remote attacker with direct network access can impersonate arbitrary users or register new accounts by spoofing configured HTTP headers.

Amit Schendel
Amit Schendel
4 views•7 min read
•about 10 hours ago•GHSA-99J7-FHR2-XFJ4
10.0

GHSA-99J7-FHR2-XFJ4: Malicious Remote Code Execution Payload in 'exploration' Cargo Crate

The malicious Cargo package 'exploration' was uploaded to the crates.io registry. During compilation or package import, the crate executes code designed to establish an outbound TCP/HTTP connection, download an external second-stage binary, and execute the binary locally on the host machine. This creates an unauthenticated remote code execution vector impacting developer environments and continuous integration pipelines.

Amit Schendel
Amit Schendel
7 views•6 min read
•about 10 hours ago•CVE-2026-54088
9.3

CVE-2026-54088: Pre-Authentication Remote Code Execution in File Browser Hook Authentication

CVE-2026-54088 is a critical command injection vulnerability in File Browser prior to version 2.63.6. When Hook Authentication is enabled, the application interpolates unsanitized credentials into a shell command, allowing unauthenticated remote code execution.

Alon Barad
Alon Barad
6 views•6 min read
•about 11 hours ago•GHSA-QV4M-M73M-8HJ7
8.8

GHSA-qv4m-m73m-8hj7: Authenticated Arbitrary File Upload leading to Remote Code Execution in NotrinosERP

An authenticated remote code execution vulnerability exists in NotrinosERP (versions up to and including 1.0.0) within the Human Resource Management (HRM) module. Users with employee management permissions can upload arbitrary file types, including PHP scripts, which are written directly to a web-accessible directory. This allows for arbitrary code execution in the context of the web-server user.

Alon Barad
Alon Barad
5 views•6 min read