SCA
SCA: Software Composition Analysis
SCA checks the libraries and dependencies an application is built from. It shows whether the versions in use have known vulnerabilities (CVE) and which licenses cover the code.
Most of the code in a modern application comes from third parties. Your own code can be flawless, yet one vulnerable library such as Log4j exposes the whole system.
How it works
- Read manifests and lock files: package-lock.json, pom.xml, requirements.txt, go.sum and so on.
- Build the dependency tree, both direct and transitive (dependencies of dependencies).
- Match versions against vulnerability databases: NVD, GitHub Advisory, OSV.
- Check licenses and produce an SBOM, the list of all components.
What it finds
| Known vulnerabilities in library versions | CVE | log4j-core 2.14.1 → CVE-2021-44228 |
| Vulnerabilities that are already exploited | KEV | Listed in the CISA KEV catalog: fix these first |
| License risks | GPL, AGPL | A copyleft license in a closed-source product |
| Malicious packages | MAL | Typosquatting and hijacked packages in npm and PyPI |
| Outdated and abandoned components | — | Versions with no support and no fixes |
Example
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
</dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
</dependency> CVE-2021-44228 (Log4Shell) · CVSS 10.0 · in the CISA KEV catalog · log4j-core 2.14.1 was fixed in 2.15.0. Taking CVE-2021-45046, -45105 and -44832 into account, update to 2.17.1 (Java 8+). The library often arrives transitively, through another package.
Limitations and common mistakes
- It only knows about published vulnerabilities and will not find a zero-day.
- Not every vulnerability in a library is reachable from your code. Without reachability analysis the list can be long.
- Updating a library is not always simple. You need a strategy: update, replace, cover with a compensating control or accept the risk.
How to choose an SCA tool
- Ecosystems and lock files of the project: Maven and Gradle, npm and yarn, pip and poetry, NuGet, Go modules. Transitive dependencies must be covered, not only direct ones.
- Vulnerability databases and how fast they update: NVD, GitHub Advisory, OSV. For an isolated network, an offline mirror of the database.
- Prioritization: CVSS, EPSS, the KEV flag and reachability of the vulnerable function from your code.
- Licenses: a policy of allowed and forbidden licenses, not just a list.
- SBOM in CycloneDX or SPDX format, for tracking dependencies and for accepting software from contractors.
- Policies and quality gate: a build with a critical vulnerability and no exception does not move forward.
SAST, SCA and DAST: what is the difference
| SAST | SCA | DAST | |
|---|---|---|---|
| What it checks | Your own source code | Third-party libraries | The running application from outside |
| Needs a run | No | No | Yes, a test environment |
| When | Every merge request | Every build and on a new CVE | On a test environment before release |
| Finds | Injections, XSS, secrets, weak cryptography | Known CVEs, licenses, malicious packages | Configuration, authentication and header errors |
| Does not see | Other people's libraries, server configuration | Errors in your code | The exact place in the code |
Tools
Questions and answers
What is a transitive dependency?
A library you did not add yourself, pulled in by another library. Vulnerable versions most often hide in transitive dependencies.
How is SCA different from SAST?
SAST checks your code and SCA checks the third-party code you use. For a full picture you need both.
What is SCA in simple terms?
A check of the application's composition: which third-party libraries it is built from, whether their versions have known vulnerabilities and whether their licenses are acceptable.
How are SCA and SBOM related?
An SBOM lists all components and versions. SCA builds it from manifests and lock files and compares it with vulnerability databases. When a new CVE appears, the SBOM shows at once which applications are affected.
Does SCA work in an isolated network without internet?
Yes, if the vulnerability databases are updated from a local mirror. Without updates SCA goes stale quickly, because new CVEs are published every day.
Will SCA find a malicious package?
If the package is already in the databases (GitHub Advisory entries of type malware, OSV entries with MAL identifiers), yes. Fresh typosquatting appears before the database record does, so pinned versions, lock files and an internal proxy repository also help.