From: Abdifatah Suruur <suruurism@gmail.com>
To: Steve French <smfrench@gmail.com>
Cc: linux-cifs@vger.kernel.org,
Abdifatah Suruur <suruurism@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH] smb: client: reject oversized SMB1 SET_SECURITY_DESC data
Date: Wed, 18 Nov 2026 15:52:49 +0300 [thread overview]
Message-ID: <20261118125249.25375-1-suruurism@gmail.com> (raw)
CIFSSMBSetCIFSACL() copies acllen bytes into the single cifs_buf_get()
request buffer at data_offset without checking that the data fits. The
buffer is CIFSMaxBufSize + MAX_SMB2_HDR_SIZE bytes, while acllen comes
from the rewritten security descriptor produced by id_mode_to_cifs_acl().
A malicious server can return a descriptor whose rewritten ACL is larger
than the buffer, so a chmod()/chown() on a cifsacl mount over SMB1 writes
past the cifs_request object.
Reject data that cannot fit before the memcpy(), as the SMB2 path now does.
This is the legacy SMB1 counterpart of the SMB2_set_info_init() bound
check: both paths copy a rewritten security descriptor into a
cifs_buf_get() request object without a size limit.
Fixes: f5065508897a ("cifs: Retain old ACEs when converting between mode bits and ACL.")
Cc: stable@vger.kernel.org
Signed-off-by: Abdifatah Suruur <suruurism@gmail.com>
---
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index 2936b38de98f9..a5d02ed85877f 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -3961,6 +3961,12 @@ CIFSSMBSetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid,
data_offset = param_offset + param_count;
byte_count = 3 /* pad */ + param_count;
+ /* The single request buffer must hold the ACL after data_offset. */
+ if (acllen > CIFSMaxBufSize + MAX_SMB2_HDR_SIZE - data_offset) {
+ cifs_buf_release(pSMB);
+ return -EINVAL;
+ }
+
pSMB->DataCount = cpu_to_le32(data_count);
pSMB->TotalDataCount = pSMB->DataCount;
pSMB->MaxParameterCount = cpu_to_le32(4);
next reply other threads:[~2026-11-18 12:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 12:52 Abdifatah Suruur [this message]
2026-11-26 15:17 ` [PATCH] smb: client: reject oversized SMB1 SET_SECURITY_DESC data 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=20261118125249.25375-1-suruurism@gmail.com \
--to=suruurism@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=smfrench@gmail.com \
--cc=stable@vger.kernel.org \
/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