From: Ian Bridges <icb@fastmail.org>
To: linkinjeon@kernel.org
Cc: senozhatsky@chromium.org, tom@talpey.com,
chenxiaosong@chenxiaosong.com, linux-cifs@vger.kernel.org,
linux-kernel@vger.kernel.org, Ian Bridges <icb@fastmail.org>,
stable@vger.kernel.org
Subject: [PATCH] ksmbd: reject a security descriptor with OffsetDacl but no DACL_PRESENT
Date: Sun, 22 Nov 2026 09:56:04 -0600 [thread overview]
Message-ID: <20261122155604.401963-1-icb@fastmail.org> (raw)
parse_sec_desc() returns early when DACL_PRESENT is clear and checks
nothing else in the descriptor. set_info_sec() then removes the POSIX
ACLs and stores the descriptor as sent, OffsetDacl included. The
access check, inheritance and QUERY use the DACL at OffsetDacl without
looking at DACL_PRESENT. A SET_INFO without the flag can therefore
store a DACL that was never checked or mapped to the mode, and that
DACL is enforced.
A descriptor without DACL_PRESENT has no DACL, so its OffsetDacl must
be zero. Reject a nonzero OffsetDacl in that case with -EINVAL, as
parse_sec_desc() does for other malformed descriptors.
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Bridges <icb@fastmail.org>
---
Tested on ksmbd-for-next 89d5e8fdd5a7 with KASAN. A SET_INFO with
DACL_PRESENT clear and a nonzero OffsetDacl now fails with
STATUS_INVALID_PARAMETER, and the file keeps its previous descriptor
and POSIX ACL. Before, the DACL was stored without checks, the POSIX
ACL was removed, and a deny ACE in the DACL was enforced. A CREATE
whose security descriptor context has this form now fails the same way
after the file is created, as a CREATE with another malformed context
does. Descriptors with DACL_PRESENT set, owner and group changes from
smbcacls and the Linux cifs client, and smbtorture give the same
results as the base.
This patch was developed with LLM assistance.
fs/smb/server/smbacl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c
index 7bb28ea195c8..446b4f69d7c4 100644
--- a/fs/smb/server/smbacl.c
+++ b/fs/smb/server/smbacl.c
@@ -963,6 +963,9 @@ int parse_sec_desc(const struct mnt_idmap *idmap, struct smb_ntsd *pntsd,
pntsd_type = le16_to_cpu(pntsd->type);
if (!(pntsd_type & DACL_PRESENT)) {
ksmbd_debug(SMB, "DACL_PRESENT in DACL type is not set\n");
+ /* Without DACL_PRESENT, OffsetDacl must be 0 (MS-DTYP 2.4.6) */
+ if (dacloffset)
+ return -EINVAL;
return rc;
}
--
2.47.3
reply other threads:[~2026-11-22 15:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261122155604.401963-1-icb@fastmail.org \
--to=icb@fastmail.org \
--cc=chenxiaosong@chenxiaosong.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=stable@vger.kernel.org \
--cc=tom@talpey.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