REDHAT-BUG-2531811: Medium severity libvirt libvirt vulnerability

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

Affected Software

1 affected component
libvirt libvirt

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade libvirt to a version that resolves this vulnerability.

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

    Ensure the swtpm user cannot write to the libvirt/QEMU TPM emulator log directory (or make the logfile path non-writable for swtpm) to prevent swtpm from replacing the logfile with a symlink.

Event History

Sep 11, 2026
Data Sourced
via Red Hat·09:45 AM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

Who can exploit this issue?

A local attacker needs access to the swtpm account and the ability to write in the swtpm log directory. Remote access alone is not described as sufficient.

2

What event triggers the vulnerable ownership change?

The issue is triggered when libvirtd, running as root, starts a QEMU domain configured with an emulated TPM. The attacker must replace the expected swtpm logfile with a symbolic link before that operation.

3

What is the impact of successful exploitation?

libvirtd can change ownership of the symlink target to swtpm:swtpm. The attacker can then modify that target file using the swtpm account.

4

What mitigation is indicated if an update cannot be applied immediately?

Restrict access to the swtpm account and prevent untrusted users from writing to the swtpm log directory. Avoid starting QEMU domains with emulated TPMs where those controls cannot be assured.

5

How can this behavior be remediated in the code?

The upstream fix opens the logfile with O_NOFOLLOW and performs fchown() on the resulting file descriptor, rather than using path-based chown().

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