CVE-2022-29256 Possible vulnerability at 'npm install' time in sharp if an attacker has control over build environment

Medium 6.5 Published Updated

An attacker controlling the build environment can inject arbitrary commands during npm install via PKG_CONFIG_PATH manipulation in sharp.

Exploited in the wild
Not known
Login needed
An administrator
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2022-29256?

CVE-2022-29256 is a medium-severity command injection vulnerability in lovell sharp, published on 25 May 2022. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

sharp is an application for Node.js image processing. Prior to version 0.30.5, there is a possible vulnerability in logic that is run only at `npm install` time when installing versions of `sharp` prior to the latest v0.30.5. If an attacker has the ability to set the value of the `PKG_CONFIG_PATH` environment variable in a build environment then they might be able to use this to inject an arbitrary command at `npm install` time. This is not part of any runtime code, does not affect Windows users at all, and is unlikely to affect anyone that already cares about the security of their build environment. This problem is fixed in version 0.30.5.

Weakness: CWE-78, CWE-77

Which versions are affected by CVE-2022-29256?

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

PackageAffectedFixed in
sharp npmAll versions0.30.5
sharp npmAll versions0.30.5

Products include Sharp Project Sharp.

How do I fix CVE-2022-29256?

Upgrade sharp to 0.30.5 or later.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2022-29256 being exploited?

There is no known exploitation of CVE-2022-29256 in the wild and no public exploit code.

Sources

Also known as CLSA-2026-1789549875, GHSA-gp95-ppv5-3jc5.

Is CVE-2022-29256 in your software?

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

Check your SBOMs for free