Skip to content
Heist/ feed
Back to feed
Medium

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

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2022-29256
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 17:03 UTC · Revision 1

Source evidence

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

core-osv · Original source

Published 25 May 2022, 21:20 UTC

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.

osv:CVE-2022-29256
Complete source record
{
  "id": "025cf1e14a95ef6b43c118b5c6c746729b3535d12cfb4db8b6749de01f7c463f",
  "url": "https://osv.dev/vulnerability/CVE-2022-29256",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "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.",
    "evidence": "osv:CVE-2022-29256",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2022-29256",
      "aliases": [
        "CVE-2022-29256",
        "GHSA-gp95-ppv5-3jc5"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/lovell/sharp",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "db654de385e06ee6c56a05aa11a11a2e2f781b14"
                },
                {
                  "fixed": "a6aeef612be50f5868a77481848b1de674216f0c"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:sharp_project:sharp:*:*:*:*:*:node.js:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "0.30.5"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "a6aeef612be50f5868a77481848b1de674216f0c"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v0.30.4",
            "v0.30.3",
            "v0.30.2",
            "v0.30.1",
            "v0.30.0",
            "v0.29.3",
            "v0.29.2",
            "v0.29.1",
            "v0.29.0",
            "v0.28.3",
            "v0.28.2",
            "v0.28.1",
            "v0.28.0",
            "v0.28.0-beta1",
            "v0.28.0-alpha1",
            "v0.27.2",
            "v0.27.1",
            "v0.27.0",
            "v0.27.0-beta1",
            "v0.26.3",
            "v0.26.2",
            "v0.26.1",
            "v0.26.0",
            "v0.26.0-beta1",
            "v0.26.0-alpha2",
            "v0.26.0-alpha1",
            "v0.25.4",
            "v0.25.3",
            "v0.25.2",
            "v0.25.1",
            "v0.25.0",
            "v0.24.1",
            "v0.24.0",
            "v0.23.4",
            "v0.23.3",
            "v0.23.2",
            "v0.23.1",
            "v0.23.0",
            "v0.22.1",
            "v0.22.0",
            "v0.21.3",
            "v0.21.2",
            "v0.21.1",
            "v0.21.0",
            "v0.20.8",
            "v0.20.7",
            "v0.20.6",
            "v0.20.5",
            "v0.20.4",
            "v0.20.3",
            "v0.20.2",
            "v0.20.1",
            "v0.20.0",
            "v0.19.1",
            "v0.19.0",
            "v0.18.4",
            "v0.18.3",
            "v0.18.2",
            "v0.18.1",
            "v0.18.0",
            "v0.17.3",
            "v0.17.2",
            "v0.17.1",
            "v0.17.0",
            "v0.16.2",
            "v0.16.1",
            "v0.16.0",
            "v0.15.1",
            "v0.15.0",
            "v0.14.1",
            "v0.14.0",
            "v0.13.1",
            "v0.13.0",
            "v0.12.2",
            "v0.12.1",
            "v0.12.0",
            "v0.11.4",
            "v0.11.3",
            "v0.11.2",
            "v0.11.1",
            "v0.11.0",
            "v0.10.1",
            "v0.10.0",
            "v0.9.3",
            "v0.9.2",
            "v0.9.1",
            "v0.9.0",
            "v0.8.4",
            "v0.8.3",
            "v0.8.2",
            "v0.8.1",
            "v0.8.0",
            "v0.7.2",
            "v0.7.1",
            "v0.7.0",
            "v0.6.2",
            "v0.6.1",
            "v0.6.0",
            "v0.5.2",
            "v0.5.1",
            "v0.5.0",
            "v0.4.2",
            "v0.4.1",
            "v0.4.0",
            "v0.3.0",
            "v0.2.0",
            "v0.1.8",
            "v0.1.7",
            "v0.1.6",
            "v0.1.5",
            "v0.1.4",
            "v0.1.3",
            "v0.1.2",
            "v0.1.1",
            "v0.1.0",
            "v0.0.9",
            "v0.0.8",
            "v0.0.6",
            "v0.0.5",
            "v0.0.4",
            "v0.0.3",
            "v0.0.2",
            "v0.0.1"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-29256.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:38.004239124Z",
      "provider": "osv",
      "references": [
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/29xxx/CVE-2022-29256.json",
        "https://github.com/lovell/sharp/security/advisories/GHSA-gp95-ppv5-3jc5",
        "https://nvd.nist.gov/vuln/detail/CVE-2022-29256",
        "https://github.com/lovell/sharp/commit/a6aeef612be50f5868a77481848b1de674216f0c"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-77"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/29xxx/CVE-2022-29256.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2022-29256",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 505116,
  "published_at": "2022-05-25T21:20:12+00:00"
}