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.
Topic: Cyber Threats, Scams & Online Safety in Cybersecurity & Ethical Hacking · Tutorial
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?
- How Do You Generate an SBOM?
- Which Scanners Should You Use?
- How Do You Prioritise Findings?
- How Do You Spot Malicious Packages?
- What Did Log4Shell and xz Teach Us?
- References
What Is a Good Detection Workflow?
- Generate SBOMs for every build and store them.
- Scan dependencies in pull requests and nightly.
- Triage: exploitability, reachability, fix availability.
- Update dependencies with automated pull requests and tests.
- 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?
| Tool | Ecosystems | Notes |
|---|---|---|
| osv-scanner | Many (lock files, SBOMs) | Uses the open OSV database |
| Trivy | Containers, file systems, many languages | Also finds secrets and misconfigurations |
| Dependabot | GitHub repositories | Alerts and automatic update pull requests |
| pip-audit, npm audit, cargo audit | Python, Node.js, Rust | Built into ecosystem tooling |
| Commercial SCA | Many | Reachability 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
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0