CVE-2025-37947
High · 7.8CVSS
7.8
EPSS
0.7%
Published
May 20, 2025
CISA due date
—
Cloudanix analysis
A bug in the Linux kernel's handling of file streams could let someone already on the system overwrite memory and take full control of the machine.
- Exploitation
- Local Privilege
- Attacker needs
- Low Privilege
- Complexity
- Low
- Impact
- Full Compromise
- Component
- OS kernel
- Class
- Memory Corruption
- Remediation
- Patch
- Effort
- Low
- Patch risk
- Low
What it actually does
Missing bounds check in ksmbd_vfs_stream_write allows an attacker-supplied write offset (*pos) >= existing stream length (v_len) to perform an out-of-bounds kernel memory write.
Why it matters to the business
Local attackers on affected Ubuntu systems can escalate privileges to root, compromising the entire host and any workloads or data it serves; the large number of long-supported package variants increases the exposed fleet size.
How an attack unfolds
An attacker with local access crafts a malicious SMB stream write request that supplies an offset beyond the allocated stream buffer; the unchecked *pos value causes the kernel to write attacker-controlled data into adjacent memory, enabling privilege escalation. Similar Linux kernel privilege-escalation techniques used by actors targeting CVE-2025-37797 and CVE-2025-37890 can be adapted.
How to fix it
Upgrade to the listed fixed package versions: linux 3.11.0-12.19 (14.04), 4.4.0-2.16 (16.04), 4.13.0-16.19 (18.04), 5.4.0-9.12 (20.04) and the corresponding linux-aws, linux-azure, linux-gcp, linux-hwe, linux-kvm, linux-oracle builds; reboot after installation.
How to confirm the fix worked
Verify the running kernel package version matches or exceeds the fixed version for the distribution release; confirm ksmbd is either disabled or the updated module is loaded.
Typical attack path
- Obtain local shell on an affected Ubuntu system
- Mount or connect to a ksmbd share and issue a crafted stream write with oversized *pos
- Trigger the out-of-bounds write to corrupt kernel structures
- Escalate to root via the resulting memory corruption
- Install persistence or move laterally
How to detect it
Review kernel audit logs and SMB-related audit events for unusual stream-write operations; look for processes invoking ksmbd_vfs_stream_write or generating EINVAL returns on stream writes immediately preceding privilege-escalation indicators.
What your security team should do
- Prioritize patching of internet-facing or multi-tenant Ubuntu hosts running ksmbd
- Disable ksmbd where SMB server functionality is unnecessary
- Monitor for local privilege-escalation attempts on remaining unpatched systems
- Apply the exact fixed package versions listed for each Ubuntu release
The record
In the Linux kernel, the following vulnerability has been resolved: ksmbd: prevent out-of-bounds stream writes by validating *pos ksmbd_vfs_stream_write() did not validate whether the write offset (*pos) was within the bounds of the existing stream data length (v_len). If *pos was greater than or equal to v_len, this could lead to an out-of-bounds memory write. This patch adds a check to ensure *pos is less than v_len before proceeding. If the condition fails, -EINVAL is returned.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | linux-6.1 | 0 | 6.1.140-1~deb11u1 |
| Debian:12 | linux | 0 | 6.1.140-1 |
| Debian:13 | linux | 0 | No fix |
| Debian:13 | linux | 0 | 6.12.29-1 |
| Debian:14 | linux | 0 | 6.12.29-1 |
| Linux | Kernel | 5.15.0 | 6.1.139 |
| Mageia:9 | dwarves | 0 | 1.30-1.mga9 |
| Mageia:9 | kernel | 0 | 6.6.93-1.mga9 |
| Mageia:9 | kernel-firmware | 0 | 20250509-1.mga9 |
| Mageia:9 | kernel-firmware-nonfree | 0 | 20250509-1.mga9.nonfree |
| Mageia:9 | kernel-linus | 0 | 6.6.93-1.mga9 |
| Mageia:9 | kmod-virtualbox | 0 | 7.1.8-3.mga9 |
| Mageia:9 | kmod-xtables-addons | 0 | 3.24-80.mga9 |
| Mageia:9 | libtraceevent | 0 | 1.8.4-1.mga9 |
| Mageia:9 | libtracefs | 0 | 1.8.2-1.mga9 |
| Mageia:9 | radeon-firmware | 0 | 20250509-1.mga9.nonfree |
| Mageia:9 | wireless-regdb | 0 | 20250220-1.mga9 |
Related vulnerabilities
- CVE-2025-38177 In the Linux kernel, the following vulnerability has been resolved: sch_hfsc: make… Also affects linux-6.1
- CVE-2025-38095 In the Linux kernel, the following vulnerability has been resolved: dma-buf: insert… Also affects linux-6.1
- CVE-2025-38094 In the Linux kernel, the following vulnerability has been resolved: net: cadence: macb… Also affects linux-6.1
- CVE-2025-38023 In the Linux kernel, the following vulnerability has been resolved: nfs: handle failure… Also affects linux-6.1
- CVE-2025-38027 In the Linux kernel, the following vulnerability has been resolved: regulator: max20086… Also affects linux-6.1
- CVE-2025-38024 In the Linux kernel, the following vulnerability has been resolved: RDMA/rxe: Fix… Also affects linux-6.1
- CVE-2025-38015 In the Linux kernel, the following vulnerability has been resolved: dmaengine: idxd: fix… Also affects linux-6.1
- CVE-2025-38020 In the Linux kernel, the following vulnerability has been resolved: net/mlx5e: Disable… Also affects linux-6.1