Quick answers
- Is CVE-2022-24725 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2022-24725 being exploited in the wild.
- How severe is CVE-2022-24725?
- Low severity, with a CVSS score of 3.1, published 3 March 2022.
- Which products and versions are affected?
- shescape (npm) SEMVER:introduced=1.4.0,fixed=1.5.1.
- Is there a fix for CVE-2022-24725?
- Yes. shescape (npm): upgrade to 1.5.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2022-24725 attacked?
- It is attacked with local access, in a software library.
- Am I affected by CVE-2022-24725?
- Check whether you run shescape (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- shescape (npm): upgrade to 1.5.1 or later
npm install shescape@1.5.1
Technical details
shescape's escape() and escapeAll() functions fail to properly escape tilde characters in Bash when the interpolation option is enabled. Bash treats tilde expansion specially: a tilde at the end of an argument (e.g., "=~") or in patterns like "xxx:~", "~:xxx", or "xxx:~:xxx" following an equals sign will expand to the user's home directory path. The vulnerability occurs because shescape does not escape tildes in these contexts when interpolation is active, allowing an attacker-controlled string containing these patterns to leak the home directory pathname. While Dash and Zsh shells are not affected, applications using shescape with Bash on Unix systems are vulnerable. The issue was fixed in version 1.5.1. Applications using vulnerable versions with untrusted input in shell commands can mitigate by manually escaping tildes using `arg.replace(/~/g, "\\~")`.
Affected products
- ericcornelissen shescape >=1.4.0, <1.5.1
Identifiers
- CVE-2022-24725
- GHSA-446w-rrm4-r47f
Timeline
- 2022-03-03: disclosed
- 2022-03-03: patched: Fixed in version 1.5.1