{"id":"CVE-2026-102422","aliases":["CVE-2026-102422","GHSA-pqg4-j6r4-53mv"],"related":[],"kind":"vulnerability","state":"published","title":"shell-quote `quote()` command injection via a line terminator in a token after a `{ comment }` token","summary":"shell-quote's `quote()` function 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 (\\n, \\r, U+2028, U+2029) in that later string therefore ends the comment, and the rest of the string is parsed as shell input: `quote(['echo', 'ok', { comment: 'x' }, 'a\\nid;#'])` runs `id` in sh, bash, dash, ksh and zsh. `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. Fixed in 1.11.0: `quote()` throws a `TypeError` when a string after a `{ comment }` token contains a line terminator.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"shell-quote's `quote()` function 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 (\\n, \\r, U+2028, U+2029) in that later string therefore ends the comment, and the rest of the string is parsed as shell input: `quote(['echo', 'ok', { comment: 'x' }, 'a\\nid;#'])` runs `id` in sh, bash, dash, ksh and zsh. `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. Fixed in 1.11.0: `quote()` throws a `TypeError` when a string after a `{ comment }` token contains a line terminator.","source":"cvelist"},{"lang":"en","text":"### Impact\n\n`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:\n\n```js\nquote(['echo', 'ok', { comment: 'x' }, 'a\\nid;#']);\n// echo ok #x 'a\n// id;#'\n```\n\nPassed to `sh`, `bash`, `dash`, `ksh`, or `zsh`, this runs `id`.\n\n`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.\n\nExploitation requires an attacker-controlled string containing a line terminator that follows a `{ comment }` token in the same `quote()` call.\n\n### Patches\n\nFixed 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).\n\n### Workarounds\n\nDrop 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.","format":"markdown","source":"ghsa"}],"published":"2026-09-29T03:47:36.376Z","modified":"2026-10-06T13:45:06.393Z","severity":{"scorer":"harborist","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.2,"rating":"CRITICAL"},"severities":[{"scorer":"harborist","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"},{"scorer":"harborist","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.2,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"CRITICAL"}],"cwes":["CWE-78"],"affected":[{"ranges":[{"type":"semver","introduced":"1.8.4","fixed":"1.11.0","status":"affected"}],"product":"shell-quote","package":"shell-quote","repo":"https://github.com/ljharb/shell-quote","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"1.8.4","status":"affected","fixed":"1.11.0"}],"ecosystem":"npm","package":"shell-quote","purl":"pkg:npm/shell-quote","source":"ghsa"}],"references":[{"url":"https://github.com/ljharb/shell-quote/security/advisories/GHSA-pqg4-j6r4-53mv","tags":["vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ljharb/shell-quote/commit/6002b2ed90c6b83095eb272b6b0adaf3a172b0bc","tags":["patch","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/ljharb/shell-quote","tags":["package","product"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.npmjs.com/package/shell-quote","tags":["product"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-102422","tags":["advisory"],"sources":["ghsa"]}],"credits":["Eurico Nicacio (@euriconicacio)","Jordan Harband (@ljharb)"],"assigner":"harborist","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-09-30T15:18:10.710Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-102422","url":"https://www.cve.org/CVERecord?id=CVE-2026-102422","licence":"CVE Terms of Use","modified":"2026-09-30T15:18:32.135Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-pqg4-j6r4-53mv","url":"https://github.com/advisories/GHSA-pqg4-j6r4-53mv","licence":"CC-BY-4.0","modified":"2026-10-06T13:45:06.393Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-102422","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-102422","licence":"Public domain","modified":"2026-09-30T17:32:07.107Z"}],"updatedAt":"2026-11-25T22:59:41.416Z","epss":{"score":0.0048,"percentile":0.43022,"date":"2026-12-02T12:00:21.000Z"}}