Skip to main content

Linux Kernel CVE-2025-40040

MEDIUM
2025-10-28 416baaa9-dc9f-4396-8d5f-8c081fb06d67
5.5
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Obtain local shell access
  2. Delivery
    Open userfaultfd fd with MINOR mode features
  3. Exploit
    Register target VMA with UFFD MINOR context
  4. Install
    Call madvise(MADV_UNMERGEABLE) on same VMA
  5. C2
    ksm_madvise() zero-extends ~VM_MERGEABLE, clears upper vm_flags
  6. Execute
    Close userfaultfd fd
  7. Impact
    userfaultfd_release_all() hits inconsistency, triggers kernel BUG/WARNING (DoS)

Vulnerability Assessment

Exploitation Conditions

Exploitation requires a local user with at least low-level process privileges (CVSS PR:L) able to invoke the userfaultfd() and madvise() system calls. Three specific conditions must hold simultaneously: (1) the kernel must include userfaultfd MINOR mode support (introduced in kernel 5.7+ for shmem, 5.13+ for anonymous mappings); (2) the calling process must be permitted to create a userfaultfd with UFFD_FEATURE_MINOR_ANON_RANGES - on many production distributions this requires either CAP_SYS_PTRACE or /proc/sys/vm/unprivileged_userfaultfd=1 (set to 0 by default on RHEL 9, Ubuntu 22.04+, and kernel 5.11+ hardened configurations); (3) the process must call madvise(MADV_UNMERGEABLE) on a VMA already registered with that UFFD context. Remote exploitation is not possible; local shell or code execution access is required. The bug is architecture-specific to 64-bit builds. Systems with unprivileged_userfaultfd=0 significantly limit the exploitable population to root and processes with CAP_SYS_PTRACE.

Impact

The NVD CVSS 5.5 vector (AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H) accurately captures the threat profile: local access required, low complexity, low privilege, availability-only impact. EPSS at 0.33% (26th percentile) is consistent with a kernel subsystem bug requiring a precise and non-obvious syscall sequence unlikely to be independently discovered and weaponized by opportunistic attackers in the near term. There is no CISA KEV listing and no public exploit code, so this should not be treated as an emergency for most environments. The realistic risk is elevated specifically for multi-tenant environments - container hosts, VPS providers, or systems where unprivileged users have shell access - where a motivated local attacker could induce a kernel crash. The softening of the kernel BUG() to a WARNING by commit 31defc3b01d9 reduces severity on newer kernel builds (6.16.0 and later incorporating that change), but the underlying flag-drop and UFFD inconsistency remain until the ksm_madvise() fix is applied. Patching priority is medium for general infrastructure and elevated for shared-access or container hosting environments.

Exploit ScenarioDerived

A local user with a standard shell account opens a userfaultfd file descriptor requesting UFFD_FEATURE_MINOR_ANON_RANGES support, registers a writable anonymous VMA for UFFD MINOR mode monitoring, then immediately calls madvise(MADV_UNMERGEABLE) on the same address range. The ksm_madvise() bug silently zeros the UFFD flags in vm_flags. When the user closes the userfaultfd fd, userfaultfd_release_all() iterates VMAs, finds the stale UFFD context pointer with no matching flags, and triggers a kernel BUG or WARNING - crashing or destabilizing the host kernel. No public exploit code is known; the sequence was discovered by the syzkaller automated kernel fuzzer.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 30, 2026

Kernel denial-of-service in the Linux mm/ksm subsystem allows a local low-privileged user to crash or destabilize the kernel by triggering a type-promotion bug in ksm_madvise(). When MADV_UNMERGEABLE is applied to a VMA registered with userfaultfd (UFFD) in MINOR mode, the function incorrectly clears the upper 32 bits of vma->vm_flags due to a C integer promotion defect, producing a UFFD inconsistency that causes a kernel BUG or WARNING at mm/userfaultfd.c:2067 during fd cleanup. No public exploit has been identified and EPSS is 0.33% (26th percentile), but the crash was confirmed via syzkaller fuzzing and patches have been backported across multiple stable kernel branches.

RemediationAI

Apply the upstream stable kernel patches available at https://git.kernel.org/stable/c/ - seven backport commits (41cb9fd904fe, 76385629f457, 788e5385d0ff, 850f1ea245bd, 92b82e232b8d, ac50c6e0a8f9, b69f19244c2b, f04aad36a07c) address this issue; monitor your Linux distribution's security errata for kernel packages incorporating these fixes. As a compensating control before patching, set /proc/sys/vm/unprivileged_userfaultfd to 0 (echo 0 > /proc/sys/vm/unprivileged_userfaultfd) to prevent unprivileged users from registering UFFD contexts; note this will break applications relying on unprivileged userfaultfd such as CRIU checkpoint-restore and certain QEMU live migration configurations, so evaluate compatibility before deploying. Alternatively, deploy seccomp profiles that deny the userfaultfd() syscall for untrusted workloads; this is more targeted but requires per-application profile management. For container environments, ensure container runtimes apply restrictive seccomp defaults that already block userfaultfd for unprivileged containers.

Affects your stack

Find out whether the stacks and servers you run are on an affected version.

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The defect resides in mm/ksm.c within the ksm_madvise() function, which handles madvise() calls for the Kernel Same-page Merging (KSM) subsystem. VM_MERGEABLE is defined as a 32-bit unsigned int constant (0x8000'0000). On 64-bit x86_64 builds, applying the bitwise NOT operator (~VM_MERGEABLE) yields a 32-bit result of 0x7fff'ffff, which is zero-extended (not sign-extended) during implicit promotion to unsigned long before the &= compound assignment. This produces a masked value of 0x0000'0000'7fff'ffff instead of the intended 0xffff'ffff'7fff'ffff, silently zeroing all upper 32 bits of vma->vm_flags. Flags encoded in those upper bits - including the UFFD MINOR mode context pointer validity markers - are lost. The kernel subsequently detects the inconsistency at mm/userfaultfd.c:2067 in userfaultfd_release_all() when a VMA holds a valid vma->vm_userfaultfd_ctx pointer but lacks corresponding UFFD flags, triggering a BUG() (kernel panic) or, after commit 31defc3b01d9, a WARNING. The fix redefines VM_MERGEABLE using the BIT() macro with unsigned long type. All other VM_* flags are unaffected because they are defined as signed int, whose ~ result has a leading 1-bit and is sign-extended to 64 bits with leading 1s. Affected CPE: cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 5.5 MEDIUM
AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
vuln.today AI 5.5 MEDIUM

Local syscall access with low privilege suffices; no confidentiality or integrity impact, only kernel availability (crash) is affected.

3.1 AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
4.0 AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
SUSE MEDIUM
Red Hat 5.8 MEDIUM

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

DescriptionNVD

In the Linux kernel, the following vulnerability has been resolved:

mm/ksm: fix flag-dropping behavior in ksm_madvise

syzkaller discovered the following crash: (kernel BUG)

[ 44.607039] ------------[ cut here ]------------ [ 44.607422] kernel BUG at mm/userfaultfd.c:2067! [ 44.608148] Oops: invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN NOPTI [ 44.608814] CPU: 1 UID: 0 PID: 2475 Comm: reproducer Not tainted 6.16.0-rc6 #1 PREEMPT(none) [ 44.609635] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014 [ 44.610695] RIP: 0010:userfaultfd_release_all+0x3a8/0x460

<snip other registers, drop unreliable trace>

[ 44.617726] Call Trace: [ 44.617926] <TASK> [ 44.619284] userfaultfd_release+0xef/0x1b0 [ 44.620976] __fput+0x3f9/0xb60 [ 44.621240] fput_close_sync+0x110/0x210 [ 44.622222] __x64_sys_close+0x8f/0x120 [ 44.622530] do_syscall_64+0x5b/0x2f0 [ 44.622840] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 44.623244] RIP: 0033:0x7f365bb3f227

Kernel panics because it detects UFFD inconsistency during userfaultfd_release_all(). Specifically, a VMA which has a valid pointer to vma->vm_userfaultfd_ctx, but no UFFD flags in vma->vm_flags.

The inconsistency is caused in ksm_madvise(): when user calls madvise() with MADV_UNMEARGEABLE on a VMA that is registered for UFFD in MINOR mode, it accidentally clears all flags stored in the upper 32 bits of vma->vm_flags.

Assuming x86_64 kernel build, unsigned long is 64-bit and unsigned int and int are 32-bit wide. This setup causes the following mishap during the &= ~VM_MERGEABLE assignment.

VM_MERGEABLE is a 32-bit constant of type unsigned int, 0x8000'0000. After ~ is applied, it becomes 0x7fff'ffff unsigned int, which is then promoted to unsigned long before the & operation. This promotion fills upper 32 bits with leading 0s, as we're doing unsigned conversion (and even for a signed conversion, this wouldn't help as the leading bit is 0). & operation thus ends up AND-ing vm_flags with 0x0000'0000'7fff'ffff instead of intended 0xffff'ffff'7fff'ffff and hence accidentally clears the upper 32-bits of its value.

Fix it by changing VM_MERGEABLE constant to unsigned long, using the BIT() macro.

Note: other VM_* flags are not affected: This only happens to the VM_MERGEABLE flag, as the other VM_* flags are all constants of type int and after ~ operation, they end up with leading 1 and are thus converted to unsigned long with leading 1s.

Note 2: After commit 31defc3b01d9 ("userfaultfd: remove (VM_)BUG_ON()s"), this is no longer a kernel BUG, but a WARNING at the same place:

[ 45.595973] WARNING: CPU: 1 PID: 2474 at mm/userfaultfd.c:2067

but the root-cause (flag-drop) remains the same.

[akpm@linux-foundation.org: rust bindgen wasn't able to handle BIT(), from Miguel]

Threat Intelligence Overview

EPSS Score
0.3%
Top 74% exploitable
Prevalence
Ubiquitous
Linux kernel underpins most cloud, server, container, and embedded infrastructure globally.
Data Quality
4 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact· derived
High

Priority Score

28
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +28
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Affected Products (CPE)NVD

cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
Container suse/hpc/warewulf4-x86_64/sle-hpc-node:latest Image SLES15-SP6 Image SLES15-SP6-BYOS Image SLES15-SP6-BYOS-Azure Image SLES15-SP6-BYOS-EC2 Image SLES15-SP6-BYOS-GCE Image SLES15-SP6-CHOST-BYOS Image SLES15-SP6-CHOST-BYOS-Aliyun Image SLES15-SP6-CHOST-BYOS-Azure Image SLES15-SP6-CHOST-BYOS-EC2 Image SLES15-SP6-CHOST-BYOS-GCE Image SLES15-SP6-CHOST-BYOS-GDC Image SLES15-SP6-CHOST-BYOS-SAP-CCloud Image SLES15-SP6-EC2 Image SLES15-SP6-EC2-ECS-HVM Image SLES15-SP6-GCE Image SLES15-SP6-HPC-BYOS Image SLES15-SP6-HPC-BYOS-Azure Image SLES15-SP6-HPC-BYOS-EC2 Image SLES15-SP6-HPC-BYOS-GCE Image SLES15-SP6-HPC-EC2 Image SLES15-SP6-HPC-GCE Image SLES15-SP6-Hardened-BYOS Image SLES15-SP6-Hardened-BYOS-Azure Image SLES15-SP6-Hardened-BYOS-EC2 Image SLES15-SP6-Hardened-BYOS-GCE Image SLES15-SP6-SAP Image SLES15-SP6-SAP-Azure Image SLES15-SP6-SAP-EC2 Image SLES15-SP6-SAP-GCE Image SLES15-SP6-SAPCAL Image SLES15-SP6-SAPCAL-Azure Image SLES15-SP6-SAPCAL-EC2 Image SLES15-SP6-SAPCAL-GCE Affected
Container suse/sl-micro/6.0/baremetal-os-container:latest Container suse/sl-micro/6.0/toolbox:latest Affected
Container suse/sl-micro/6.0/base-os-container:2.1.3-7.95 Image SLE-Micro Image SLE-Micro-Azure Image SLE-Micro-BYOS Image SLE-Micro-BYOS-Azure Image SLE-Micro-BYOS-EC2 Image SLE-Micro-BYOS-GCE Image SLE-Micro-EC2 Image SLE-Micro-GCE Affected
Container suse/sl-micro/6.0/kvm-os-container:2.1.3-6.114 Affected
Container suse/sl-micro/6.0/rt-os-container:2.1.3-7.116 Affected

References

Advisories & patches
PATCH https://git.kernel.org/stable/c/41cb9fd904fe0c39d52e82dd84dc3c96b7aa9693 PATCH https://git.kernel.org/stable/c/76385629f45740b7888f8fcd83bde955b10f61fe PATCH https://git.kernel.org/stable/c/788e5385d0ff69cdba1cabccb9dab8d9647b9239 PATCH https://git.kernel.org/stable/c/850f1ea245bdc0ce6a3fd36bfb80d8cf9647cb71 PATCH https://git.kernel.org/stable/c/92b82e232b8d8b116ac6e57aeae7a6033db92c60 PATCH https://git.kernel.org/stable/c/ac50c6e0a8f91a02b681af81abb2362fbb67cc18 PATCH https://git.kernel.org/stable/c/b69f19244c2b6475c8a6eb72f0fb0d53509e48cd PATCH https://git.kernel.org/stable/c/f04aad36a07cc17b7a5d5b9a2d386ce6fae63e93 ADVISORY https://ubuntu.com/security/notices/USN-8781-1 ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:21080/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:21147/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:21180/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:4393/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:4422/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:4505/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:4506/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:4515/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:4516/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:4517/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:4521/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2025:4530/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:0029/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:0032/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:0033/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:0034/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20039/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20059/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20334/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20473/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20478/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20496/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20519/ ADVISORY https://www.suse.com/support/update/SUSE-SU-2026:20561/

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy