Skip to content
Pwnversity
DSO-DEPSintermediate · 7 min · upd. 2026-10

Dependencies & SCA

OWASP A03:2025

Modern software is mostly third-party code: a typical app has hundreds of transitive dependencies. SCA (Software Composition Analysis) inventories and assesses that external code for known vulnerabilities and license issues. It’s the direct answer to Log4Shell and to the wave of supply-chain attacks.

Code you didn’t write still runs with your privileges. The threats around dependencies are several and distinct:

  • Known vulnerability in a direct or transitive dependency (Log4Shell: CVE-2021-44228 in Log4j).
  • Malicious package: typosquatting (reqeusts for requests), dependency confusion (publishing an internal package name to a public repo with a higher version), or a legitimate library with an injected backdoor.
  • Maintainer compromise: the author’s account is hijacked and a trojaned version is published (xz-utils: CVE-2024-3094, a backdoor introduced into liblzma by an infiltrated maintainer).
  • Incompatible license: a GPL dependency in a proprietary product is a legal risk, not a security one, but SCA catches it too.
flowchart TD
    APP["Your application"] --> D1["Direct dependency A"]
    APP --> D2["Direct dependency B"]
    D1 --> T1["Transitive A1"]
    D1 --> T2["Transitive A2 (vulnerable)"]
    D2 --> T3["Transitive B1"]
    T2 -.->|known CVE| RISK["Inherited risk"]
    style T2 fill:#c0392b,color:#fff
    style RISK fill:#c0392b,color:#fff

The key point: most of the risk lives in the transitives, which nobody explicitly chose.

The tool reads the manifest and the lockfile (package-lock.json, poetry.lock, go.sum, pom.xml), resolves the full dependency tree, and checks each package+version against vulnerability databases:

  • Sources: NVD (CVEs), GitHub Advisory Database (GHSA), OSV (Open Source Vulnerabilities, the unified format), ecosystem advisories (npm audit, PyPI).
  • Lockfile required: without a lockfile, the build isn’t reproducible and SCA analyzes something different from what ships.
  • Precise matching: exact version, not range. A ^1.2.0 range may resolve to a vulnerable version tomorrow.

Running industry tools:

Ventana de terminal
# OWASP Dependency-Check
dependency-check --project myapp --scan ./ --format SARIF
# Trivy (filesystem, dependency vulns only)
trivy fs --scanners vuln --severity HIGH,CRITICAL .
# npm native
npm audit --audit-level=high

CI integration that fails only on critical:

name: sca
on: [pull_request]
jobs:
trivy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: aquasecurity/trivy-action@master
with:
scan-type: fs
severity: CRITICAL
exit-code: "1"

An SBOM (Software Bill of Materials) is the complete list of components in an artifact. When the next Log4Shell lands, the SBOM answers “do I use this library and where?” in minutes, instead of weeks of manual grep.

  • Standard formats: CycloneDX (OWASP, security-oriented) and SPDX (Linux Foundation, license-oriented). Both are machine-readable.
  • Generation in the build:
Ventana de terminal
# CycloneDX for a Node project
cyclonedx-npm --output-file sbom.cdx.json
# Syft, multi-ecosystem, from an image
syft myapp:1.4.2 -o spdx-json > sbom.spdx.json

The SBOM is signed and archived alongside the artifact (see CI/CD); that way provenance can be audited later.

Dependencies are a first-class entry vector:

  • Dependency confusion: if an org uses an internal package @acme/utils and doesn’t reserve that name in the public repo, an attacker publishes @acme/utils with a very high version and the resolver may pull it.
  • Typosquatting: names nearly identical to popular packages that run code in postinstall.
  • Exploit the known: before attacking the app’s own code, the attacker enumerates dependencies (*.lock files, headers, endpoints) and looks for public CVEs with exploits — a shorter path than finding a 0-day.
  • Long chain: compromising a widely-used transitive (as in xz-utils) impacts thousands of downstream projects.
  • Lockfiles always and reproducible builds.
  • Policy by severity and exploitability: not every critical CVE is exploitable in your specific usage; prioritize with context (EPSS, reachability analysis) so you don’t drown the team.
  • Reserve your namespaces on public repos to cut dependency confusion; configure internal scoped registries.
  • Pin and verify: pin by hash where the ecosystem allows; verify package signatures (Sigstore, npm provenance).
  • Automate updates (Dependabot, Renovate) so you don’t accumulate debt: a dependency left un-updated for a year is a time bomb.
  • Generate and keep the SBOM of each release.
  • SCA on every PR over the full tree (direct + transitive).
  • Lockfiles committed and reproducible builds.
  • CVE policy by severity and exploitability, not just CVSS.
  • Internal namespaces reserved on public repos.
  • Internal registries with scoping configured.
  • Automated dependency updates (Dependabot/Renovate).
  • SBOM (CycloneDX or SPDX) generated and archived per release.
  • Package signature/provenance verification where available.