CVE-2026-16118: xdgmime heap buffer overflow in _xdg_mime_magic_parse_magic_line

CVE-2026-16118 · Severity: high · CVSS 7.1 · Published 2026-07-17

A vulnerability exists in xdgmime, a library used by many Linux applications to identify file types. By tricking a user into placing a specially crafted file in certain system folders, an attacker can cause applications to crash or potentially corrupt system memory. This affects the stability and security of desktop environments and applications that handle file uploads or downloads.

Vendors: Freedesktop.Org, Red Hat.

Quick answers

Is CVE-2026-16118 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-16118 being exploited in the wild.
How severe is CVE-2026-16118?
High severity, with a CVSS score of 7.1, published 17 July 2026.
Which products and versions are affected?
Red Hat Glib2 Enterprise Linux 9, 10; Red Hat Webkit2gtk3 Enterprise Linux 8, 9; Red Hat Webkitgtk4 Enterprise Linux 7.
Is there a fix for CVE-2026-16118?
No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.
How is CVE-2026-16118 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2026-16118?
Check whether you run Freedesktop.Org Xdgmime, Red Hat Glib2, Red Hat Webkit2gtk3 or one of the others listed at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

A heap-based buffer overflow exists in the _xdg_mime_magic_parse_magic_line() function within xdgmimemagic.c. The flaw is caused by incorrect pointer arithmetic during byte-swapping operations on little-endian systems; specifically, the code uses element-based offsets instead of byte-based offsets when writing swapped values to the heap. An attacker can exploit this by placing a crafted MIME magic file in a user-writable XDG data location (e.g., $XDG_DATA_HOME/mime/magic). When a library like GLib (via g_content_type_guess()) parses this file, it triggers an out-of-bounds write of 2 or 4 bytes, leading to a crash or potential arbitrary code execution.

Affected products

  • freedesktop.org xdgmime
  • Red Hat glib2 Enterprise Linux 9, 10
  • Red Hat webkit2gtk3 Enterprise Linux 8, 9
  • Red Hat webkitgtk4 Enterprise Linux 7

Timeline

  • 2026-02-14: other: Reported to GNOME via YesWeHack
  • 2026-07-17: advisory: NVD and Red Hat published advisory details

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.