loopback
← All posts

Lab / Security / Packages / FreeBSD / Linux

arch-audit and pkg audit: Package Security Checks

By Loopback 5 min read

Flat monochrome illustration: arch Linux and FreeBSD logos beside arch-audit -c and pkg audit -F commands and a package inventory.

arch-audit and FreeBSD's pkg audit compare installed packages with records of known vulnerabilities. They help identify software that needs attention and point you toward the relevant advisories. FreeBSD calls the command pkg audit, rather than pkg vulns.

An audit does not install fixes. The useful sequence is to check the inventory, read each finding, update through the operating system's package manager and run the check again. You also need to know what the tool's database covers. Vulnerabilities in the package manager itself need attention too, as the APT verification flaw illustrates.

Arch Linux: check the tracker before trusting the result

The Arch Security Team wiki page, checked on November 5, 2026, warns that the tracker is not currently updated. Even a successful download may contain outdated records.

Use arch-audit as one source of findings, alongside upstream security notices and Arch news. A blank result cannot certify that your packages are safe. The same caution applies to an old finding whose status no longer reflects the installed software.

On Arch Linux, install the tool during a full system upgrade:

Arch shell · install during a full upgrade
sudo pacman -Syu arch-audit

This command changes installed packages. Read pending Arch news, have a current backup and review pacman's proposed transaction before confirming. Arch's maintenance guide explains why partial upgrades are unsupported. Avoid refreshing repository databases with pacman -Sy and then selectively updating packages.

Run the audit as your normal user:

Arch shell · audit installed packages
arch-audit -c

The tool reads pacman's installed-package database and, by default, retrieves the Arch security tracker feed. The -c option adds CVE identifiers. Open the linked vulnerability group, compare affected and fixed versions, and check the upstream advisory before deciding what action to take.

To filter for recorded fixes or inspect dependent packages:

Arch shell · filtered and dependency views
arch-audit -u
arch-audit -r

The arch-audit manual defines -u as showing packages with recorded fixes. It filters the report, so an empty result can hide unresolved findings. Use the unfiltered audit first. The -r option lists packages that depend on vulnerable packages, helping you identify applications that may need attention after a library update.

For a package you are investigating, replace PACKAGE with its installed name:

Arch shell · inspect one package
pacman -Q PACKAGE

Treat reports on Arch derivatives cautiously because their package versions and patches can differ. These checks also do not establish the safety of AUR build scripts, manually installed applications or every bundled dependency. Check those software sources separately.

Apply Arch updates and rerun the audit

When a fix is available through your configured repositories, perform a normal full upgrade:

Arch shell · upgrade and audit again
sudo pacman -Syu
arch-audit -c

Review package-manager messages and configuration changes. Restart affected applications or services so they stop using old code. Follow the maintenance guidance on rebooting after kernel updates. If an upgrade breaks something, use your prepared recovery environment or known-good backup, then investigate the package transaction. Downgrading unrelated libraries can introduce further incompatibilities.

If a finding remains, compare the installed version, advisory status and upstream fix again. A persistent entry can mean the fix is unavailable, the tracker is stale or the affected software remains installed. Record which explanation you verified.

FreeBSD: fetch the vulnerability database with pkg audit

These examples assume pkg is installed. Run the FreeBSD maintenance commands from a root shell, obtained with su - or your configured privilege tool.

FreeBSD root shell · refresh and audit
pkg audit -F

According to pkg-audit(8), -F fetches the vulnerability database before checking installed packages. A local Ports tree is unnecessary. Running pkg audit without -F uses the local database, which may be stale or missing.

A finding identifies an affected package and provides an advisory reference. Read that entry's version ranges and impact. The FreeBSD security handbook describes the audit workflow. A network or certificate error means the refresh failed. It does not mean that the machine passed its audit.

To inspect a reported package, replace PACKAGE with its name:

FreeBSD shell · inspect one package
pkg info PACKAGE

Before upgrading, back up application configuration and important data. For a server, arrange console access and a recovery path. Preview the proposed package changes:

FreeBSD root shell · preview package changes
pkg upgrade -n

The upgrade manual specifies that -n does not upgrade packages, although repository catalogues can refresh. Check the proposed removals and dependency changes before running the real transaction:

FreeBSD root shell · upgrade and audit again
pkg upgrade
pkg audit -F

Restart affected services and verify that they work. If the repository has no fixed package yet, inspect the advisory's mitigation and consider disabling the exposed service until a fix arrives. FreeBSD's Quarterly branch receives security fixes. A finding alone is not a reason to switch branches or mix arbitrary packages from different repositories.

Flat monochrome illustration: freeBSD host containing three jails with separate package inventories under a magnifying glass.
Audit each jail’s installed packages as well as those on the host.

Audit jails separately and keep base updates in scope

A host's package inventory does not include every jail's installed applications. From the host, list running jails and select the one to audit:

FreeBSD host root shell · audit a running jail
jls
pkg -j web01 audit -F

Replace web01 with the actual running jail name. The global -j option goes before audit, as pkg(8) documents. The jail needs working networking to fetch the database. Repeat for each jail and apply updates through its normal management workflow.

Keep FreeBSD base-system maintenance separate from the ports audit. Kernel and base-userland advisories need the update procedure appropriate to your installation. A clean package report does not establish that the running kernel is patched. Our FreeBSD and Linux administration comparison explains the separate maintenance responsibilities.

Save results you can act on

Both tools support structured output. On Arch:

Arch shell · save JSON output
arch-audit --json > arch-audit.json

On FreeBSD, after refreshing the database with pkg audit -F:

FreeBSD root shell · save JSON output
pkg audit --raw=json > pkg-audit.json

Record the run time, tool version, findings and errors when scheduling checks. In our arch-audit 0.2.0 checks, the command returned exit status zero while reporting findings. Monitoring must inspect the report as well as whether the command completed.

For this guide, we checked audit commands on CachyOS with arch-audit 0.2.0 and FreeBSD 15.1-RELEASE-p6 with pkg 2.8.4. We reviewed installation, upgrade and jail examples against documentation but did not execute them. The FreeBSD fetch test used a temporary database without changing installed packages.

Sources