All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org, berrange@redhat.com,
	qemu-block@nongnu.org,  Feifan Qian <bea1e@proton.me>,
	Haotian Jiang <jianghaotian.sunday@gmail.com>,
	 Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Subject: Re: [PATCH v2 2/3] nbd/server: Reject rather than assert on non-compliant BLOCK_STATUS
Date: Mon, 9 Nov 2026 07:57:50 -0600	[thread overview]
Message-ID: <avHRM8Jaoa1Wd01b@redhat.com> (raw)
In-Reply-To: <20261107225834.778738-7-eblake@redhat.com>

On Sat, Nov 07, 2026 at 04:54:37PM -0600, Eric Blake wrote:
> The NBD spec is clear that a client must not send NBD_BLOCK_STATUS
> requests to a server if it did not negotiate any metacontexts with
> NBD_OPT_SET_META_CONTEXT.  However, if the non-compliant client uses
> NBD_OPT_EXTENDED_HEADERS and then passes in the relatively new
> NBD_CMD_FLAG_PAYLOAD_LEN flag alongside an inappropriate block status
> request, this was enough to trigger an assertion in qemu.
> 
> If you do not use recommended practice to prevent untrusted clients
> from connecting to QEMU's NBD server, then you are at risk of a denial
> of service attack from a rogue client.  Per our stated policy on flaws
> triggered by network connections, this is considered a low-severity
> security flaw, since it is trivial to avoid by using proper
> configuration of TLS and x509 certificate authorization to reject
> rogue clients; therefore, no CVE has been assigned yet.

CVE-2026-124559 has been assigned; I'll update the commit message
accordingly before the pull request, if no other changes in the series
are requested.

> 
> Fixes: 2dcbb11b ("nbd/server: Add FLAG_PAYLOAD support to CMD_BLOCK_STATUS", v8.2.0)
> Reported-by: Feifan Qian <bea1e@proton.me>
> Reported-by: https://gitlab.com/qemu-project/qemu/-/work_items/3796
> CC: Haotian Jiang <jianghaotian.sunday@gmail.com>
> CC: qemu-stable@nongnu.org
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  nbd/server.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/nbd/server.c b/nbd/server.c
> index e6c47f8c2e3..bc37cbcb338 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -2584,12 +2584,12 @@ nbd_co_block_status_payload_read(NBDClient *client, NBDRequest *request,
>          return -EINVAL;
>      }
> 
> -    assert(client->contexts.exp == client->exp);
>      nr_bitmaps = client->exp->nr_export_bitmaps;
>      request->contexts = g_new0(NBDMetaContexts, 1);
>      request->contexts->exp = client->exp;
> 
> -    if (payload_len % sizeof(uint32_t) ||
> +    if (!client->contexts.count ||
> +        payload_len % sizeof(uint32_t) ||
>          payload_len < sizeof(NBDBlockStatusPayload) ||
>          payload_len > (sizeof(NBDBlockStatusPayload) +
>                         sizeof(id) * client->contexts.count)) {
> -- 
> 2.56.0
> 
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org



  reply	other threads:[~2026-11-09 13:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 22:54 [PATCH for-11.2 v2 0/3] Avoid low-severity NBD denial-of-service attack Eric Blake
2026-11-07 22:54 ` [PATCH v2 1/3] docs: Mention security considerations for NBD Eric Blake
2026-11-09 15:58   ` Stefan Hajnoczi
2026-11-09 20:48     ` Eric Blake
2026-11-10  8:48       ` Daniel P. Berrangé
2026-11-07 22:54 ` [PATCH v2 2/3] nbd/server: Reject rather than assert on non-compliant BLOCK_STATUS Eric Blake
2026-11-09 13:57   ` Eric Blake [this message]
2026-11-09 15:45   ` Stefan Hajnoczi
2026-11-09 15:51   ` Stefan Hajnoczi
2026-11-07 22:54 ` [PATCH v2 3/3] iotests: Add new nbd-robustness test Eric Blake
2026-11-09 15:36   ` Stefan Hajnoczi
2026-11-09 16:06     ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avHRM8Jaoa1Wd01b@redhat.com \
    --to=eblake@redhat.com \
    --cc=bea1e@proton.me \
    --cc=berrange@redhat.com \
    --cc=jianghaotian.sunday@gmail.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.