CVE-2025-37947: Out-of-Bounds Write in Linux ksmbd Kernel SMB Server Enables Local Privilege Escalation
CVE-2025-37947 (TL-2026-2477) is a high-severity software vulnerability scored CVSS 7.8, first published 2026-09-13. It has no confirmed attribution, affects Linux Kernel ksmbd (in-kernel SMB3 server, fs/ksmbd), references 1 CVE (CVE-2025-37947), maps to 8 MITRE ATT&CK techniques (T1059.004, T1078, T1106), and is covered by 9 detection rules and 13 indicators of compromise.
Key facts for TL-2026-2477
- Threat ID
- TL-2026-2477
- Severity
- HIGH
- CVSS
- 7.8 (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)
- Status
- ACTIVE
- Category
- VULNERABILITY
- First published
- 2026-09-13
- Last reviewed
- 2026-09-13
- Attribution confidence
- LOW
- Motivation
- UNKNOWN
- Detection rules
- 9
- Indicators of compromise
- 13
Malware and tooling in CVE-2025-37947
Malware and tooling: KSMBD-CVE-2025-37947, libsmb2, syzkaller (focus_areas)
CVE-2025-37947 is an out-of-bounds write (CWE-787) in ksmbd_vfs_stream_write() in the Linux kernel's in-kernel SMB3 server (fs/ksmbd/vfs.c), triggered when a write offset exceeds XATTR_SIZE_MAX on a share with the streams_xattr VFS module enabled. Doyensec researcher Norbert Szetei built a functional exploit chaining the OOB write with msg_msg heap grooming, sk_buff spraying, and a pipe_buffer use-after-free to defeat KASLR, SMAP, SMEP, and Ubuntu's HARDENED_USERCOPY hardening, achieving local kernel code execution and root privilege escalation on Ubuntu 22.04.5 LTS.
How CVE-2025-37947 works
The vulnerability lives in ksmbd_vfs_stream_write() (fs/ksmbd/vfs.c, introduced by commit 0626e6641f6b467447c81dd7678a69c66f7746cf). When a client writes to a named data stream (an extended-attribute-backed alternate data stream managed by the streams_xattr VFS module) and the requested write position/count exceeds XATTR_SIZE_MAX (65536 bytes / 16 pages), the function truncates the kvzalloc() allocation size to 0x10000 bytes but the subsequent memcpy(&stream_buf[*pos], buf, count) still uses the original, untruncated count and unchecked *pos, writing attacker-controlled data past the end of the allocated stream buffer into adjacent kernel heap memory. The upstream fix adds a bounds check ensuring *pos is less than the existing stream data length (v_len) before the write proceeds, returning -EINVAL otherwise.
Doyensec's part 3 writeup (following a two-part fuzzing series: part 1 used an extended syzkaller SMB2 grammar with patched auth bypass to find CVE-2024-50283/50285/50286, and part 2 added grammar-based SMB2 fuzzing, syzkaller focus_areas targeting of ksmbd functions such as smb_check_perm_dacl, and Wireshark-capture-derived corpus seeding to find 23 bugs across 22 CVEs including this one) turns the raw OOB write into full root code execution in five stages. Stage 1 (heap grooming): the exploit sprays 1024 msg_msg kernel objects (4096 bytes each, via msgget()/msgsnd()/msgctl() System V IPC syscalls) into the kmalloc-cg-4k slab cache to exhaust order-3/order-4 buddy-allocator freelists and force the allocator to split order-5 blocks, positioning the eventual kvzalloc(0x10000) stream_buf allocation adjacent to a victim msg_msg object. Stage 2 (UAF setup): the OOB write corrupts the 'next' pointer of an adjacent primary msg_msg structure, producing pointer aliasing between two primary messages and a shared secondary message; the exploit tags messages with queue indices and uses msgrcv(MSG_COPY) to non-destructively scan and identify the corrupted pair via mismatched tags, then frees the secondary message to create a genuine use-after-free. Stage 3 (info leak/SMAP bypass): UNIX-domain-socket sk_buff objects (via socket()/sendmsg()/recvmsg()) are sprayed to reclaim the freed slot with a crafted msg_msg carrying an inflated m_ts field; reading it back via copy_msg() returns excess data — a page-level rather than slab-level corruption that bypasses SMAP — leaking adjacent kernel heap pointers (mlist.next/mlist.prev), and a second sk_buff spray rebuilds the msg_msg's list pointers so it can be safely freed. Stage 4 (KASLR bypass): pipe_buffer objects are allocated over the freed UAF slot to leak the anon_pipe_buf_ops function pointer; the author's run computed kbase_addr ffffffffa2000000 with a kslide of 0x21000000 from that leak. Stage 5 (code execution): a third sk_buff spray forges a pipe_buf_operations structure whose release callback points into a ROP chain; closing the pipe triggers the callback, stack-pivots, and runs the ROP chain to gain arbitrary kernel code execution, confirmed in the writeup by `# id` returning `uid=0(root) gid=0(root) groups=0(root))`.
The author states the exploitation methodology for the msg_msg/UAF primitive (internally referred to in the writeup as the "writeleak" primitive for the information-disclosure step) is directly inspired by the public CVE-2021-22555 (Linux netfilter, exploited historically for a Chrome-sandbox-adjacent kernel escape) exploitation approach and corCTF 2021 msg_msg UAF techniques; Retbleed-style side-channel leaks were considered and explicitly rejected by the author as an alternative info-leak path. The exploit authenticates to the target ksmbd share using the libsmb2 open-source SMB2/3 client library, and during development the author used GDB breakpoints and the bundled eBPF tracer to confirm heap object addresses were properly page-aligned before finalizing the grooming parameters; all kernel structure/function offsets in the published exploit are hardcoded for the single tested build (Ubuntu 22.04.5 LTS, kernel 5.15.0-153-generic) rather than resolved dynamically, so the public PoC does not self-adapt to other kernel builds without offset changes. Development artifacts (documented in the doyensec/KSMBD-CVE-2025-37947 GitHub repository) include CVE-2025-37947.c (full exploit), proof-of-concept.c (minimal OOB-write trigger), bpf-tracer.sh (an eBPF msg_msg tracer used to validate heap-grooming/allocation state during development), ksmbd.conf (sample vulnerable share config enabling streams_xattr), a Makefile, and run-qemu.sh (launches a local Ubuntu 22.04.5 QEMU VM for testing, requiring a pre-built ubuntu-22.04.5.qcow2 image). The PoC is probabilistic (~90% success observed by the author), with the remaining ~10% of runs producing uncontrolled object overwrites or outright kernel panics rather than a clean root shell.
The same Doyensec ksmbd research series separately documents CVE-2025-22041, a double-free in ksmbd_free_user() in the ksmbd authentication/session-teardown path; the part-3 writeup references it as related prior work from the same fuzzing effort, though it is a distinct vulnerability from CVE-2025-37947 and is not itself the subject of this record.
Exploitation requires an authenticated local SMB user account with write access to a share that has the streams_xattr VFS module enabled, consistent with the CVSS 3.1 vector's Attack Vector: Local (AV:L) and Privileges Required: Low (PR:L) — this is a local privilege-escalation primitive, not a remote/unauthenticated attack against the SMB service itself. No public evidence of in-the-wild exploitation exists at the time of this writeup; the vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog as of the most recent KEV catalog additions reviewed. The affected code path spans multiple upstream kernel release lines and dozens of downstream distribution kernel packages (Ubuntu — including the 22.04 LTS jammy family and the 20.04 LTS focal HWE-5.15 kernel variants (linux-hwe-5.15, linux-aws-5.15, linux-azure-5.15, linux-gcp-5.15, linux-ibm-5.15, linux-intel-iotg-5.15, linux-lowlatency-hwe-5.15, linux-nvidia-tegra-5.15, linux-oracle-5.15, linux-riscv-5.15; base focal linux and 18.04 bionic and earlier are NOT affected — ksmbd was introduced later), Debian, and others), most of which had patches available within the same 2025 disclosure window.
MITRE ATT&CK techniques used in TL-2026-2477
Execution
T1059.004 Unix Shell; T1106 Native API
Initial Access
Impact
T1499.004 Application or System Exploitation
Resource Development
T1587.004 Exploits; T1588.005 Exploits; T1588.006 Vulnerabilities
Reconnaissance
Affected products and versions in CVE-2025-37947
- Linux Kernel — ksmbd (in-kernel SMB3 server, fs/ksmbd)
Vulnerable versions: >=5.15.0 <6.1.139; >=6.2.0 <6.6.91; >=6.7.0 <6.12.29; >=6.13.0 <6.14.7; 6.15-rc1
Fixed in: 6.1.139; 6.6.91; 6.12.29; 6.14.7 - Canonical — Ubuntu Linux kernel (22.04 LTS jammy and variants)
Vulnerable versions: 22.04 LTS kernel 5.15.0-153-generic and other jammy kernel flavors: linux, linux-kvm, linux-aws, linux-azure, linux-gcp, linux-gke, linux-ibm, linux-oracle, linux-raspi, linux-xilinx-zynqmp, linux-intel-iot-realtime, linux-nvidia, linux-nvidia-tegra
Fixed in: 24.04 LTS (noble) linux 6.8.0-100.100; 25.04 (plucky) linux 6.14.0-28.28 - Canonical — Ubuntu Linux kernel (20.04 LTS focal, HWE 5.15 kernel variants only)
Vulnerable versions: linux-hwe-5.15; linux-aws-5.15; linux-azure-5.15; linux-gcp-5.15; linux-ibm-5.15; linux-intel-iotg-5.15; linux-lowlatency-hwe-5.15; linux-nvidia-tegra-5.15; linux-oracle-5.15; linux-riscv-5.15
Fixed in: Ubuntu Priority: Medium; base 20.04 focal linux kernel and 18.04 bionic and earlier are NOT affected (ksmbd not present) - Debian — Debian Linux kernel (bookworm/11)
Vulnerable versions: prior to 6.1.140-1
Fixed in: 6.1.140-1
Remediation for CVE-2025-37947
Patches
- Upstream Linux kernel fix validating *pos against v_len in ksmbd_vfs_stream_write() (fs/ksmbd/vfs.c) before the memcpy, returning -EINVAL on violation
- Ubuntu 24.04 LTS (noble) linux 6.8.0-100.100
- Ubuntu 25.04 (plucky) linux 6.14.0-28.28
- Debian bookworm linux 6.1.140-1
Immediate actions
- Disable the ksmbd streams_xattr VFS module on any share where it is not explicitly required
- Restrict or remove write access to ksmbd-served SMB shares for untrusted or standard authenticated accounts
- Monitor kernel logs (dmesg, /var/log/kern.log) and KASAN/UBSAN traces for out-of-bounds write reports referencing ksmbd_vfs_stream_write or unexpected kernel panics on SMB write paths
- Watch for anomalous System V IPC / message-queue usage (large numbers of msgget/msgsnd calls, e.g. via auditd or eBPF) and unusual UNIX-domain-socket or pipe churn from SMB service or local user sessions, which are the concrete primitives this exploit relies on
Workarounds
- Disable the streams_xattr VFS module in ksmbd share configuration (ksmbd.conf)
- Revoke write permissions on ksmbd-served SMB shares for standard/untrusted user accounts until patched
Longer-term hardening
- Upgrade to a kernel containing the upstream fix (6.1.139, 6.6.91, 6.12.29, 6.14.7, or later)
- Apply distribution-specific patched kernel packages as they become available (e.g. Ubuntu 24.04 LTS 6.8.0-100.100, Ubuntu 25.04 6.14.0-28.28, Debian bookworm 6.1.140-1)
- Enforce least-privilege SMB account policies and avoid exposing ksmbd shares with stream/xattr features to untrusted authenticated users
- Keep KASLR, SMAP, SMEP, and HARDENED_USERCOPY enabled as defense-in-depth even though this exploit chain demonstrates they can be bypassed in combination with the underlying memory-safety bug
CVEs associated with CVE-2025-37947
CVE-2025-37947
Weaknesses (CWE) in CVE-2025-37947
CWE-787
Timeline of CVE-2025-37947
- Doyensec publishes part 1 of the ksmbd research series (extended syzkaller SMB2 grammar with authentication bypass), disclosing CVE-2024-50283, CVE-2024-50285, and CVE-2024-50286 but not yet CVE-2025-37947.
- CVE-2025-37947 is publicly assigned/published for the out-of-bounds write in ksmbd_vfs_stream_write().
- Doyensec publishes part 2 of the ksmbd research series, detailing a grammar-based SMB2 fuzzing harness with syzkaller focus_areas (e.g. smb_check_perm_dacl) and Wireshark-corpus seeding that uncovered 23 bugs across 22 CVEs, including CVE-2025-37947.
- The doyensec/KSMBD-CVE-2025-37947 GitHub repository is published, containing the exploit source (CVE-2025-37947.c), a minimal OOB-write trigger (proof-of-concept.c), an eBPF msg_msg tracer (bpf-tracer.sh), a sample vulnerable ksmbd.conf, and a QEMU test harness (run-qemu.sh) targeting Ubuntu 22.04.5 LTS.
- Doyensec researcher Norbert Szetei publishes part 3 of the series with a full technical writeup of a functional local privilege escalation exploit for CVE-2025-37947, chaining msg_msg heap grooming, a use-after-free, and KASLR/SMAP/SMEP/HARDENED_USERCOPY bypasses, crediting CVE-2021-22555 and corCTF 2021 msg_msg techniques as methodological inspiration.
- Security media outlets (e.g. CyberPress) report on the released proof-of-concept, noting no confirmed in-the-wild exploitation and urging prioritized patching.
Sources cited for CVE-2025-37947
- ksmbd - Exploiting CVE-2025-37947 (3/3)
- doyensec/KSMBD-CVE-2025-37947 exploit repository
- ksmbd - Fuzzing Improvements and Vulnerability Discovery (2/3)
- ksmbd - A Journey Into Kernel Exploitation (1/3)
- CVE-2025-37947 Detail
- CVE-2025-37947 | Ubuntu
- CVE-2025-37947: Linux Kernel Out-of-Bounds Write (CVSS 7.8)
- CVE-2025-37947 Impact, Exploitability, and Mitigation Steps
- CVE-2025-37947 OSV record
- Proof-of-Concept Released for Exploited Linux Kernel ksmbd Filesystem Vulnerability
More in vulnerability
- CVE-2025-59201: Windows Network Connection Status Indicator (NCSI) Elevation of Privilege via Registry Symbolic Link Abuse
- CVE-2026-20817: Windows Error Reporting Service (WerSvc.dll) Local Privilege Escalation via ALPC Argument Injection
- Sudo iptables NOPASSWD Misconfiguration Enables Local Privilege Escalation via Comment Injection
- Dell ObjectScale Critical Deserialization Flaw (CVE-2026-70416, CVSS 10.0) Enables Unauthenticated RCE
- CVE-2026-51990: One-Click RCE in Tencent Sogou Input Method Exploited by UNC3569 to Deploy GrayRabbit Malware
Detection coverage for TL-2026-2477
As of 2026-09-13, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-2477 across Splunk SPL, Microsoft KQL and Sigma, covering 13 indicator(s) of compromise. The whole corpus is readable without an account; a free account unlocks full detection query text in Splunk SPL, Microsoft KQL and Sigma; paid tiers add raw indicator values, correlation and the MCP server. Threadlinqs MCP server · View plans.