
Technical writeup of CVE-2026-12080: local privilege escalation in the QEMU Guest Agent (qga) guest-ssh-add-authorized-keys handler via symlink following.
guest-ssh-add-authorized-keys local privilege escalationLocal privilege escalation in the QEMU Guest Agent (qga) via symlink following in the guest-ssh-add-authorized-keys command handler. An unprivileged user inside the guest pre-stages a symlink in a target account's ~/.ssh, and the agent, running as root, follows it while creating and chowning authorized_keys, handing ownership of a root-controlled path to the unprivileged user.
This is a writeup of a vulnerability I reported and which was assigned CVE-2026-12080 by Red Hat Product Security (the CNA). It is published here as a technical record. The issue belongs to the same symlink-following authorized_keys class as a number of sibling findings in other agents; it is reported as that accepted class in a handler it had not yet been fixed in, not as a novel root cause.
The fix carries
Reported-by: Valentino PaulonandFixes: CVE-2026-12080.
| CVE | CVE-2026-12080 |
| Component | QEMU qga/commands-posix-ssh.c, guest-ssh-add-authorized-keys handler (and the sibling remove/get handlers) |
| Type | Elevation of Privilege (local). CWE-59 / CWE-61 (link following) with improper ownership management |
| CVSS | 7.3 (High) — CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H |
| Public | 2026-07-20 |
| Reported by | Valentino Paulon |
The guest agent exposes guest-ssh-add-authorized-keys, which writes a target user's ~/.ssh/authorized_keys. The handler builds the .ssh directory and the authorized_keys path from the target user's passwd home and then operates on those paths by name, as root, with no privilege drop:
chown that follows symlinks.Because no seteuid/setegid drop is performed and the operations are name-based rather than performed relative to a safely-opened, symlink-refusing descriptor, an unprivileged user who controls the target home can redirect the agent's privileged create/chown onto a root-controlled path. Both exploitation variants below were reproduced end to end against qga 6.2.0 with the command enabled in its default configuration.
Both confirmed end to end on a throwaway VM. victim is an unprivileged local user; the agent runs as root and the command is triggered exactly as a host operator would trigger it. Canaries stand in for sensitive root targets.
Variant A — deterministic directory-symlink bypass. The unprivileged user replaces (or pre-creates) ~/.ssh as a symlink to an existing root-owned directory. When the handler creates/chowns along that path, the root-owned directory's ownership is transferred to the unprivileged user. Deterministic, no race.
Variant B — TOCTOU file-symlink race. With ~/.ssh a normal directory, the user wins a rename-then-symlink race in the window between the handler's check and its create/chown of authorized_keys, so a new root-path file is created and chowned to the user. Reproduced by winning the race on a second iteration.
In both cases the unprivileged user ends up owning a root-controlled path and escalates by the standard follow-on (for example a new file under /etc/cron.d or /etc/sudoers.d, or ownership of a directory under /etc), where the user, now the owner, rewrites the target.
The three guest-ssh-*-authorized-keys handlers performed their filesystem work as root, on attacker-reachable paths, by name:
~/.ssh without refusing a pre-existing symlink (no O_NOFOLLOW/O_EXCL open operated on through the resulting descriptor);chown rather than lchown/fchown on a safely-opened descriptor;The check-and-then-act structure on a name additionally left a TOCTOU window (Variant B) even where a single operation looked guarded.
The accepted fix changes the privilege model of all three handlers rather than patching one call site. A helper (set_privileges_to_user(), with an EffectiveUserInfo carrier using g_auto cleanup) drops the effective GID and UID to the target user — initgroups + setegid + seteuid, in that order — before any filesystem I/O on ~/.ssh, and restores them automatically on every exit path through the auto-cleanup, so the early-return paths in remove/get cannot leave the daemon running as the wrong user. The restore asserts success (seteuid/setegid back to root), aborting — and letting the service manager restart the agent — if it ever failed. With the effective identity dropped before the I/O, both variants fail closed: the create hits EACCES and the chown hits EPERM as the unprivileged user. The fix was merged upstream and backported to the stable branches 10.0.14, 11.0.5 and 11.1.2.
guest-ssh-add-authorized-keys command being invoked for the victim's account by the host/operator (the normal use of the command). The unprivileged user only pre-stages the symlink in a home they already control; they do not trigger the command themselves. This is the operator/host-trusted trigger model, reflected in the CVSS UI:R, and it is stated explicitly rather than rated as self-triggered. The upstream maintainers were appropriately cautious about real-world exploitability for exactly this reason; the precondition is not overstated here.| Date | Event |
|---|---|
| 2026-06-07 | Reported to [email protected], with both variants reproduced end to end on qga 6.2.0 |
| 2026-06-12 | CVE-2026-12080 assigned by Red Hat Product Security; the qga maintainer confirmed the issue |
| 2026-07-20 | CVE-2026-12080 published |
| 2026-09 | Fix merged upstream and backported to stable 10.0.14 / 11.0.5 / 11.1.2 |
MIT. See LICENSE.