On this page (7 sections)

Ubuntu has published security notice USN-9012-1 for libheif, a library that reads and decodes HEIF images. According to the notice, the library incorrectly handled certain HEIF images, and an attacker could possibly use the issue to execute arbitrary code if a user or automated system were tricked into opening a specially crafted file.

If you run Ubuntu servers or workstations that process uploaded images, generate thumbnails, or convert photos, this is worth a quick look. The notice is short, and much of the detail you would normally want is not in the material we have, so this article is clear about what is confirmed and what is not.

What the notice says

Ubuntu credits Alex Thomas with discovering that libheif incorrectly handled certain HEIF images. The stated consequence is that an attacker could possibly execute arbitrary code, and only if a user or an automated system were tricked into opening a specially crafted file. The word "possibly" matters: Ubuntu does not describe a confirmed, reliable exploit.

Only one independent publisher, Ubuntu itself, covers this story so far. The text we reviewed does not list CVE identifiers, CVSS scores, affected Ubuntu releases, or fixed package versions. Check the full notice for those details before you plan your rollout, and do not assume a particular version is or is not affected until you have confirmed it there.

Why image libraries are a common risk

Image decoders parse complex, attacker-controlled file formats, often in native code. When a parser mishandles an unexpected structure in a file, the result can range from a crash to memory corruption. Ubuntu's description, incorrect handling of certain images leading to possible code execution, fits that general class of problem, but the notice text we have does not name the exact bug type, so we will not guess at it.

What makes this relevant for website owners is the phrase "automated system". A server that automatically opens images, for example to resize avatars, build thumbnails, convert phone photos to JPEG, or scan attachments, can be the one that is tricked into opening the file, with no human clicking anything.

Who is realistically exposed

  • Ubuntu servers running web applications that accept image uploads and process them with software that uses libheif (directly or through another library or tool).
  • Image conversion or thumbnailing pipelines, media libraries, and content management systems that handle HEIC photos from phones.
  • Ubuntu desktops and developer machines where users open images from untrusted sources.
  • Container images built on Ubuntu that include libheif and are used to process user files.

Systems that never decode HEIF images are much less likely to be affected in practice, although the package may still be installed. We cannot say from the notice which applications link against libheif on your systems, so check rather than assume.

How to check your exposure

The first command lists installed packages whose names contain libheif and shows their versions. Run it on each Ubuntu host. Compare the version you see with the fixed version listed in the full notice.

List installed libheif packages and versions (Debian/Ubuntu)Shell
dpkg -l | grep -i libheif

The next command shows which Ubuntu release you are on, so you can match it to the release list in the notice.

Show the Ubuntu release (run on each host)Shell
lsb_release -a

To see whether an update is pending for the package, ask apt for the installed and candidate versions. If the candidate is newer than the installed version, an update is available from your configured repositories. The package name libheif1 is an example; use the name reported by the dpkg check.

Compare installed and candidate versions (Debian/Ubuntu; example package libheif1)Shell
apt-cache policy libheif1

Remember containers: each image built on Ubuntu carries its own copy of the packages, so rebuild or update those images too.

What to do now

  1. Read the full notice at ubuntu.com/security/notices/USN-9012-1 and note the affected releases and fixed package versions.
  2. Run the dpkg check above on servers, workstations, and build hosts to find where libheif is installed.
  3. Refresh package lists and install the updated libheif packages from the Ubuntu repositories.
  4. Restart long-running services that decode images (web application workers, queue consumers, thumbnailers) so they load the patched library.
  5. Rebuild and redeploy container images that include libheif.
  6. Until patched, avoid automatically processing HEIF files from untrusted sources on exposed systems where that is practical.
  7. Review which upload endpoints accept HEIF/HEIC files and confirm they are limited to the file types you actually need.

This pair of commands refreshes package metadata and upgrades only the named package. Replace the package name with the one reported on your system by the dpkg check.

Update a single package (Debian/Ubuntu; example package name libheif1)Shell
sudo apt-get update
sudo apt-get install --only-upgrade libheif1
Caution. Restarting services interrupts requests that are in flight. Do it in a maintenance window or one node at a time behind a load balancer. Package updates may also be held back by pinning or phased updates, so recheck the version afterwards.

After updating, run the version check again to confirm the new version is installed. Processes that were running before the update keep the old library in memory until they restart, so a restart is part of the fix, not an optional extra.

Detection and monitoring afterwards

The notice does not describe indicators of compromise, so there is no specific signature to search for. Reasonable general checks are to watch for crashes of image-processing workers, unexpected child processes spawned by web or thumbnailing services, and unusual outbound connections from servers that handle uploads.

The command below searches the system journal for recent segmentation fault messages, which can hint at a decoder crashing on malformed input. It is read-only. A hit is not proof of an attack, since crashes have many causes.

Search recent journal entries for segfaults (systemd-based Ubuntu)Shell
sudo journalctl --since "7 days ago" | grep -i segfault

For broader hygiene, keep automatic security updates enabled on servers where that fits your change process, and track Ubuntu security notices for the packages you rely on. If you want help spotting exposed services and outdated components from the outside, a Webforta Scan of a site you verify is read-only, though it cannot see which libraries are installed inside a server. For deeper background, see what outside-in malware detection can and cannot see.

What we do not know yet

  • No CVE identifier or CVSS score appears in the notice text we reviewed, so the severity is unrated here.
  • The affected Ubuntu releases and fixed versions are not reproduced here; take them from the full notice.
  • The notice does not say whether the issue is being exploited.
  • The exact weakness type is not named in the text we reviewed.

We will treat this as a patch-soon item rather than an emergency unless more information appears. If you handle untrusted HEIF files automatically, move it up your list. For general guidance on keeping servers and sites patched, see small business website security.

Sources

This article is based on the public sources below. Details can change as vendors and researchers publish more; check the original advisories before acting on version numbers.

  1. USN-9012-1: libheif vulnerabilityubuntu.com ·
  • Ubuntu
  • libheif
  • USN-9012-1
  • HEIF
  • patching