CVE-2022-31180
JavaScript vulnerability analysis and mitigation

Overview

CVE-2022-31180 affects Shescape, a shell escape package for JavaScript, in versions >=1.4.0 and < 1.5.8. The vulnerability was discovered and disclosed in July 2022, involving insufficient escaping of whitespace characters when using the escape or escapeAll functions with the interpolation option set to true (GitHub Advisory).

Technical details

The vulnerability allows attackers to exploit shell-specific behavior through special characters inserted after whitespace or line terminating characters. The issue affects multiple shells including Bash, Dash, Zsh, and PowerShell. When using the escape or escapeAll functions with {interpolation: true}, the package fails to properly escape certain characters following whitespace, potentially allowing command injection (GitHub Advisory).

Impact

If an attacker can include whitespace in their input, they can: invoke shell-specific behavior through special characters inserted directly after whitespace in Bash, Dash, Zsh, and PowerShell; invoke shell-specific behavior through special characters inserted after line terminating characters in Bash; invoke arbitrary commands by inserting a line feed character in Bash, Dash, Zsh, and PowerShell; or invoke arbitrary commands by inserting a carriage return character in PowerShell (GitHub Advisory).

Mitigation and workarounds

The vulnerability was patched in two releases: v1.5.7 fixed the whitespace-related issues, and v1.5.8 addressed line feed and carriage return character escaping. As a workaround, users can avoid using the interpolation:true option or strip all whitespace from user input, though the latter approach is error-prone due to shell-specific whitespace definitions (GitHub Release, GitHub Release).

Additional resources


SourceThis report was generated using AI

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-22610HIGH8.5
  • JavaScriptJavaScript
  • angular.js
NoYesJan 10, 2026
CVE-2026-22595HIGH8.1
  • JavaScriptJavaScript
  • ghost
NoYesJan 10, 2026
CVE-2026-22594HIGH8.1
  • JavaScriptJavaScript
  • ghost
NoYesJan 10, 2026
CVE-2026-22596MEDIUM6.7
  • JavaScriptJavaScript
  • ghost
NoYesJan 10, 2026
CVE-2026-22597LOW2
  • JavaScriptJavaScript
  • ghost
NoYesJan 10, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management