CVE-2022-24725 Exposure of home directory through shescape on Unix with Bash

Medium 6.2 Published Updated

Attackers can expose the home directory path on Unix systems using Bash when the interpolation option is enabled in the shescape library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2022-24725?

CVE-2022-24725 is a medium-severity vulnerability in ericcornelissen shescape, published on 3 Mar 2022. It can only be exploited from the same machine or local network, with no action from the victim.

Official 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, "\\~")`.

Weakness: CWE-78, CWE-200

Which versions are affected by CVE-2022-24725?

2 open source packages ship an affected version, including shescape. It affects 1 product.

PackageAffectedFixed in
shescape npmFrom 1.4.01.5.1
shescape npmFrom 1.4.01.5.1

Products include Shescape Project Shescape.

How do I fix CVE-2022-24725?

Upgrade shescape to 1.5.1 or later.

Is CVE-2022-24725 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-24725 exists.

Sources

Also known as GHSA-446w-rrm4-r47f.

Is CVE-2022-24725 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free