CVE-2026-77159: Libvirt: unsafe chown in qemutpmemulatorpreparehost() allows arbitrary file ownership change via symlink

Published Sep 11, 2026
·
Updated

A symlink-following flaw was found in libvirt's qemuTPMEmulatorPrepareHost() function (src/qemu/qemutpm.c). The function uses a path-based chown() to set ownership of the swtpm logfile without verifying that the path is not a symbolic link. Since the log directory is writable by the swtpm user, a local attacker with access to the swtpm account can replace the logfile with a symlink pointing to an arbitrary file. When libvirtd (running as root) starts a QEMU domain with an emulated TPM, it follows the symlink and transfers ownership of the target file to swtpm:swtpm, allowing the attacker to then modify that file.

The upstream fix replaces the path-based chown() with open(ONOFOLLOW) + fchown() on the file descriptor.

External reference: https://gitlab.com/libvirt/libvirt/-/workitems/909

Other sources

A symlink-following flaw was found in libvirt's qemuTPMEmulatorPrepareHost() function. The function uses a path-based chown() on the swtpm logfile without checking for symbolic links. A local attacker with access to the swtpm account can replace the logfile with a symlink, causing libvirtd (running as root) to transfer ownership of an arbitrary file to the swtpm user.

MITRE

Affected Software

1 affected component
libvirt Project libvirt

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade libvirt to a version that resolves this vulnerability.

    Patch https://gitlab.com/libvirt/libvirt/-/work_items/909
  2. Compensating control

    Ensure the swtpm logfile path is not writable by the swtpm user (e.g., make the log directory non-writable) to prevent a symlink from being placed there that libvirtd would follow.

Event History

Sep 11, 2026
Data Sourced
via Red Hat·09:45 AM
DescriptionSeverityAffected Software
CVE Published
via MITRE·10:32 AM
Data Sourced
via MITRE·10:32 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Who can exploit this issue?

A local attacker needs access to the swtpm account and must be able to replace the swtpm logfile in its writable log directory with a symbolic link. Remote access alone is not described as sufficient.

2

What event triggers the unsafe ownership change?

The vulnerable path is triggered when libvirtd, running as root, starts a QEMU domain configured with an emulated TPM. It follows the attacker-controlled symlink and changes ownership of the target file to swtpm:swtpm.

3

What is the practical impact after exploitation?

The attacker can cause an arbitrary target file to become owned by swtpm:swtpm, then modify that file using the swtpm account. The stated impact is integrity loss; confidentiality and availability impacts are not listed.

4

What change addresses the flaw?

The upstream fix replaces path-based chown() with opening the file using O_NOFOLLOW and then applying fchown() to the resulting file descriptor. This prevents chown from following a symbolic link at the logfile path.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203