The most surprising true thing about CVE scanning tools for Linux in 2024 is that the "best" tool often depends more on your existing infrastructure and workflow than on raw detection accuracy.

Let’s see how this plays out in practice. Imagine you’re managing a fleet of Ubuntu servers and want to know their current security posture. You’ve got a few popular options.

First, there’s apt itself, acting as a CVE scanner. If you’ve run sudo apt update && sudo apt list --upgradable, you’ve already touched upon a fundamental CVE detection mechanism. This command queries Ubuntu’s package repositories for available updates. When apt flags a package as upgradable, it’s implicitly saying that the current version has a known vulnerability (a CVE) that’s fixed in the newer version.

# Update package lists
sudo apt update

# List packages with available security updates
sudo apt list --upgradable | grep -i security

The output might look like this:

libssl1.1/focal-security 1.1.1f-1ubuntu2.22 amd64 [upgradable from: 1.1.1f-1ubuntu2.21]
openssl/focal-security 1.1.1f-1ubuntu2.22 amd64 [upgradable from: 1.1.1f-1ubuntu2.21]

Here, libssl1.1 and openssl have security updates available. The mechanism is simple: the distribution maintainers track CVEs, patch them in new package versions, and update the repository metadata. apt then compares your installed versions against this metadata. The fix is straightforward: sudo apt upgrade.

Next, consider npm for Node.js projects. If you’re developing a web application, you’re likely using JavaScript packages. npm audit is your go-to.

# Navigate to your Node.js project directory
cd /path/to/your/nodejs/project

# Run the vulnerability audit
npm audit

The output might show something like:

# npm audit report

minimist  <1.2.6
Severity: High
Prototype Pollution - https://npmjs.org/advisories/780
fix available via `npm audit fix`

This tells you that the minimist package, a dependency of one of your project’s dependencies, has a known prototype pollution vulnerability. The npm audit fix command attempts to automatically update vulnerable dependencies to their patched versions. The underlying mechanism is a database of known vulnerabilities linked to specific package versions, maintained by the npm security team and a community of researchers.

For more comprehensive, host-based scanning across various software, tools like Trivy or Grype are powerful. Let’s look at Trivy. It can scan operating system packages, application dependencies, and even container images.

# Install Trivy (example for Linux)
sudo apt-get install trivy

# Scan installed packages on your Linux host
trivy fs /

Or, to scan a specific directory:

# Scan a specific directory (e.g., your application's root)
trivy fs /path/to/your/app

The output will list detected CVEs, the affected packages, and severity:

┌─────────────┬──────────────────┬───────────┐
│   Library   │ Vulnerability ID │ Severity  │
├─────────────┬──────────────────┬───────────┤
│ openssl     │ CVE-2023-xxxx    │ HIGH      │
│ curl        │ CVE-2023-yyyy    │ MEDIUM    │
└─────────────┴──────────────────┴───────────┘

Trivy works by downloading vulnerability databases (like NVD, Red Hat, Debian, etc.) and comparing the versions of software it finds on your system (or in an image) against the known vulnerable versions in these databases. The fix involves updating the identified packages, often via the system’s package manager or application-specific update mechanisms.

Another popular choice is Grype, which also excels at scanning filesystems and container images.

# Install Grype (example for Linux)
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin

# Scan your filesystem
grype dir=/

Grype’s output is similar in structure, detailing findings and severity.

┌─────────┬──────────────────┬───────────┬──────────────────────────────────────────────────────────┐
│   ID    │      VULN        │ SEVERITY  │                         PACKAGE                          │
├─────────┼──────────────────┼───────────┼──────────────────────────────────────────────────────────┤
│       1 │ CVE-2023-xxxx    │ HIGH      │ openssl:openssl (1.1.1f-1ubuntu2.21) on ubuntu:20.04        │
│       2 │ CVE-2023-yyyy    │ MEDIUM    │ curl:curl (7.68.0-1ubuntu2.20) on ubuntu:20.04             │
└─────────┴──────────────────┴───────────┘

Grype also relies on curated vulnerability databases, maintained by Anchore, and performs version comparisons against your installed software. The remediation strategy is consistent: update the vulnerable components.

The mental model for these tools revolves around a simple equation: Installed Software Version vs. Known Vulnerable Software Versions. When there’s a match (or an overlap where your version is within a vulnerable range), a CVE is flagged. The "system" is the combination of your operating system’s package management, application-specific dependency managers, and the external vulnerability databases these tools query. You control the scanning scope (filesystem, container image, specific project) and the remediation actions (upgrading packages, patching code).

What most people don’t realize is how deeply integrated CVE tracking is into the Linux ecosystem, even at the distribution level. apt, dnf, yum — they aren’t just for installing software; they are fundamental components of your vulnerability management strategy. When you see an update flagged as "security," it’s not arbitrary; it’s a direct response to a CVE that the distribution maintainers have verified affects their packages.

The next concept you’ll encounter is how to integrate these scans into your CI/CD pipeline for automated security checks.

Want structured learning?

Take the full Cdk course →