CVE-2022-29256: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') in lovell sharp
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.
AI Analysis
Technical Summary
CVE-2022-29256 is a command injection vulnerability identified in the Node.js image processing library 'sharp' prior to version 0.30.5. The vulnerability arises during the installation phase of the package, specifically at 'npm install' time, rather than during runtime. The root cause is improper neutralization of special elements in the PKG_CONFIG_PATH environment variable, which is used in the build environment. If an attacker can control or manipulate the PKG_CONFIG_PATH environment variable during the build process, they may inject arbitrary commands that will be executed with the privileges of the user running the installation. This vulnerability is classified under CWE-77, indicating improper neutralization of special elements used in a command (command injection). It is important to note that this issue does not affect Windows users, as the vulnerability is related to build environments typically found on Unix-like systems. Additionally, the vulnerability only manifests if the attacker has the ability to influence the build environment variables, which generally requires prior access or control over the build system or continuous integration pipeline. The vulnerability has been addressed and fixed in sharp version 0.30.5. There are no known exploits in the wild, and the vulnerability is not part of runtime code, limiting its exposure to the build phase only.
Potential Impact
For European organizations, the impact of this vulnerability is primarily on the security of their software build and deployment pipelines that utilize the sharp library versions prior to 0.30.5. If an attacker can manipulate the build environment, they could execute arbitrary commands during package installation, potentially leading to unauthorized code execution, compromise of build servers, insertion of malicious code into software artifacts, or supply chain attacks. This could undermine the integrity and trustworthiness of software products and services. However, the impact is mitigated by the requirement that the attacker must have the ability to control environment variables during the build process, which is typically restricted to trusted personnel or systems. Organizations with poorly secured build environments or automated pipelines exposed to external inputs are at higher risk. Since the vulnerability does not affect runtime environments or Windows users, the scope of impact is limited to Unix-like build environments using vulnerable versions of sharp. The potential confidentiality, integrity, and availability impacts are moderate, as successful exploitation could lead to code execution and compromise of build infrastructure, but exploitation complexity is higher due to the prerequisite of environment control.
Mitigation Recommendations
1. Upgrade all instances of the sharp library to version 0.30.5 or later to ensure the vulnerability is patched. 2. Restrict and tightly control access to build environments and continuous integration systems to prevent unauthorized modification of environment variables such as PKG_CONFIG_PATH. 3. Implement environment variable sanitization and validation in build scripts to detect and reject suspicious or unexpected values. 4. Use containerized or isolated build environments with minimal privileges to limit the impact of any potential command injection. 5. Employ strict code signing and artifact verification processes to detect unauthorized changes in build outputs. 6. Regularly audit and monitor build logs and environment configurations for anomalies that could indicate attempted exploitation. 7. Educate development and DevOps teams about the risks of environment variable manipulation and secure build practices. 8. For organizations using Windows build environments, this vulnerability is not applicable, but maintaining updated dependencies remains best practice.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Denmark, Ireland, Belgium, Italy
CVE-2022-29256: CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') in lovell sharp
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.
AI-Powered Analysis
Technical Analysis
CVE-2022-29256 is a command injection vulnerability identified in the Node.js image processing library 'sharp' prior to version 0.30.5. The vulnerability arises during the installation phase of the package, specifically at 'npm install' time, rather than during runtime. The root cause is improper neutralization of special elements in the PKG_CONFIG_PATH environment variable, which is used in the build environment. If an attacker can control or manipulate the PKG_CONFIG_PATH environment variable during the build process, they may inject arbitrary commands that will be executed with the privileges of the user running the installation. This vulnerability is classified under CWE-77, indicating improper neutralization of special elements used in a command (command injection). It is important to note that this issue does not affect Windows users, as the vulnerability is related to build environments typically found on Unix-like systems. Additionally, the vulnerability only manifests if the attacker has the ability to influence the build environment variables, which generally requires prior access or control over the build system or continuous integration pipeline. The vulnerability has been addressed and fixed in sharp version 0.30.5. There are no known exploits in the wild, and the vulnerability is not part of runtime code, limiting its exposure to the build phase only.
Potential Impact
For European organizations, the impact of this vulnerability is primarily on the security of their software build and deployment pipelines that utilize the sharp library versions prior to 0.30.5. If an attacker can manipulate the build environment, they could execute arbitrary commands during package installation, potentially leading to unauthorized code execution, compromise of build servers, insertion of malicious code into software artifacts, or supply chain attacks. This could undermine the integrity and trustworthiness of software products and services. However, the impact is mitigated by the requirement that the attacker must have the ability to control environment variables during the build process, which is typically restricted to trusted personnel or systems. Organizations with poorly secured build environments or automated pipelines exposed to external inputs are at higher risk. Since the vulnerability does not affect runtime environments or Windows users, the scope of impact is limited to Unix-like build environments using vulnerable versions of sharp. The potential confidentiality, integrity, and availability impacts are moderate, as successful exploitation could lead to code execution and compromise of build infrastructure, but exploitation complexity is higher due to the prerequisite of environment control.
Mitigation Recommendations
1. Upgrade all instances of the sharp library to version 0.30.5 or later to ensure the vulnerability is patched. 2. Restrict and tightly control access to build environments and continuous integration systems to prevent unauthorized modification of environment variables such as PKG_CONFIG_PATH. 3. Implement environment variable sanitization and validation in build scripts to detect and reject suspicious or unexpected values. 4. Use containerized or isolated build environments with minimal privileges to limit the impact of any potential command injection. 5. Employ strict code signing and artifact verification processes to detect unauthorized changes in build outputs. 6. Regularly audit and monitor build logs and environment configurations for anomalies that could indicate attempted exploitation. 7. Educate development and DevOps teams about the risks of environment variable manipulation and secure build practices. 8. For organizations using Windows build environments, this vulnerability is not applicable, but maintaining updated dependencies remains best practice.
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-04-13T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9843c4522896dcbf309f
Added to database: 5/21/2025, 9:09:23 AM
Last enriched: 6/23/2025, 7:50:25 AM
Last updated: 8/17/2025, 12:09:04 AM
Views: 13
Related Threats
CVE-2025-8678: CWE-918 Server-Side Request Forgery (SSRF) in johnbillion WP Crontrol
MediumCVE-2025-57699: Unquoted search path or element in Western Digital Corporation Western Digital Kitfox for Windows
MediumCVE-2025-8281: CWE-79 Cross-Site Scripting (XSS) in WP Talroo
HighCVE-2025-41452: CWE-15: External Control of System or Configuration Setting in Danfoss AK-SM8xxA Series
MediumCVE-2025-41451: CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection') in Danfoss AK-SM8xxA Series
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.