{"id":"CVE-2022-29256","aliases":["CVE-2022-29256","GHSA-gp95-ppv5-3jc5"],"related":[],"kind":"vulnerability","state":"published","title":"Possible vulnerability at 'npm install' time in sharp if an attacker has control over build environment","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"There's 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.\n\nThis 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. However, out of an abundance of caution, I've created this advisory.\n\nIf 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.\n\nI've used the Common Vulnerability Scoring System (CVSS) calculator to determine the maximum possible impact, which suggests a \"medium\" score of 5.9, but for most people the real impact will be dealing with the noise from automated security tooling that this advisory will bring.\n\n[`AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H/E:P/RL:O/RC:C/CR:X/IR:X/AR:X/MAV:X/MAC:X/MPR:X/MUI:R/MS:X/MC:X/MI:X/MA:X`](https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H/E:P/RL:O/RC:C/CR:X/IR:X/AR:X/MAV:X/MAC:X/MPR:X/MUI:R/MS:X/MC:X/MI:X/MA:X&version=3.1)\n\nThis problem was fixed in commit a6aeef6 and published as part of `sharp` v0.30.5.\n\nThank you very much to @dwisiswant0 for the responsible disclosure.\n\nRemember: if an attacker has control over environment variables in your build environment then you have a bigger problem to deal with than this issue.","format":"markdown","source":"ghsa"},{"lang":"es","text":"sharp es una aplicación para el procesamiento de imágenes en Node.js. En versiones anteriores a 0.30.5, se presenta una posible vulnerabilidad en la lógica que es ejecutada sólo en el momento de \"npm install\" cuando son instaladas versiones de \"sharp\" anteriores a la última v0.30.5. Si un atacante presenta la capacidad de establecer el valor de la variable de entorno \"PKG_CONFIG_PATH\" en un entorno de construcción, entonces podría ser capaz de usar esto para inyectar un comando arbitrario en el momento de \"npm install\". Esto no es parte de ningún código en tiempo de ejecución, no afecta a usuarios de Windows en absoluto, y es poco probable que afecte a cualquier persona que ya se preocupa por la seguridad de su entorno de construcción. Este problema ha sido corregido en versión 0.30.5","source":"nvd"}],"published":"2022-05-25T21:20:12.000Z","modified":"2026-06-17T04:39:55.977Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H","score":6.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H","score":6.7,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:L/Au:N/C:P/I:P/A:P","score":4.6,"rating":"MEDIUM"}],"cwes":["CWE-77","CWE-78"],"affected":[{"ranges":[{"version":"< 0.30.5","status":"affected"}],"vendor":"lovell","product":"sharp","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.30.5"}],"ecosystem":"npm","package":"sharp","purl":"pkg:npm/sharp","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.30.5"}],"vendor":"sharp_project","product":"sharp","cpe":"cpe:2.3:a:sharp_project:sharp:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/lovell/sharp/security/advisories/GHSA-gp95-ppv5-3jc5","tags":["patch","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/lovell/sharp/commit/a6aeef612be50f5868a77481848b1de674216f0c","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-29256","tags":["advisory"],"sources":["ghsa"]},{"url":"https://advisory.dw1.io/54","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/lovell/sharp","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2025-04-23T15:52:46.058Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-29256","url":"https://www.cve.org/CVERecord?id=CVE-2022-29256","licence":"CVE Terms of Use","modified":"2025-04-23T18:21:26.238Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-gp95-ppv5-3jc5","url":"https://github.com/advisories/GHSA-gp95-ppv5-3jc5","licence":"CC-BY-4.0","modified":"2023-11-08T04:09:12.597Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-29256","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-29256","licence":"Public domain","modified":"2026-06-17T04:39:55.977Z"}],"updatedAt":"2026-11-25T22:58:11.942Z","epss":{"score":0.00385,"percentile":0.3473,"date":"2026-12-01T12:00:22.000Z"}}