Dev.to Security 🔐 Cybersecurity 👁 0 📖 5 min read

A New CVE Was Published. Do You Know Which of Your Applications Are Affected?

A New CVE Was Published. Do You Know Which of Your Applications Are Affected? Imagine that a security advisory announces a vulnerability in a widely used software library. Your team maintains several applications, mul

A New CVE Was Published. Do You Know Which of Your Applications Are Affected?

Imagine that a security advisory announces a vulnerability in a widely used software library.

Your team maintains several applications, multiple container images and a collection of internal services. Some projects use the affected library directly. Others may include it through nested dependencies.

The first question is not how quickly you can patch the library.

It is much simpler:

Where exactly are you using it?

If your organization does not maintain an accurate inventory of software components, answering that question can take hours or even days.

This is one of the problems Software Bill of Materials (SBOM) is designed to solve.

The dependency visibility problem

Modern applications rarely consist only of code written by their developers.

A typical project may include:

  • Direct dependencies declared by developers
  • Transitive dependencies installed automatically
  • System packages included in container images
  • Runtime libraries
  • Build-time tools
  • Components inherited from base images

A developer might recognize the packages listed in a project manifest, but that list does not necessarily describe everything shipped with the final application.

This becomes especially problematic when a vulnerability affects a dependency several levels below the one explicitly declared by the project.

Without a reliable inventory, security teams are forced to investigate repositories and deployment environments manually.

Step 1: Generate an SBOM with Syft

Syft, developed by Anchore, can inspect directories, container images and other software artifacts to identify installed packages.

For a local project, start with:

syft .

To generate a CycloneDX JSON document:

syft . -o cyclonedx-json > sbom.cdx.json

You can also generate an SPDX document:

syft . -o spdx-json > sbom.spdx.json

The resulting file contains information about the components Syft was able to identify, including package names and versions.

This gives your team a structured inventory that can be stored alongside a build artifact or release.

Step 2: Scan the SBOM with Grype

An inventory alone does not tell you whether a component has a known vulnerability.

Grype can analyze an SBOM and compare its packages against vulnerability data.

Run:

grype sbom:./sbom.cdx.json

The report can include:

  • Affected package
  • Installed version
  • Vulnerability identifier
  • Severity
  • Available fixed version, when known
  • Matching information

This is where the workflow becomes useful for incident response.

Instead of manually searching every project for a vulnerable library, you can use previously generated SBOM files to identify potentially affected releases.

Step 3: Scan the actual container image

There is an important distinction between scanning a source directory and scanning the artifact that will run in production.

A container image may contain operating system packages, runtime libraries and utilities that are not visible in the application's source repository.

For example:

syft my-application:1.0 -o cyclonedx-json > image-sbom.json

Then:

grype sbom:image-sbom.json

This approach provides visibility into the components detected in the actual image.

It is particularly useful when teams build applications using Dockerfiles and shared base images.

Step 4: Add the checks to CI/CD

The most effective SBOM workflow is not one that runs only after a security incident.

It should be part of the regular build process.

A simple GitHub Actions workflow can generate an SBOM and scan it on every push and pull request.

name: SBOM Security Scan

on:
  push:
    branches: [main]
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  sbom:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Syft
        run: |
          curl -sSfL https://get.anchore.io/syft \
            | sudo sh -s -- -b /usr/local/bin

      - name: Install Grype
        run: |
          curl -sSfL https://get.anchore.io/grype \
            | sudo sh -s -- -b /usr/local/bin

      - name: Generate SBOM
        run: |
          syft . -o cyclonedx-json > sbom.cdx.json

      - name: Scan dependencies
        run: |
          grype sbom:./sbom.cdx.json --fail-on high

      - name: Upload SBOM
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: sbom-report
          path: sbom.cdx.json
          if-no-files-found: ignore

The --fail-on high option makes Grype return a failure status when the configured severity threshold is reached.

This allows the CI pipeline to stop a build or deployment when a finding crosses the organization's defined threshold.

For production environments, pin tool and action versions to reviewed releases or commit hashes rather than relying on moving versions.

Step 5: Do not treat every finding as an incident

A vulnerability scanner produces findings, not a complete risk assessment.

A vulnerable package version does not automatically mean that an attacker can exploit the application.

Before blocking a release or opening an incident, consider:

  1. Is the affected package actually present in the deployed artifact?
  2. Is the vulnerable functionality used?
  3. Is the vulnerable code reachable?
  4. Is the application exposed to the relevant attack vector?
  5. Is a fixed version available?
  6. Are there compensating controls?

Pay attention to the quality of package identification as well. Different matching methods can have different levels of confidence.

The goal is not to ignore findings. It is to prioritize remediation based on evidence rather than treating every scanner result as equally urgent.

Step 6: Keep historical SBOMs

One of the most useful practices is keeping an SBOM for every released version.

Consider a vulnerability disclosed several weeks after an application was deployed.

If the organization has retained the SBOM associated with that release, it can rescan the document using updated vulnerability data.

This can be much faster than reconstructing the original build environment.

A practical release process should retain:

  • SBOM file
  • Application or image version
  • Build identifier
  • Scan date
  • Syft and Grype versions
  • Scan report
  • Remediation status

This turns SBOM from a one-time compliance document into a useful operational record.

What SBOM cannot do

SBOM is not a replacement for secure development practices, code analysis or penetration testing.

It does not automatically detect every vulnerability in custom code. It cannot guarantee that all software components have been identified. It also cannot determine by itself whether a vulnerability is exploitable in a particular deployment.

Its purpose is narrower but extremely important: to provide visibility into the software components that make up an application.

When combined with vulnerability scanning and a clear remediation process, that visibility makes incident response much more efficient.

Final thoughts

The hardest part of responding to a newly disclosed dependency vulnerability is often identifying where the affected component is actually used.

Syft and Grype provide a practical starting point.

Syft generates an inventory. Grype compares identified packages with known vulnerability information. CI/CD integration makes the process repeatable, while historical SBOM files help teams investigate older releases.

If you want a practical walkthrough with additional commands and examples, see this Polish guide:

SBOM in practice: detecting vulnerable software components with Syft and Grype

Knowing what is inside your software is not the whole of supply chain security. But without that knowledge, responding to a vulnerable dependency becomes unnecessarily difficult.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.