CCyberwiki

Software composition analysis

Software composition analysis
TypeSecurity testing method
Also known asSCA, dependency scanning, component analysis
ExaminesThe third-party packages an application uses and their versions
Data sourcesCVE and the NVD, GitHub Advisory Database, OSV
Example toolsnpm audit, Dependabot, OSV-Scanner, OWASP Dependency-Check, OWASP Dependency-Track
Related methodsSAST, DAST, SBOM

Software composition analysis (SCA) finds the third-party and open source packages in an application and checks each package version against published vulnerability data and, in many tools, against licence rules. It is the software half of component analysis, a wider process in cyber supply chain risk management that also looks for risk in third-party hardware.1 SAST reads the code a team wrote and DAST tests the running application; SCA examines the code the team installed, which the organization takes responsibility for although it did not write it.1

Inventory

Every later step rests on a list of each component and its exact version.1 The tool builds it from the files a package manager keeps: the manifest, such as package.json, which names the dependencies a developer chose, and the lockfile, such as package-lock.json, which records the version actually installed of every package in the tree. Some tools read a software bill of materials instead of the project files.1

A large part of the tree consists of transitive dependencies: the application depends on one package, and that package depends on others. In ecosystems that favour reuse they are common and expected.1 The 2025 edition of the OWASP Top 10 counts failing to track these nested dependencies, on the client or the server, as a condition of A03:2025 Software Supply Chain Failures.2 Without a lockfile the tree is resolved again at each run, so audit results "may be different with every run".3

Matching against vulnerability data

Each component in the inventory is compared with advisories, records that name an affected package and a range of affected versions. The traditional source is Common Vulnerabilities and Exposures entries in the National Vulnerability Database, which identifies products by CPE names. Those vendor and product names are often wrong for the package in question, so a component can be hard to pin down uniquely.1 The OSV format, maintained under OpenSSF, identifies a package by its registry and its registry name, with an optional Package URL, and lists affected versions as events:4

"affected": [{
  "package": { "ecosystem": "npm", "name": "foo" },
  "ranges": [{
    "type": "SEMVER",
    "events": [{ "introduced": "1.0.2" }, { "fixed": "2.0.0" }]
  }]
}]

A tool that reads foo 1.4.0 in the lockfile falls inside this range and reports the advisory, together with its severity, which OSV can record as a Common Vulnerability Scoring System vector.4 OSV-Scanner uses this database to connect "a project's list of dependencies with the vulnerabilities that affect them".5 Watching CVE, the NVD and OSV for new entries is the work SCA tools automate.2

A finding also climbs the tree. If foo is vulnerable in the range >=1.0.2 <2.0.0 and the package bar requires foo@^1.1.0, no allowed version of bar can be installed without a vulnerable foo, so npm marks bar as a "metavulnerability".3

Results and fixes

Since npm 7, npm audit posts the name and version of every package in the tree to the registry's bulk advisory endpoint and computes the result from the advisories it receives.3 The command exits with a non-zero code when it finds any vulnerability, which makes it usable as a gate in continuous integration. The --audit-level option sets the lowest severity that fails the build; lower findings still appear in the report:3

npm audit                        # report only
npm audit --audit-level=high     # fail only on high or critical
npm audit fix --dry-run --json   # show what a fix would change
npm audit fix                    # install compatible fixed versions

npm audit fix moves packages to versions with no advisory while staying inside the ranges in package.json. When the fix needs a new major version of a direct dependency, it requires --force, and some findings cannot be fixed automatically at all.3 GitHub's Dependabot runs the same kind of check on a repository's default branch and raises an alert when a new advisory enters the GitHub Advisory Database or when a push changes the dependency graph; each alert links to the affected file.6

Other checks

Component analysis can also identify each component's licence and classify it, for example as copyleft or OSI approved. The recommended policy is an allow list and a deny list of licences, with legal advice for anything on neither.1 Outdated and end-of-life components fall within component analysis too, as do threats aimed at package registries such as typosquatting and dependency confusion.1 Packages built to attack the people who install them are described in Malicious packages.

Limits

SCA finds only what an advisory already describes. GitHub states that Dependabot alerts "can't catch every security issue", that new vulnerabilities take time to reach its database, and that only advisories reviewed by GitHub produce alerts.6 A vulnerability counts as known once it is documented anywhere, a commit log or release notes included, so it can be public without appearing in any database.1 The result also depends on the inventory: npm skips any package whose package.json has no version field.3 A library copied into the repository as a file, outside the package manager, is absent from the manifest altogether.

EPSS gives a CVE a probability of exploitation, and the KEV catalog lists vulnerabilities used in real attacks; teams use both to decide which SCA findings to fix first.

Notable case

Apache Struts, an open source framework for Java web applications, published a fix for CVE-2017-5638 on 7 March 2017, the day the flaw was announced. On 7 September 2017 Equifax announced a breach affecting 143 million consumers, and on 13 September it confirmed that the vulnerability exploited was CVE-2017-5638. The Apache Software Foundation attributed the breach to Equifax's failure to install the update in time.7 The US Government Accountability Office reported that the attackers entered through an online dispute portal, that Equifax found them in July 2017, and that personal information of at least 145.5 million people was accessed.8

In SecFlash

On the Security page, SecFlash reports a package with a published advisory as SF-SEC-701, and as SF-SEC-712 when the vulnerability is on CISA's Known Exploited Vulnerabilities list. SF-SEC-713 marks a package version published to attack its users, SF-SEC-714 and SF-SEC-715 report copyleft licences, and SF-SEC-780 finds a JavaScript library copied into the repository as a file. Libraries loaded by the live site are reported as SF-SEC-403 and SF-SEC-404. A new advisory for a package an app uses appears on the Threats page as SF-THR-101. On the Cloud page, SF-CLD-602 and SF-CLD-603 report Dependabot alerts or security updates switched off, and SF-CLD-911 reports a container base image with vulnerable packages.

See also

References

  1. a b c d e f g h i Springett, Steve. "Component Analysis". OWASP Community. OWASP Foundation.
  2. a b "A03:2025 Software Supply Chain Failures". OWASP Top 10:2025. OWASP Foundation.
  3. a b c d e f "npm-audit". npm Docs, CLI version 11. GitHub.
  4. a b "Open Source Vulnerability format". OSV Schema. OpenSSF.
  5. back "OSV-Scanner". OSV-Scanner documentation. Google.
  6. a b "About Dependabot alerts". GitHub Docs. GitHub.
  7. back The Apache Software Foundation (14 September 2017). "Media Alert: The Apache Software Foundation Confirms Equifax Data Breach Due to Failure to Install Patches Provided for Apache Struts Exploit". The ASF Blog.
  8. back US Government Accountability Office (30 August 2018). "Data Protection: Actions Taken by Equifax and Federal Agencies in Response to the 2017 Breach". GAO-18-559.