On Fri, Nov 13, 2026 at 04:34:51PM -0600, Eric Blake wrote:
> The NBD spec permits servers to send out-of-order replies for a
> structured read, which the client must re-assemble into the final
> buffer of its NBD_CMD_READ request. The standard states a server must
> send chunks covering the entire region, but leaves the burden on the
> client for double-checking whether a server actually sent sufficient
> reply chunks. If the client never checks for a server omitting chunks,
> or even sending multiple chunks that re-write the same portion of the
> buffer, then the NBD spec says behavior is unspecified.  But ever
> since we added structured reads to QEMU, the actual behavior is that
> we would end up silently leaking QEMU host heap contents into the
> guest's view, which the guest blindly assumes is legitimate data sent
> by the server.  A proof of concept reported by Feifan Qian with the
> help of AI analysis demonstrated the ability to leak 0xa5 bytes from a
> qemu process with MALLOC_PERTURB_=165, which implies a malicious
> server can coerce QEMU into divulging other parts of its heap to a
> guest for exfiltration, where knowing unscrubbed heap contents may
> make further attacks against QEMU easier.
> 
> In terms of the security risk, a guest cannot detect when a server
> does a short reply, and may misbehave if successive reads of the same
> portion of the disk come back with different contents, based on
> changes to QEMU's heap between those reads, making it easy for an
> attacker to attempt to provoke a silent form of data corruption to
> guests, even though the server cannot control the actual sequence of
> guest reads or QEMU heap contents between those reads.  And although
> modern computing tends to isolate heap contents to prevent
> cross-process leaks, it is feasible that a determined attacker could
> try to set up a scenario in a multi-tenant environment where a guest
> under attacker control using a disk backed by an NBD server supplied
> by the attacker could then exfiltrate unrelated information learned
> from other guests on the same host.  As a mitigating factor, QEMU
> recommends that NBD client connections utilize TLS traffic and x509
> certificates to avoid connecting to untrusted NBD servers.  See also
> CVE-2022-0485 for a similar issue with clients being made more robust
> to a non-compliant server in libnbd.
> 
> It may be worth proposing a future enhancement to the NBD protocol to
> allow the client and server to negotiate an additional handshake
> guarantee that structured reads must occur in order (the client can
> detect a non-compliant server with less overhead, or even refuse to
> talk to a server that doesn't know the new protocol).  But for now,
> tracking the highwater mark of what has been covered in the buffer,
> even if portions of the buffer get covered more than once, was
> sufficient to guarantee that data left uninitialized by the server is
> at least deterministic of showing as all zero in the guest's view.
> 
> Reported-by: Feifan Qian <[email protected]>
> Fixes: CVE-2026-126657
> Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/3815
> Fixes: f140e300 ("nbd: Minimal structured read for client", v2.11.0)
> CC: [email protected]
> Signed-off-by: Eric Blake <[email protected]>
> ---
>  block/nbd.c | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <[email protected]>


Reply via email to