How to Detect Vulnerabilities in Open Source Software

To detect vulnerabilities in open source software, first know what you use by generating a software bill of materials (SBOM), then scan it continuously against vulnerability databases such as OSV, the GitHub Advisory Database and NVD using software composition analysis tools like osv-scanner, Trivy, Dependabot, pip-audit or npm audit.

Jul 18, 2025 - 16:42
Updated: 
102.2k

Cyber Threats, Scams & Online Safety in Cybersecurity & Ethical Hacking · Tutorial

How to Detect Vulnerabilities in Open Source Software

Quick answer: To detect vulnerabilities in open source software, first know what you use by generating a software bill of materials (SBOM), then scan it continuously against vulnerability databases such as OSV, the GitHub Advisory Database and NVD using software composition analysis tools like osv-scanner, Trivy, Dependabot, pip-audit or npm audit. Prioritise findings that are reachable from your code and known to be exploited, update or patch dependencies through normal reviews, and check project health and package authenticity to avoid malicious packages. Log4Shell (2021) and the xz Utils backdoor (2024) showed why fast detection matters.

Key takeaways

  • Most applications contain many open source components, including transitive dependencies.
  • SBOMs let you answer "are we affected?" quickly.
  • Scan in CI on every change and on a schedule for newly disclosed flaws.
  • Not every finding is exploitable; prioritise reachable, exploited ones.
  • Malicious packages are a separate risk from vulnerable ones.

Table of Contents

What Is a Good Detection Workflow?

  1. Generate SBOMs for every build and store them.
  2. Scan dependencies in pull requests and nightly.
  3. Triage: exploitability, reachability, fix availability.
  4. Update dependencies with automated pull requests and tests.
  5. Monitor for newly disclosed issues affecting stored SBOMs.

How Do You Generate an SBOM?

# Syft: SBOM for a project directory or container image (CycloneDX format)
syft dir:. -o cyclonedx-json > sbom.json
syft myapp:2.1.0 -o spdx-json > sbom-image.json

CISA's SBOM resources describe SPDX and CycloneDX formats; CERT-In has also issued SBOM guidelines for Indian organisations.

Which Scanners Should You Use?

ToolEcosystemsNotes
osv-scannerMany (lock files, SBOMs)Uses the open OSV database
TrivyContainers, file systems, many languagesAlso finds secrets and misconfigurations
DependabotGitHub repositoriesAlerts and automatic update pull requests
pip-audit, npm audit, cargo auditPython, Node.js, RustBuilt into ecosystem tooling
Commercial SCAManyReachability analysis, licence compliance
osv-scanner scan source -r .
trivy fs --scanners vuln --severity HIGH,CRITICAL .
pip-audit -r requirements.txt

The GitHub Advisory Database is another key data source.

How Do You Prioritise Findings?

  • Is the vulnerable function reachable from your code?
  • Is it in the CISA KEV catalogue or does it have a high EPSS score?
  • Is the component exposed to untrusted input or the internet?
  • Is a fixed version available, or is a workaround needed?

Record decisions, for example with VEX statements, so the same finding is not re-triaged repeatedly.

How Do You Spot Malicious Packages?

  • Check for typosquatting: names one character away from popular packages.
  • Review new dependencies: maintainers, download history, repository activity.
  • Check project health with OpenSSF Scorecard.
  • Pin versions with lock files and hash verification.
  • Use a private registry proxy to control what enters builds.

What Did Log4Shell and xz Teach Us?

Log4Shell (CVE-2021-44228) affected a ubiquitous Java logging library; organisations without inventories spent weeks finding where it was used. CISA's guidance stressed asset inventory. xz Utils (CVE-2024-3094) showed a trusted maintainer inserting a backdoor, caught by an engineer noticing unusual performance (CISA alert). See also supply chain security. WebAsha offers DevSecOps training.

References

Frequently Asked Questions

Generate an SBOM and scan it with tools like osv-scanner, Trivy, Dependabot or ecosystem auditors.

Scanning applications for third-party and open source components and their known vulnerabilities and licences.

An open, distributed vulnerability database for open source projects, used by osv-scanner.

Prioritise reachable, exploited and exposed issues; document decisions for the rest.

Dependencies of your dependencies, which also need scanning.

Malicious packages are intentionally harmful; vulnerable ones contain accidental flaws.

A critical 2021 flaw (CVE-2021-44228) in the Log4j Java logging library that affected countless applications.

A tool that rates open source projects on security practices such as code review and branch protection.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.