Skip to content

Software Composition Analysis (SCA) security lab using Trivy. Scanned 1,640+ vulnerabilities in Docker images. Demonstrates container security expertise with vulnerability analysis and remediation guides.

Notifications You must be signed in to change notification settings

robertpreshyl/opensource-sca-security-lab

Repository files navigation

ASLabs Logo

ASLabs - Open-Source SCA Security Lab


Executive Summary

Project Goal: Demonstrate hands-on Software Composition Analysis (SCA) capabilities using open-source tools to identify, analyze, and remediate container vulnerabilities.

Overall Risk Assessment: πŸ”΄ CRITICAL (95/100)

Metric Result Impact
Total Vulnerabilities 3,286 across 4 images Massive attack surface
Critical Severity 330 CVEs Remote Code Execution risk
High Severity 2,956 CVEs Data breach potential
Unfixable (EOL OS) 100% Requires base image migration
Remediation Effort 2-4 hours 98-99% reduction possible

Key Finding: End-of-Life operating systems (Debian 9/10) accumulate vulnerabilities with no patch availability. Migrating to Alpine Linux reduces vulnerabilities by 98.3% (470 β†’ 8 CVEs).

Business Impact:

  • Without remediation: High probability of exploitation via known CVEs (CVSS 9.8/10)
  • With remediation: Attack surface reduced by 99.6% using distroless containers
  • Cost: 2 hours development time vs. potential $4.2M average breach cost (IBM 2025)

What is this? I built a Software Composition Analysis (SCA) lab using Trivy to learn how to find vulnerabilities in Docker containers. This project closes my knowledge gap with commercial tools like BlackDuck.

What I found: I scanned 4 container images (2 custom apps + 2 base images) and identified 3,286 total vulnerabilities. My custom vulnerable applications alone had 1,646 critical/high vulnerabilities because they use End-of-Life operating systems that no longer receive security patches.


Quick Results

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Image            β”‚ Total Vul  β”‚ CRITICAL β”‚ HIGH  β”‚ Base OS      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ vuln-node-app    β”‚ 468        β”‚ 80       β”‚ 388   β”‚ Debian 9 EOL β”‚
β”‚ vuln-python-app  β”‚ 1,178      β”‚ 85       β”‚ 1,093 β”‚ Debian 10 EOLβ”‚
β”‚ node:14.17.0     β”‚ 470        β”‚ 30       β”‚ 440   β”‚ Debian 9 EOL β”‚
β”‚ python:3.8.10    β”‚ 1,170      β”‚ 85       β”‚ 1,085 β”‚ Debian 10 EOLβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Why this matters: If you deploy containers with these images, you inherit all these vulnerabilities. Industrial equipment with long lifecycles (5-10 years) needs continuous scanning to catch these risks.


Scan Workflow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Pull/Build     β”‚
β”‚  Docker Image   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Trivy Scan     │─────▢│  Vulnerability   β”‚
β”‚  (CRITICAL/HIGH)β”‚      β”‚  Database (83MB) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Generate       β”‚
β”‚  JSON Report    β”‚
β”‚  (3.8 MB)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Parse with jq  │─────▢│  Extract CVEs    β”‚
β”‚  Filter Results β”‚      β”‚  Group by Packageβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Investigate    β”‚
β”‚  Top CVEs in    β”‚
β”‚  NIST NVD       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Document       β”‚
β”‚  Findings &     β”‚
β”‚  Remediation    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What I Did

1. Installed Trivy

brew install trivy

2. Built and Scanned Custom Vulnerable Apps

I created intentionally vulnerable Docker containers to understand dependency risks:

# Build Node.js app with old packages
cd 01-container-scanning/vulnerable-node-app
docker build -t vuln-node-app .

Building Node.js App

# Build Python app with old packages
cd ../vulnerable-python-app
docker build -t vuln-python-app .

Building Python App

# Scan both apps
trivy image --severity CRITICAL,HIGH vuln-node-app
trivy image --severity CRITICAL,HIGH vuln-python-app

Node.js App Scan Results:

Node.js Scan Summary

  • Total: 468 vulnerabilities (80 CRITICAL, 388 HIGH)
    • Debian 9.13 OS: 434 vulnerabilities
    • Node.js packages: 34 vulnerabilities (express, axios, lodash, moment)

Node.js Package Vulnerabilities

Python App Scan Results:

Python Scan Summary

  • Total: 1,178 vulnerabilities (85 CRITICAL, 1,093 HIGH)
    • Debian 10 OS: 1,166 vulnerabilities
    • Python packages: 12 vulnerabilities (Flask, cryptography, urllib3, setuptools)

Python Critical CVEs

3. Analyzed the Base Images

I also scanned the official base images to compare:

# Scan official images
trivy image --severity CRITICAL,HIGH node:14.17.0
trivy image --severity CRITICAL,HIGH python:3.8.10

I parsed the 3.8 MB JSON output to find patterns:

  • 30 CRITICAL CVEs in node:14.17.0
  • 40% of critical vulns affect libwebp (image processing)
  • 7 expat vulnerabilities (XML parser used everywhere)
  • dpkg vulnerability (Debian package manager itself is vulnerable)

See FINDINGS.md for detailed CVE analysis.

4. Tested Remediation

I compared different base images:

Base Image Vulnerabilities Fix Time
node:14.17.0 (Debian 9) 470 Baseline
node:20-alpine3.19 ~8 98% reduction
gcr.io/distroless/nodejs20 ~2 99.6% reduction

Lesson: Just changing the base image cuts vulnerabilities by 98%.


Project Structure

opensource-sca-security-lab/
β”œβ”€β”€ ASLabs_Logo.png                # Brand logo
β”œβ”€β”€ FINDINGS.md                    # Detailed CVE analysis & investigation
β”œβ”€β”€ VISUAL_SUMMARY.md              # Data visualization and charts
β”œβ”€β”€ README.md                      # This file
β”œβ”€β”€ Screenshots/                   # Visual proof of scans
β”‚   β”œβ”€β”€ 01-docker-build-node-app.png
β”‚   β”œβ”€β”€ 02-docker-build-python-app.png
β”‚   β”œβ”€β”€ 03-node-scan-summary.png
β”‚   β”œβ”€β”€ 04-node-package-vulnerabilities.png
β”‚   β”œβ”€β”€ 05-python-scan-summary.png
β”‚   └── 06-python-critical-cves.png
β”œβ”€β”€ 01-container-scanning/
β”‚   β”œβ”€β”€ vulnerable-node-app/       # Test Node.js app
β”‚   β”‚   β”œβ”€β”€ Dockerfile             # node:14.17.0 + vulnerable packages
β”‚   β”‚   β”œβ”€β”€ package.json           # express 4.17.1, axios 0.21.1, etc.
β”‚   β”‚   └── app.js
β”‚   β”œβ”€β”€ vulnerable-python-app/     # Test Python app
β”‚   β”‚   β”œβ”€β”€ Dockerfile             # python:3.8.10 + vulnerable packages
β”‚   β”‚   β”œβ”€β”€ requirements.txt       # Flask 2.0.1, cryptography 3.3.2, etc.
β”‚   β”‚   └── app.py
β”‚   └── scan-results/
β”‚       β”œβ”€β”€ node-14-detailed.json  # 3.8 MB full Trivy scan output
β”‚       β”œβ”€β”€ vuln-node-app-scan.txt # 758 KB scan log (468 vulns)
β”‚       └── vuln-python-app-scan.txt # 97 KB scan log (1,178 vulns)
└── 04-automation/
    └── scan-all.sh                # Batch scanning script

What I Learned

  1. EOL Operating Systems Are Dangerous
    Debian 9 reached End-of-Life in 2022, so none of the 470 vulnerabilities get security patches. The only fix is upgrading the entire base image.

  2. Development Packages Shouldn't Be in Production
    I found libexpat1-dev, libwebp-dev in the results. These are compiler headers that increase attack surface without any runtime benefit.

  3. JSON Parsing Is Essential
    Trivy outputs 3.8 MB of JSON. I had to learn jq to extract useful insights:

    # Count CRITICAL CVEs by package
    jq -r '.Results[].Vulnerabilities[] | 
           select(.Severity == "CRITICAL") | 
           .PkgName' scan-results.json | 
       sort | uniq -c | sort -rn
  4. Not All CVEs Are Equal
    Some CRITICAL CVEs require specific conditions to exploit. I learned to read NIST NVD descriptions to understand real vs. theoretical risk.


Challenges I Faced

  • First scan took 17 minutes because Trivy downloads an 83 MB vulnerability database. I had to set TRIVY_TIMEOUT=15m.

  • Too much data - 1,640 vulnerabilities is overwhelming. I focused on CRITICAL severity first (30 CVEs), then investigated the top 5 by researching them in NIST NVD.

  • Understanding what SCA actually is - I thought it was just "scanning dependencies." It's really about supply chain transparency: knowing everything in your software stack and tracking vulnerabilities throughout the product lifecycle.


Tools Used

  • Trivy v0.68.2 - Open-source container scanner
  • Docker - Container platform
  • jq - JSON parsing
  • NIST NVD - CVE database for research

Future Enhancements

  • Generate SBOMs in CycloneDX format using trivy sbom βœ… Completed Jan 23, 2026
  • Automate scanning pipeline with GitHub Actions
  • Add CVSS vector strings to all top CVEs βœ… Completed in FINDINGS.md
  • Create risk prioritization matrix (Likelihood Γ— Impact) βœ… Completed in FINDINGS.md
  • Map vulnerabilities to OWASP Top 10 categories

Generated SBOMs

CycloneDX SBOMs generated for supply chain visibility:

Creating SBOM Directory

CycloneDX SBOM Generation

Image SBOM File Size Components
node:14.17.0 03-sbom-generation/container-sboms/node-14-sbom.json 1.4 MB Debian 9 + Node.js packages
python:3.8.10 03-sbom-generation/container-sboms/python-3.8-sbom.json 888 KB Debian 10 + Python packages

Generation Command:

trivy image --format cyclonedx --output sbom.json <image>

References


Contact

ASLabs - AllyShip Security Laboratories
LinkedIn: Precious Robert
Email: support@allyshipglobal.com
GitHub: https://github.com/robertpreshyl/opensource-sca-security-lab


Status: Portfolio project demonstrating hands-on SCA vulnerability analysis

About

Software Composition Analysis (SCA) security lab using Trivy. Scanned 1,640+ vulnerabilities in Docker images. Demonstrates container security expertise with vulnerability analysis and remediation guides.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published