Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Maximilian Heyne <mheyne@amazon.de>
To: Paulo Alcantara <pc@manguebit.com>
Cc: <smfrench@gmail.com>, <linux-cifs@vger.kernel.org>,
	<j51569436@gmail.com>
Subject: Re: [PATCH 2/2] smb: client: fix potential OOB in smb2_dump_detail()
Date: Tue, 19 Dec 2023 14:34:12 +0000	[thread overview]
Message-ID: <ZYGp5FL9UYY5lYHg@amazon.de> (raw)
In-Reply-To: <20231216041005.7948-2-pc@manguebit.com>

On Sat, Dec 16, 2023 at 01:10:05AM -0300, Paulo Alcantara wrote:
> Validate SMB message with ->check_message() before calling
> ->calc_smb_size().
> 
> This fixes CVE-2023-6610.
> 
> Reported-by: j51569436@gmail.com
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218219
> Signed-off-by: Paulo Alcantara <pc@manguebit.com>
> ---
>  fs/smb/client/smb2ops.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
> index 62b0a8df867b..66b310208545 100644
> --- a/fs/smb/client/smb2ops.c
> +++ b/fs/smb/client/smb2ops.c
> @@ -403,8 +403,10 @@ smb2_dump_detail(void *buf, struct TCP_Server_Info *server)
>  	cifs_server_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d\n",
>  		 shdr->Command, shdr->Status, shdr->Flags, shdr->MessageId,
>  		 shdr->Id.SyncId.ProcessId);
> -	cifs_server_dbg(VFS, "smb buf %p len %u\n", buf,
> -		 server->ops->calc_smb_size(buf));
> +	if (!server->ops->check_message(buf, server->total_read, server)) {

Why is this check negated? Sorry for this stupid question. I'm not
familiar with this code but only stumbled upon this commit due to a CVE.

> +		cifs_server_dbg(VFS, "smb buf %p len %u\n", buf,
> +				server->ops->calc_smb_size(buf));
> +	}
>  #endif
>  }
>  
> -- 
> 2.43.0
> 



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879




  reply	other threads:[~2023-12-19 14:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16  4:10 [PATCH 1/2] smb: client: fix potential OOB in cifs_dump_detail() Paulo Alcantara
2023-12-16  4:10 ` [PATCH 2/2] smb: client: fix potential OOB in smb2_dump_detail() Paulo Alcantara
2023-12-19 14:34   ` Maximilian Heyne [this message]
2023-12-19 14:57     ` Paulo Alcantara
2023-12-19 16:10   ` [PATCH v2] " Paulo Alcantara

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=ZYGp5FL9UYY5lYHg@amazon.de \
    --to=mheyne@amazon.de \
    --cc=j51569436@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.com \
    --cc=smfrench@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox