Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Dairui Zhang <zhangdairui@gmail.com>
Cc: linux-cifs@vger.kernel.org, Namjae Jeon <linkinjeon@kernel.org>,
	Steve French <smfrench@gmail.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Tom Talpey <tom@talpey.com>, Paulo Alcantara <pc@manguebit.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] ksmbd: verify transform SessionId matches the decrypted header
Date: Mon, 28 Sep 2026 07:16:03 +0200	[thread overview]
Message-ID: <2026092848-retaining-unlaced-7767@gregkh> (raw)
In-Reply-To: <20260928031300.1782690-1-zhangdairui@gmail.com>

On Mon, Sep 28, 2026 at 11:13:00AM +0800, Dairui Zhang wrote:
> The decryption key for an encrypted request is selected by the
> SessionId in the encryption transform header, but the request is
> then authorized under the session named in the decrypted inner SMB2
> header. Nothing compares the two, so on a connection carrying more
> than one session a client can have a request decrypted with one
> session's key and executed under another session's identity. Since
> encrypted requests are also exempt from the signing requirement, the
> AEAD tag is the only proof of session identity, and it is checked
> against the wrong session.
> 
> Per MS-SMB2 the server must verify that the SessionId in the
> transform header matches the one in the decrypted SMB2 header and
> treat a mismatch as a protocol error. Validate the whole decrypted
> message before dispatching it: the message must be at least one
> fixed SMB2 header; the first operation must not set
> SMB2_FLAGS_RELATED_OPERATIONS and its SessionId must match the
> transform SessionId; each subsequent operation in a compound chain
> must either set SMB2_FLAGS_RELATED_OPERATIONS or carry the same
> SessionId; and NextCommand offsets must be 8-byte aligned and within
> the message. When the encrypted payload is a compression transform,
> the transform SessionId is saved during decryption and the same
> validation runs on the decompressed message. (The 8-byte alignment
> of compound responses is already handled by the existing
> chained-response padding.)
> 
> Reported-by: Dairui Zhang <zhangdairui@gmail.com>
> Assisted-by: LLM
> Cc: stable@vger.kernel.org
> Signed-off-by: Dairui Zhang <zhangdairui@gmail.com>
> ---
> v2 -> v3:
> - Per review, extend the check to the whole decrypted message before
>   dispatch: first-op size/RELATED_OPERATIONS/SessionId rules and
>   per-op compound-chain SessionId and NextCommand validation, shared
>   between the plain and compression paths via a common helper.

The "v3" isn't up in the Subject line for some reason :(

  reply	other threads:[~2026-09-28  5:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  3:13 [PATCH] ksmbd: verify transform SessionId matches the decrypted header Dairui Zhang
2026-09-28  5:16 ` Greg KH [this message]
2026-09-28  5:17 ` Dairui Zhang
2026-09-28  5:17 ` [PATCH v3] " Dairui Zhang
2026-09-28 13:39   ` Namjae Jeon
2026-09-28 16:20 ` [PATCH] " Dairui Zhang
2026-09-29  1:32   ` Namjae Jeon
  -- strict thread matches above, loose matches on Subject: below --
2026-09-27  6:16 Dairui Zhang
2026-09-27 22:43 ` Namjae Jeon
2026-09-26  8:02 Dairui Zhang
2026-09-27  1:32 ` Namjae Jeon

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=2026092848-retaining-unlaced-7767@gregkh \
    --to=greg@kroah.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=tom@talpey.com \
    --cc=zhangdairui@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