Hello Michael, Laurent,

I would like to add a data point to this bug and ask you to reconsider
the default.

The use of qemu-guest-agent has grown a lot. Management stacks (Apache
CloudStack, which I work on, among others) now rely on it for IP
reporting, boot readiness and quiesced snapshots, and migration guides
tell users to install it. So many Debian and Ubuntu guests that never
ran the agent are getting it now, with the package default.

That default enables every command, including guest-exec,
guest-file-open/read/write and guest-set-user-password: the service
runs /usr/sbin/qemu-ga with no arguments and the package ships no
/etc/qemu/qemu-ga.conf. RHEL 9/10 and rebuilds ship an --allow-rpcs
list that leaves out guest-exec* and guest-file-*:
https://www.google.com/url?q=https://git.almalinux.org/rpms/qemu-kvm/src/branch/c9s/qemu-ga.sysconfig&source=gmail&ust=1795889092899000&sa=E

On "protecting a guest from the host is futile": that is true against
a determined host admin, but it does not cover two common cases:

1. Stolen operator credentials or a compromised management service.
Reading RAM or editing an offline disk takes deliberate,
specialised work. guest-exec is one JSON line giving a root shell
that looks like normal management traffic. Least privilege still
limits the damage there. It also undoes in-guest disk encryption
(LUKS) for a running VM: the host can read the decrypted files
through the agent.

2. Confidential guests (SEV-SNP / TDX). There the host is not
trusted, and an agent with everything enabled cancels the
protection. The same Debian image is increasingly used in both
kinds of VM.

I raised this upstream on qemu-devel this week. Daniel Berrange
replied that, on balance, arbitrary exec, arbitrary file read/write
and password/SSH-key injection should be off by default, that
confidential guests must be locked down out of the box, and that he
is considering a new version of his 2024 series ("Improve mechanism
for configuring allowed commands"):
https://www.google.com/url?q=https://patchwork.kernel.org/project/qemu-devel/cover/[email protected]/&source=gmail&ust=1795889092899000&sa=E

Until that lands upstream, suggestions from smallest to largest change:

a) Ship a commented /etc/qemu/qemu-ga.conf that documents allow-rpcs
and block-rpcs, plus a NEWS or README.Debian note, so admins know
the knob exists.
b) Ship that file with an allow list that leaves out guest-exec*,
guest-file-*, guest-set-user-password and guest-ssh-* (close to
the long-standing RHEL policy). IP reporting, fsfreeze snapshots
and shutdown keep working; only features that run commands or
copy files inside the guest through the agent would need an
explicit opt-in.
c) Follow upstream once the new defaults are merged.

Even (a) alone would help a lot. I am happy to test any change on real
guests against libvirt and Apache CloudStack.

Thanks for maintaining qemu in Debian.

Andrija Panic

Reply via email to