CCyberwiki

Vulnerable dependencies

Vulnerable dependencies
ClassSoftware supply chain
Also known asUsing components with known vulnerabilities; vulnerable and outdated components
CWECWE-1395: Dependency on Vulnerable Third-Party Component
OWASP Top 10A03:2025 Software Supply Chain Failures
Typical severitySet by each published vulnerability; npm audit grades findings as low, moderate, high or critical
AffectsPackages installed from npm, PyPI and other registries, on the server and in the browser, including packages pulled in by other packages

Vulnerable dependencies are third-party packages that an application installs in a version with a publicly known vulnerability. The application takes on the flaw with the package: it now depends on a component "that contains one or more known vulnerabilities".1

Description

Each dependency an application installs can declare dependencies of its own, which the package manager installs as well. Both levels count: an application is exposed when its owners do not track the versions of every component, client side and server side, "including nested (transitive) dependencies".2 The OWASP Top 10 first listed the problem in 2013, as item A9 under the title Using Components with Known Vulnerabilities. In the 2025 edition it is part of A03, Software Supply Chain Failures, which half of the respondents to the community survey ranked first.2

A vulnerable version reaches a product in one of two ways. A developer picks a version known to be flawed for compatibility or stability, or a flaw turns up later in a version already installed, which is expected to happen to every component over time.1

Each published flaw gets an advisory that states which versions of the package are affected, and scanners such as pip-audit also report the versions that fix it. Advisories carry identifiers such as a CVE number, a GitHub advisory number (GHSA) or a PyPA number (PYSEC), and one flaw can carry all three.3 The databases to watch are CVE, the National Vulnerability Database and Open Source Vulnerabilities (OSV).2

Mechanism

npm packages use semantic versioning: a patch release fixes bugs, a minor release adds features without breaking existing code, and a major release may break it. In package.json, the range ^1.0.4 accepts any later minor or patch release of version 1.4 The lockfile, package-lock.json, then records the exact version, download address and checksum of every package in the tree, so that later installs reproduce the same tree. npm intends the file to be committed to the repository.5

A vulnerable version therefore stays in the application until someone changes the lockfile. A flaw can also spread up the tree. Say package foo is vulnerable in versions >=1.0.2 <2.0.0, and package bar requires foo@^1.1.0. Every allowed version of foo falls inside the vulnerable range, so bar cannot be installed without the flaw; npm calls bar a meta-vulnerability.6

Impact

A package runs with the same privileges as the application that loads it.2 How bad a given flaw is depends on its nature, on whether attackers can reach the vulnerable code through the way the application uses the package, and on how much the application relies on that package.1 CVE-2021-44228 ("Log4Shell"), in the Log4j logging library for Java, was already being exploited to run code remotely when it was announced, and estimates put the number of affected devices at around 3 billion.1

Notable incidents

On 7 September 2017 the credit reporting agency Equifax announced a breach affecting 143 million consumers, and on 13 September it confirmed that the vulnerability exploited was CVE-2017-5638 in Apache Struts, an open source framework for Java web applications. The Apache Software Foundation stated that the flaw had been patched on 7 March 2017, the day it was announced, and attributed the breach to Equifax's failure to install the update in time.7

Detection

Dependency scanners compare the list of installed packages and versions with advisory databases, a method called software composition analysis. npm audit sends the name and version of every package in the tree to the registry and receives the matching advisories. It reads the lockfile by default; without one, npm rebuilds the tree on each run and the results can change from run to run.6 For Python, pip-audit -r requirements.txt checks a requirements file against the PyPA advisory database or OSV and lists each vulnerable package with its fixed versions.3 On GitHub, Dependabot alerts report vulnerable packages found in a repository's dependency graph.8 Dependency-Track, Dependency-Check and retire.js do the same job; retire.js looks for known vulnerable JavaScript libraries.2

An advisory can be wrong, or may not apply to the way a given application uses the package. pip-audit reads the dependency tree, not the code, and does not detect malicious packages.3 The EPSS score estimates how likely a vulnerability is to be exploited, and the KEV catalog lists vulnerabilities already used in real attacks.

Prevention

Commit the lockfile, run an audit on each build and upgrade the packages it reports. In npm:

npm audit                          # list advisories
npm audit fix --dry-run --json     # preview the changes
npm audit fix                      # upgrade within the allowed ranges
npm audit --audit-level=high       # in CI: fail on high or critical

npm audit fix moves vulnerable packages to versions without an advisory when the ranges in package.json allow it. When a fix needs a new major version, it requires --force, which can break code that relies on the old version, and some findings cannot be fixed automatically.6 In Python, pip-audit --fix upgrades the vulnerable packages.3

On GitHub, Dependabot alerts are turned on under Settings, Advanced Security, Dependabot alerts.9 With Dependabot security updates also on, GitHub opens a pull request that raises each vulnerable package to the lowest version containing the fix. For a transitive npm package, the pull request may upgrade the parent package instead.8

A dependency the code no longer uses is one less to patch, and an SBOM records every component that remains. Patching once a month or once a quarter leaves days or months of avoidable exposure. When a package is unmaintained and has no fix, the fallback is another package, and after that a virtual patch that watches for or blocks attacks on the flaw.2

Prompt for a coding agent

Run the dependency audit for this project (npm audit for Node.js, pip-audit -r requirements.txt for Python). For each vulnerable package, upgrade to the lowest version that fixes it, preferring updates within the current major version. Make sure the lockfile is committed and updated. If a fix needs a new major version, read that package's changelog, update the code that calls it and run the tests. Remove dependencies the code no longer imports. List each package you changed, from which version to which, and any vulnerability you could not fix and why.

In SecFlash

SecFlash reports a package with a published vulnerability as SF-SEC-701 on the Security page, and as SF-SEC-712 when the vulnerability is in CISA's KEV catalog. Outdated JavaScript libraries with published vulnerabilities appear as SF-SEC-403 and SF-SEC-404, and a vulnerable library copied into the repository as a file appears as SF-SEC-780. When a new advisory names a package version an app uses, the Threats page shows SF-THR-101, or SF-THR-102 for a library loaded in the browser. The Cloud page reports Dependabot alerts turned off as SF-CLD-602, Dependabot security updates turned off as SF-CLD-603, and a Docker base image with vulnerable packages as SF-CLD-911.

See also

References

  1. a b c d MITRE (updated 30 April 2026). "CWE-1395: Dependency on Vulnerable Third-Party Component". Common Weakness Enumeration, version 4.20.
  2. a b c d e f "A03:2025 Software Supply Chain Failures". OWASP Top 10:2025. OWASP Foundation.
  3. a b c d Python Packaging Authority. "pip-audit" (README). GitHub.
  4. back npm. "About semantic versioning". npm Docs.
  5. back npm. "package-lock.json". npm Docs, CLI v11.
  6. a b c npm. "npm-audit". npm Docs, CLI v11.
  7. back Khudairi, Sally (14 September 2017). "The Apache Software Foundation Confirms Equifax Data Breach Due to Failure to Install Patches Provided for Apache Struts Exploit". The ASF Blog.
  8. a b GitHub. "About Dependabot security updates". GitHub Docs.
  9. back GitHub. "Configuring Dependabot alerts". GitHub Docs.