diff options
| author | Suyuan Wang <stevewong@hust.edu.cn> | 2026-11-16 04:06:23 +0000 |
|---|---|---|
| committer | Paulo Alcantara <pc@manguebit.org> | 2026-11-18 16:45:38 -0300 |
| commit | 2a5bd7a2bbb787483cd69ecf099e2b591e3633b2 (patch) | |
| tree | bf6906e902ae062b18980124ddbf7bad0fe56cbb /tools | |
| parent | 8b456f136a76a29fee8d36934740cb7f7fb5c837 (diff) | |
smb: client: fail SMB2 responses with a bad signature
smb2_check_receive() checks the response signature when signing is on,
but a failed check is only logged:
rc = smb2_verify_signature(&rqst, server);
if (rc)
cifs_server_dbg(VFS, "SMB signature verification returned ...",
rc);
...
return map_smb2_to_linux_error(mid->resp_buf, log_error);
The status from the response is returned as usual, and the caller goes
on to use a response whose signature is wrong. This is the path for
synchronous and compound requests and for smb2_writev_callback(). On a
signed but unencrypted connection, anyone who can modify the traffic
can change e.g. a directory listing or file attributes, and the client
accepts it.
Return the verification error instead. That alone is not enough for
compound_send_recv(), which still hands the response buffer to the
caller after check_receive() fails. smb2_compound_op() then maps the
status from that buffer again and copies the payload out, and other
callers look at the buffer on error too, e.g. smb2_open_file() parses
a symlink target out of a STATUS_STOPPED_ON_SYMLINK response. So also
mark the mid MID_RESPONSE_MALFORMED, and have compound_send_recv() handle
it like a mid in a bad state: mark the earlier mids cancelled, so that a
CREATE which did succeed gets its handle closed, and don't pass any
response on.
Unlike the SMB1 fix in commit dc96f01d54cc ("smb: client: terminate
session upon failed client required signing"), don't reconnect: this
runs in the thread that sent the request, and only cifsd should call
cifs_reconnect(). And fail the request whichever side required signing,
since a response with a bad signature can't be trusted either way.
Found with a static analysis tool and checked by hand.
Reported-by: Daniel Birtwhistle <daniel.birtwhistle@gehealthcare.com>
Closes: https://lore.kernel.org/linux-cifs/SN4PR22MB28883DAF57E0B4D4BFB1C22AEEC42@SN4PR22MB2888.namprd22.prod.outlook.com/
Fixes: 3c1bf7e48e9e ("CIFS: Enable signing in SMB2")
Cc: stable@vger.kernel.org
Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
Signed-off-by: Paulo Alcantara <pc@manguebit.org>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions
