CVE-2022-31179: Shescape prior to 1.5.8 vulnerable to insufficient escaping of line feeds for CMD
8.1
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.35309%
CWE
Published
7/15/2022
Updated
4/6/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
shescape | npm | < 1.5.8 | 1.5.8 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from insufficient escaping of line feeds in cmd.exe
arguments. The commit diff shows escapeArgCmd
in src/win.js
was modified to add .replace(/\n|\r/g, " ")
, indicating this was the missing defense. The CVE specifically impacts cmd.exe
usage, and the patch explicitly addresses this function
. Other functions (escape/quote
APIs) are entry points but delegate to escapeArgCmd
when using cmd.exe
.