CVE-2022-24725: CWE-200: Exposure of Sensitive Information to an Unauthorized Actor in ericcornelissen shescape
Shescape is a shell escape package for JavaScript. An issue in versions 1.4.0 to 1.5.1 allows for exposure of the home directory on Unix systems when using Bash with the `escape` or `escapeAll` functions from the _shescape_ API with the `interpolation` option set to `true`. Other tested shells, Dash and Zsh, are not affected. Depending on how the output of _shescape_ is used, directory traversal may be possible in the application using _shescape_. The issue was patched in version 1.5.1. As a workaround, manually escape all instances of the tilde character (`~`) using `arg.replace(/~/g, "\\~")`.
AI Analysis
Technical Summary
CVE-2022-24725 is a medium-severity vulnerability affecting the JavaScript package 'shescape' versions 1.4.0 up to but not including 1.5.1. Shescape is designed to safely escape shell commands in JavaScript environments. The vulnerability arises when using the 'escape' or 'escapeAll' functions with the 'interpolation' option enabled (set to true) specifically on Unix systems running the Bash shell. Under these conditions, the package may inadvertently expose the user's home directory path. This exposure occurs because the tilde character (~), which is a shell shorthand for the home directory, is not properly escaped, allowing the home directory path to be revealed in the output. Notably, this issue does not affect other shells such as Dash or Zsh. Furthermore, depending on how the output from shescape is utilized by the application, this exposure could lead to directory traversal attacks, potentially allowing unauthorized access to files outside the intended directory scope. The vulnerability was addressed and patched in version 1.5.1 of shescape. As a temporary mitigation, developers are advised to manually escape all tilde characters by replacing '~' with '\~' in their arguments before passing them to the shescape functions. There are no known exploits in the wild reported for this vulnerability, and the issue is classified under CWE-200, indicating exposure of sensitive information to unauthorized actors.
Potential Impact
For European organizations, the primary impact of this vulnerability is the unintended disclosure of sensitive directory information, specifically the home directory path of users on Unix systems running Bash. While this may seem limited, such information disclosure can facilitate further targeted attacks, including directory traversal and unauthorized file access, especially if the application processes shell commands with user input. Organizations relying on JavaScript applications that incorporate the shescape package in vulnerable versions may inadvertently expose internal directory structures, which could be leveraged by attackers to map the environment or escalate privileges. This is particularly concerning for sectors handling sensitive data such as finance, healthcare, and critical infrastructure, where even limited information disclosure can aid in more sophisticated attacks. However, since exploitation requires the use of Bash with specific function options and the vulnerability does not affect other shells, the scope is somewhat constrained. Additionally, no authentication or user interaction is explicitly required to trigger the exposure, increasing the risk if the vulnerable code is accessible to untrusted inputs or external users. The absence of known exploits in the wild suggests limited active targeting so far, but the risk remains for organizations that have not updated to patched versions or implemented mitigations.
Mitigation Recommendations
1. Upgrade to shescape version 1.5.1 or later immediately to apply the official patch resolving this vulnerability. 2. If upgrading is not immediately feasible, implement the recommended workaround by manually escaping all tilde characters in inputs passed to the 'escape' or 'escapeAll' functions with the interpolation option enabled, using the replacement arg.replace(/~/g, "\\~"). 3. Audit all codebases and dependencies to identify usage of shescape, particularly focusing on versions between 1.4.0 and 1.5.1, and verify whether the interpolation option is enabled in calls to escape functions. 4. Review application logic that consumes the output of shescape to ensure it does not allow directory traversal or unauthorized file access, employing strict input validation and output sanitization. 5. Limit exposure by restricting access to vulnerable application endpoints and monitoring logs for unusual access patterns or attempts to exploit directory traversal. 6. Employ runtime application self-protection (RASP) or web application firewalls (WAFs) with custom rules to detect and block suspicious shell command patterns or directory traversal attempts. 7. Educate development teams about secure handling of shell escapes and the risks of interpolation options in shell command construction.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Denmark
CVE-2022-24725: CWE-200: Exposure of Sensitive Information to an Unauthorized Actor in ericcornelissen shescape
Description
Shescape is a shell escape package for JavaScript. An issue in versions 1.4.0 to 1.5.1 allows for exposure of the home directory on Unix systems when using Bash with the `escape` or `escapeAll` functions from the _shescape_ API with the `interpolation` option set to `true`. Other tested shells, Dash and Zsh, are not affected. Depending on how the output of _shescape_ is used, directory traversal may be possible in the application using _shescape_. The issue was patched in version 1.5.1. As a workaround, manually escape all instances of the tilde character (`~`) using `arg.replace(/~/g, "\\~")`.
AI-Powered Analysis
Technical Analysis
CVE-2022-24725 is a medium-severity vulnerability affecting the JavaScript package 'shescape' versions 1.4.0 up to but not including 1.5.1. Shescape is designed to safely escape shell commands in JavaScript environments. The vulnerability arises when using the 'escape' or 'escapeAll' functions with the 'interpolation' option enabled (set to true) specifically on Unix systems running the Bash shell. Under these conditions, the package may inadvertently expose the user's home directory path. This exposure occurs because the tilde character (~), which is a shell shorthand for the home directory, is not properly escaped, allowing the home directory path to be revealed in the output. Notably, this issue does not affect other shells such as Dash or Zsh. Furthermore, depending on how the output from shescape is utilized by the application, this exposure could lead to directory traversal attacks, potentially allowing unauthorized access to files outside the intended directory scope. The vulnerability was addressed and patched in version 1.5.1 of shescape. As a temporary mitigation, developers are advised to manually escape all tilde characters by replacing '~' with '\~' in their arguments before passing them to the shescape functions. There are no known exploits in the wild reported for this vulnerability, and the issue is classified under CWE-200, indicating exposure of sensitive information to unauthorized actors.
Potential Impact
For European organizations, the primary impact of this vulnerability is the unintended disclosure of sensitive directory information, specifically the home directory path of users on Unix systems running Bash. While this may seem limited, such information disclosure can facilitate further targeted attacks, including directory traversal and unauthorized file access, especially if the application processes shell commands with user input. Organizations relying on JavaScript applications that incorporate the shescape package in vulnerable versions may inadvertently expose internal directory structures, which could be leveraged by attackers to map the environment or escalate privileges. This is particularly concerning for sectors handling sensitive data such as finance, healthcare, and critical infrastructure, where even limited information disclosure can aid in more sophisticated attacks. However, since exploitation requires the use of Bash with specific function options and the vulnerability does not affect other shells, the scope is somewhat constrained. Additionally, no authentication or user interaction is explicitly required to trigger the exposure, increasing the risk if the vulnerable code is accessible to untrusted inputs or external users. The absence of known exploits in the wild suggests limited active targeting so far, but the risk remains for organizations that have not updated to patched versions or implemented mitigations.
Mitigation Recommendations
1. Upgrade to shescape version 1.5.1 or later immediately to apply the official patch resolving this vulnerability. 2. If upgrading is not immediately feasible, implement the recommended workaround by manually escaping all tilde characters in inputs passed to the 'escape' or 'escapeAll' functions with the interpolation option enabled, using the replacement arg.replace(/~/g, "\\~"). 3. Audit all codebases and dependencies to identify usage of shescape, particularly focusing on versions between 1.4.0 and 1.5.1, and verify whether the interpolation option is enabled in calls to escape functions. 4. Review application logic that consumes the output of shescape to ensure it does not allow directory traversal or unauthorized file access, employing strict input validation and output sanitization. 5. Limit exposure by restricting access to vulnerable application endpoints and monitoring logs for unusual access patterns or attempts to exploit directory traversal. 6. Employ runtime application self-protection (RASP) or web application firewalls (WAFs) with custom rules to detect and block suspicious shell command patterns or directory traversal attempts. 7. Educate development teams about secure handling of shell escapes and the risks of interpolation options in shell command construction.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2022-02-10T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9848c4522896dcbf62de
Added to database: 5/21/2025, 9:09:28 AM
Last enriched: 6/22/2025, 2:51:42 AM
Last updated: 8/8/2025, 8:20:34 AM
Views: 13
Related Threats
CVE-2025-8874: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in litonice13 Master Addons – Elementor Addons with White Label, Free Widgets, Hover Effects, Conditions, & Animations
MediumCVE-2025-8767: CWE-1236 Improper Neutralization of Formula Elements in a CSV File in anwppro AnWP Football Leagues
MediumCVE-2025-8482: CWE-862 Missing Authorization in 10up Simple Local Avatars
MediumCVE-2025-8418: CWE-862 Missing Authorization in bplugins B Slider- Gutenberg Slider Block for WP
HighCVE-2025-47444: CWE-201 Insertion of Sensitive Information Into Sent Data in Liquid Web GiveWP
HighActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.