Skip to content

How to check installed Linux packages for CVEs

Checking a Linux server for CVEs means comparing each installed package name and its exact distribution version with the security data of that distribution, not with upstream version numbers. Use debsecan on Debian, pro security-status and pro fix on Ubuntu, and dnf updateinfo on the RHEL family. Fix what is reachable from the outside first, restart the services that still run old code, and reboot after kernel updates.

To check a Linux server for known vulnerabilities, compare every installed package – its name and its exact distribution version – with the security data of the distribution it came from. Debian has debsecan, Ubuntu has pro security-status and pro fix, and the RHEL family has dnf updateinfo. Then decide what to fix first by asking whether the vulnerable code is reachable from the outside, and do not forget the last step: a fix only protects you once the service has been restarted or, for the kernel, the server rebooted.

What does matching packages against CVEs mean?

A CVE describes a vulnerability in a piece of software, for example "versions before 3.0.15 are affected". A security advisory from your distribution says something different: "this package in this release is fixed in revision X". The second statement is the one that counts on your server.

The reason is backporting. Stable distributions do not move to a new upstream version during a release. They take the fix and apply it to the version they ship. A package called openssl 3.0.13-0ubuntu3.x on Ubuntu 24.04 can contain fixes that upstream only released in a later 3.0 version. A tool that compares 3.0.13 with "fixed in 3.0.15" reports a vulnerability that is not there.

So a correct check needs three things:

  • the package name as the distribution names it (source package, not just the binary),
  • the full version including the distribution revision,
  • the distribution's own data on which revision contains the fix.

All three tools below work this way, because they read the data of the people who build the packages.

How do you check a Debian server?

debsecan downloads the data of the Debian security tracker and compares it with the packages installed on the machine:

sudo apt install debsecan
debsecan --suite bookworm --only-fixed

Replace bookworm with your release codename, for example trixie (lsb_release -cs prints it). Without --suite, debsecan cannot tell which fixes exist for your release and the list becomes useless. --only-fixed limits the output to CVEs for which Debian already ships a fix, which is the list you can act on today. The output has one line per CVE and package. Here is an excerpt from a test system with an outdated OpenSSL:

CVE-2024-0727 libssl3 (fixed)
CVE-2024-13176 libssl3 (fixed)
CVE-2024-2511 libssl3 (fixed)

When the tracker has more to say, the brackets carry notes such as remotely exploitable or high urgency. --format detail adds a short description, the installed version and the version that fixes it.

To get just the package names, for example to update them, use --format packages:

debsecan --suite bookworm --only-fixed --format packages

An empty result is the good case. If the same lines appear day after day, updates are not being installed. The data and the explanation of each entry are on the Debian security tracker.

How do you check an Ubuntu server?

The quickest check is the list of pending updates from the security pocket:

sudo apt update
apt list --upgradable 2>/dev/null | grep -- -security
libssl3t64/noble-updates,noble-security 3.0.13-0ubuntu3.16 amd64 [upgradable from: 3.0.13-0ubuntu3]

That tells you a fix is waiting, but not for which CVE. The Ubuntu Pro client (pro, installed by default on Ubuntu Server) answers that. It works without a subscription for these two commands:

pro security-status
sudo pro fix CVE-2024-5535 --dry-run
CVE-2024-5535: OpenSSL vulnerabilities
 - https://ubuntu.com/security/CVE-2024-5535

1 affected source package is installed: openssl
(1/1) openssl:
A fix is available in Ubuntu standard updates.
{ apt update && apt install --only-upgrade -y libssl3t64 openssl }

pro security-status groups your installed packages by where their security updates come from: the main archive, universe, third-party sources, or packages that are no longer available. Packages from universe or from third-party repositories are the ones most often forgotten.

pro fix takes one CVE or USN number. It tells you whether any installed package is affected, whether the fix is in the standard updates or only in Expanded Security Maintenance (ESM, part of Ubuntu Pro), and which apt command it would run. Without --dry-run it runs that command. On older releases such as 20.04, many fixes are only published in ESM; then an update from the free archive will not help, and the choice is upgrading the release or enabling Pro. Details per CVE are on Ubuntu's CVE pages.

What about OVAL?

Canonical also publishes its data as OVAL files, one per release, which OpenSCAP can evaluate offline:

sudo apt install openscap-scanner bzip2
release=$(lsb_release -cs)
wget https://security-metadata.canonical.com/oval/com.ubuntu.$release.usn.oval.xml.bz2
bunzip2 com.ubuntu.$release.usn.oval.xml.bz2
oscap oval eval --report report.html com.ubuntu.$release.usn.oval.xml

Each definition is printed as one line ending in true (affected) or false, for example Definition oval:com.ubuntu.noble:def:906510000000: true, and report.html lists the affected ones with their notices. OVAL is useful when you want one report format across many machines or need to scan without the Pro client. For a quick check on a single server, pro fix is easier.

How do you check RHEL, AlmaLinux and Rocky Linux?

On the RHEL family, the security data comes with the repositories as update metadata, and dnf reads it directly:

sudo dnf updateinfo list --security

An excerpt from an outdated Rocky Linux 9 test system:

RLSA-2025:0925  Moderate/Sec.  bzip2-libs-1.0.8-10.el9_5.x86_64
RLSA-2025:23343 Moderate/Sec.  binutils-2.35.2-67.el9_7.1.x86_64

The prefix depends on the distribution (RHSA, ALSA, RLSA). Each line is an advisory with its severity and the package version that fixes it. dnf updateinfo info RLSA-2025:0925 shows the CVEs an advisory covers (here CVE-2019-12900), and dnf updateinfo list --cve CVE-2019-12900 answers the question the other way round. sudo dnf upgrade --security installs only security updates.

What should you fix first?

A list with forty CVEs is not forty equal tasks. Ask two questions per entry:

  1. Is the vulnerable code reachable from the outside? A flaw in the web server, the TLS library it uses or the SSH daemon on a public port is urgent. A flaw in a command-line tool that only an administrator runs, or in a library no running service loads, can wait for the regular update.
  2. Is there a fix? If the distribution has not published one, there is nothing to install. The useful action then is to reduce exposure: close a port, switch off a module, restrict access – and check again.

The CVSS score helps, but it describes the worst case in general, not your server. A score of 9.8 for a library that nothing on the machine uses is less urgent than 7.5 in the public-facing web server.

Why do you need to restart after the update?

Installing a package replaces files on disk. A process that started before keeps the old library in memory. needrestart finds those processes on Debian and Ubuntu; its batch mode is easy to read in scripts:

sudo needrestart -b
NEEDRESTART-VER: 3.6
NEEDRESTART-KCUR: 6.8.0-49-generic
NEEDRESTART-KEXP: 6.8.0-51-generic
NEEDRESTART-KSTA: 3
NEEDRESTART-SVC: nginx.service
NEEDRESTART-SVC: php8.3-fpm.service

KSTA: 2 or KSTA: 3 means a newer kernel is installed than the one running (3: a new version, 2: a compatible rebuild): the server needs a reboot. 1 means the running kernel is current, 0 that needrestart could not tell. The SVC lines are services to restart. The older tool checkrestart from debian-goodies does the same job with less detail. On the RHEL family, needs-restarting comes with dnf-utils: needs-restarting -r says whether a reboot is required ("Reboot should not be necessary" when not) and needs-restarting -s lists services.

The kernel is the one component a restart of services cannot fix. A kernel CVE stays open until the machine has booted the new kernel.

Common mistakes

  • Comparing upstream versions. Tools that only know upstream releases produce long lists of CVEs that the distribution has long since fixed. Use distribution data.
  • Wrong release. debsecan without --suite, or OVAL data for another Ubuntu release, gives answers for a system you do not have.
  • Third-party repositories. Packages from a vendor repository or a PPA are not covered by the distribution's data. They need the vendor's advisories.
  • Software outside the package manager. A CMS in the web root, a binary in /opt or a container image is invisible to all of the tools above.
  • No restart, no reboot. The scan is clean, but the old code is still running.
  • One-off scans. New CVEs are published every day. A clean result from last month says nothing about today.

Checklist

  1. Use your distribution's data: debsecan, pro, OVAL or dnf updateinfo.
  2. Always state the release codename where the tool asks for it.
  3. List third-party repositories and software installed outside the package manager separately.
  4. Fix first what is reachable from the outside and has a fix available.
  5. Restart affected services; reboot after kernel updates.
  6. Run the check regularly – daily is a good rhythm – not only after an announcement.

How Lynx Heartbeat helps

The Lynx Heartbeat agent reports the installed packages of each server, and once a night they are matched against public vulnerability databases and the security notices of the distribution. A finding is rated critical only when the affected service is measurably reachable from the outside, so the list starts with what matters; software at its end of life is listed as well, and pending security updates and a required restart appear in the facts of each server. Lynx does not install updates – patching stays your decision – and the agent currently runs on Ubuntu, so the Debian and RHEL commands above remain your tools there. What the agent sends for this is described on the security page, and the findings on the page Security findings.

Frequently asked questions

How do I check which CVEs affect my Debian server?

Install debsecan and run debsecan --suite followed by your release codename, for example bookworm, together with --only-fixed. It lists the CVEs that affect installed packages and for which Debian already ships a fix. Without the suite it compares against the wrong release.

How do I check a single CVE on Ubuntu?

Run pro fix with the CVE number, first with --dry-run. The Ubuntu Pro client tells you whether an installed package is affected, whether the fix is in the standard updates or only in Expanded Security Maintenance, and installs it when you run it without --dry-run.

Why does a scanner report a CVE although my package is patched?

Usually because it compares upstream version numbers. Distributions backport security fixes into the version they ship, so openssl 3.0.13 from Ubuntu can contain fixes that upstream released in a later 3.0 version. Only the distribution's own security data knows which package revision contains the fix.

Is installing the update enough to close a CVE?

No. Running processes keep the old library in memory until they are restarted, and a new kernel only takes effect after a reboot. needrestart on Debian and Ubuntu, and needs-restarting on the RHEL family, show what still runs old code.

Security

Related articles

All articles