{"id":"CVE-2022-31180","state":"PUBLISHED","title":"Insufficient escaping of whitespace in shescape","description":"Shescape is a simple shell escape package for JavaScript. Affected versions were found to have insufficient escaping of white space when interpolating output. This issue only impacts users that use the `escape` or `escapeAll` functions with the `interpolation` option set to `true`. The result is that if an attacker is able to include whitespace in their input they can: 1. Invoke shell-specific behaviour through shell-specific special characters inserted directly after whitespace. 2. Invoke shell-specific behaviour through shell-specific special characters inserted or appearing after line terminating characters. 3. Invoke arbitrary commands by inserting a line feed character. 4. Invoke arbitrary commands by inserting a carriage return character. Behaviour number 1 has been patched in [v1.5.7] which you can upgrade to now. No further changes are required. Behaviour number 2, 3, and 4 have been patched in [v1.5.8] which you can upgrade to now. No further changes are required. The best workaround is to avoid having to use the `interpolation: true` option - in most cases using an alternative is possible, see [the recipes](https://github.com/ericcornelissen/shescape#recipes) for recommendations. Alternatively, users may strip all whitespace from user input. Note that this is error prone, for example: for PowerShell this requires stripping `'\\u0085'` which is not included in JavaScript's definition of `\\s` for Regular Expressions.","publishedAt":"2022-08-01T19:15:16.000Z","updatedAt":"2025-04-22T17:46:22.040Z","severity":{"score":9.8,"label":"Critical","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"GitHub_M"},"assigner":"GitHub_M","products":["ericcornelissen shescape"],"affected":[{"vendor":"ericcornelissen","product":"shescape","versions":[{"version":">=1.4.0 < 1.5.8","status":"affected"}]}],"references":["https://github.com/ericcornelissen/shescape/security/advisories/GHSA-44vr-rwwj-p88h","https://github.com/ericcornelissen/shescape/pull/322","https://github.com/ericcornelissen/shescape/pull/324","https://github.com/ericcornelissen/shescape/releases/tag/v1.5.7","https://github.com/ericcornelissen/shescape/releases/tag/v1.5.8"],"weaknesses":["CWE-74"],"ingestedAt":"2026-10-29T19:50:06.617Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2022/31xxx/CVE-2022-31180.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.1","cveMetadata":{"cveId":"CVE-2022-31180","state":"PUBLISHED","datePublished":"2022-08-01T19:15:16.000Z","dateUpdated":"2025-04-22T17:46:22.040Z","assignerShortName":"GitHub_M","assignerOrgId":"a0819718-46f1-4df5-94e2-005712e83aaa","dateReserved":"2022-05-18T00:00:00.000Z"},"containers":{"cna":{"title":"Insufficient escaping of whitespace in shescape","descriptions":[{"lang":"en","value":"Shescape is a simple shell escape package for JavaScript. Affected versions were found to have insufficient escaping of white space when interpolating output. This issue only impacts users that use the `escape` or `escapeAll` functions with the `interpolation` option set to `true`. The result is that if an attacker is able to include whitespace in their input they can: 1. Invoke shell-specific behaviour through shell-specific special characters inserted directly after whitespace. 2. Invoke shell-specific behaviour through shell-specific special characters inserted or appearing after line terminating characters. 3. Invoke arbitrary commands by inserting a line feed character. 4. Invoke arbitrary commands by inserting a carriage return character. Behaviour number 1 has been patched in [v1.5.7] which you can upgrade to now. No further changes are required. Behaviour number 2, 3, and 4 have been patched in [v1.5.8] which you can upgrade to now. No further changes are required. The best workaround is to avoid having to use the `interpolation: true` option - in most cases using an alternative is possible, see [the recipes](https://github.com/ericcornelissen/shescape#recipes) for recommendations. Alternatively, users may strip all whitespace from user input. Note that this is error prone, for example: for PowerShell this requires stripping `'\\u0085'` which is not included in JavaScript's definition of `\\s` for Regular Expressions."}],"affected":[{"vendor":"ericcornelissen","product":"shescape","versions":[{"version":">=1.4.0 < 1.5.8","status":"affected"}]}],"references":[{"url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-44vr-rwwj-p88h","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/ericcornelissen/shescape/pull/322","tags":["x_refsource_MISC"]},{"url":"https://github.com/ericcornelissen/shescape/pull/324","tags":["x_refsource_MISC"]},{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.7","tags":["x_refsource_MISC"]},{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.8","tags":["x_refsource_MISC"]}],"metrics":[{"cvssV3_1":{"attackComplexity":"LOW","attackVector":"NETWORK","availabilityImpact":"HIGH","baseScore":9.8,"baseSeverity":"CRITICAL","confidentialityImpact":"HIGH","integrityImpact":"HIGH","privilegesRequired":"NONE","scope":"UNCHANGED","userInteraction":"NONE","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","version":"3.1"}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-74","description":"CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')","lang":"en","type":"CWE"}]}],"providerMetadata":{"shortName":"GitHub_M","dateUpdated":"2022-08-01T19:15:16.000Z","orgId":"a0819718-46f1-4df5-94e2-005712e83aaa"},"source":{"advisory":"GHSA-44vr-rwwj-p88h","discovery":"UNKNOWN"},"x_legacyV4Record":{"CVE_data_meta":{"ASSIGNER":"security-advisories@github.com","ID":"CVE-2022-31180","STATE":"PUBLIC","TITLE":"Insufficient escaping of whitespace in shescape"},"affects":{"vendor":{"vendor_data":[{"product":{"product_data":[{"product_name":"shescape","version":{"version_data":[{"version_value":">=1.4.0 < 1.5.8"}]}}]},"vendor_name":"ericcornelissen"}]}},"data_format":"MITRE","data_type":"CVE","data_version":"4.0","description":{"description_data":[{"lang":"eng","value":"Shescape is a simple shell escape package for JavaScript. Affected versions were found to have insufficient escaping of white space when interpolating output. This issue only impacts users that use the `escape` or `escapeAll` functions with the `interpolation` option set to `true`. The result is that if an attacker is able to include whitespace in their input they can: 1. Invoke shell-specific behaviour through shell-specific special characters inserted directly after whitespace. 2. Invoke shell-specific behaviour through shell-specific special characters inserted or appearing after line terminating characters. 3. Invoke arbitrary commands by inserting a line feed character. 4. Invoke arbitrary commands by inserting a carriage return character. Behaviour number 1 has been patched in [v1.5.7] which you can upgrade to now. No further changes are required. Behaviour number 2, 3, and 4 have been patched in [v1.5.8] which you can upgrade to now. No further changes are required. The best workaround is to avoid having to use the `interpolation: true` option - in most cases using an alternative is possible, see [the recipes](https://github.com/ericcornelissen/shescape#recipes) for recommendations. Alternatively, users may strip all whitespace from user input. Note that this is error prone, for example: for PowerShell this requires stripping `'\\u0085'` which is not included in JavaScript's definition of `\\s` for Regular Expressions."}]},"impact":{"cvss":{"attackComplexity":"LOW","attackVector":"NETWORK","availabilityImpact":"HIGH","baseScore":9.8,"baseSeverity":"CRITICAL","confidentialityImpact":"HIGH","integrityImpact":"HIGH","privilegesRequired":"NONE","scope":"UNCHANGED","userInteraction":"NONE","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","version":"3.1"}},"problemtype":{"problemtype_data":[{"description":[{"lang":"eng","value":"CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')"}]}]},"references":{"reference_data":[{"name":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-44vr-rwwj-p88h","refsource":"CONFIRM","url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-44vr-rwwj-p88h"},{"name":"https://github.com/ericcornelissen/shescape/pull/322","refsource":"MISC","url":"https://github.com/ericcornelissen/shescape/pull/322"},{"name":"https://github.com/ericcornelissen/shescape/pull/324","refsource":"MISC","url":"https://github.com/ericcornelissen/shescape/pull/324"},{"name":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.7","refsource":"MISC","url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.7"},{"name":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.8","refsource":"MISC","url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.8"}]},"source":{"advisory":"GHSA-44vr-rwwj-p88h","discovery":"UNKNOWN"}}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://github.com/ericcornelissen/shescape/security/advisories/GHSA-44vr-rwwj-p88h","tags":["x_refsource_CONFIRM","x_transferred"]},{"url":"https://github.com/ericcornelissen/shescape/pull/322","tags":["x_refsource_MISC","x_transferred"]},{"url":"https://github.com/ericcornelissen/shescape/pull/324","tags":["x_refsource_MISC","x_transferred"]},{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.7","tags":["x_refsource_MISC","x_transferred"]},{"url":"https://github.com/ericcornelissen/shescape/releases/tag/v1.5.8","tags":["x_refsource_MISC","x_transferred"]}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2024-08-03T07:11:39.625Z"}},{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2025-04-22T15:37:14.335356Z","id":"CVE-2022-31180","options":[{"Exploitation":"poc"},{"Automatable":"yes"},{"Technical Impact":"total"}],"role":"CISA Coordinator","version":"2.0.3"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2025-04-22T17:46:22.040Z"}}]}}}