mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] smb: client: don't use SMB2 responses that fail signature verification
@ 2026-11-16  4:06 Suyuan Wang via B4 Relay
  2026-11-16  4:06 ` [PATCH v2 1/2] smb: client: fail SMB2 responses with a bad signature Suyuan Wang via B4 Relay
  2026-11-16  4:06 ` [PATCH v2 2/2] smb: client: don't use read data that failed signature verification Suyuan Wang via B4 Relay
  0 siblings, 2 replies; 3+ messages in thread
From: Suyuan Wang via B4 Relay @ 2026-11-16  4:06 UTC (permalink / raw)
  To: linkinjeon, pc
  Cc: ematsumiya, sprasad, linux-cifs, bharathsm, ronniesahlberg,
	samba-technical, daniel.birtwhistle, linux-kernel, smfrench,
	dhowells, tom

v1 made smb2_check_receive() return the error when a response signature
doesn't verify. Sashiko pointed out that this isn't enough:
compound_send_recv() still passes the response buffer to the caller, and
smb2_compound_op() parses it anyway. It also found that
smb2_readv_callback() can drop the error when the read reaches EOF.

Patch 1 is v1 plus not passing the response on in compound_send_recv().
Patch 2 fixes the read path.

I tested this in QEMU (x86_64, next-20261109, PROVE_LOCKING on) against
Samba 4.15 with "server signing = mandatory", through a proxy that
changes responses without fixing the signature:

- EndOfFile in the QUERY_INFO response of the open/query/close compound
  (stat): with v1 the forged size is copied into the open info, and stat
  only shows the right size because the caller takes -EACCES for
  STATUS_ACCESS_DENIED and opens the file again. With v2 stat fails with
  EACCES.
- READ data, cache=none: without patch 2, cat prints the modified data.
  With it, the read fails with EACCES.
- A file name in QUERY_DIRECTORY (the v1 test): still EACCES, and the
  handle from the CREATE in that compound is closed ("Close unmatched
  open").
- Without the proxy, stat, read, write, ls and rm work as before.

Enzo's point about SMB 3.1.1 tree connect responses is not covered here,
that can be a follow-up.

Changes in v2:
- Patch 1: also don't hand the response to the caller in
  compound_send_recv() (Sashiko)
- Patch 2: new
- v1: https://lore.kernel.org/all/20261113-smb2-sign-v1-1-937ee7c20f08@gmail.com/

---
Suyuan Wang (2):
      smb: client: fail SMB2 responses with a bad signature
      smb: client: don't use read data that failed signature verification

 fs/smb/client/smb2pdu.c       | 2 ++
 fs/smb/client/smb2transport.c | 6 +++++-
 fs/smb/client/transport.c     | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-16  4:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16  4:06 [PATCH v2 0/2] smb: client: don't use SMB2 responses that fail signature verification Suyuan Wang via B4 Relay
2026-11-16  4:06 ` [PATCH v2 1/2] smb: client: fail SMB2 responses with a bad signature Suyuan Wang via B4 Relay
2026-11-16  4:06 ` [PATCH v2 2/2] smb: client: don't use read data that failed signature verification Suyuan Wang via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®