* [PATCH] smb: client: reject oversized SMB1 SET_SECURITY_DESC data
@ 2026-11-18 12:52 Abdifatah Suruur
2026-11-26 15:17 ` Paulo Alcantara
0 siblings, 1 reply; 2+ messages in thread
From: Abdifatah Suruur @ 2026-11-18 12:52 UTC (permalink / raw)
To: Steve French; +Cc: linux-cifs, Abdifatah Suruur, stable
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] smb: client: reject oversized SMB1 SET_SECURITY_DESC data
2026-11-18 12:52 [PATCH] smb: client: reject oversized SMB1 SET_SECURITY_DESC data Abdifatah Suruur
@ 2026-11-26 15:17 ` Paulo Alcantara
0 siblings, 0 replies; 2+ messages in thread
From: Paulo Alcantara @ 2026-11-26 15:17 UTC (permalink / raw)
To: Abdifatah Suruur, Steve French; +Cc: linux-cifs, Abdifatah Suruur, stable
Abdifatah Suruur <suruurism@gmail.com> writes:
> 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.
Please check sashiko's review
https://sashiko.dev/#/patchset/20261118125249.25375-1-suruurism%40gmail.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 15:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 12:52 [PATCH] smb: client: reject oversized SMB1 SET_SECURITY_DESC data Abdifatah Suruur
2026-11-26 15:17 ` Paulo Alcantara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox