Skip to content
Noroxi
NVD / CVE Program· CNA Linux

CVE-2025-40040: mm/ksm: fix flag-dropping behavior in ksm_madvise

Noroxi assessment

Priority: Monitor (action score 22/100)

  • Public proof-of-concept code exists (GitHub); there is no record of exploitation in the wild.
  • Probability of exploitation in the next 30 days: 0.37% (FIRST EPSS).
  • Someone with local access to the system can trigger it. A low-privileged account is enough. No user action is required. No special conditions are required; it is repeatable.
  • Fixed version: Linux Linux 41cb9fd904fe0c39d52e82dd84dc3c96b7aa9693, 76385629f45740b7888f8fcd83bde955b10f61fe, 788e5385d0ff69cdba1cabccb9dab8d9647b9239; azl3 kernel 6.6.112.1-2 on Azure Linux 3.0 6.6.117.1-1; cbl2 kernel 5.15.186.1-1 on CBL Mariner 2.0 5.15.200.1-1.
  • Severity is disputed: the assigning authority (CNA) scores it 7.8, NVD 5.5.

Low priority for now. Upgrade to Linux Linux 41cb9fd904fe0c39d52e82dd84dc3c96b7aa9693, 76385629f45740b7888f8fcd83bde955b10f61fe, 788e5385d0ff69cdba1cabccb9dab8d9647b9239; azl3 kernel 6.6.112.1-2 on Azure Linux 3.0 6.6.117.1-1; cbl2 kernel 5.15.186.1-1 on CBL Mariner 2.0 5.15.200.1-1 or later.

Generated automatically from the record's data: CVSS (NVD and CNA), CISA KEV and SSVC, FIRST EPSS, exploit sources, fixed versions. How we calculate it

Primary sources: NVD · CVE.org · FIRST EPSS

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]

MediumCVSS 5.5 · v3.1—Proof of concept Fix available
Published
Oct 28, 2025
Updated
Oct 19, 2026
EPSS
0.3% · 31th percentile
CWE
—

Report tools

JSON

Action score

22

Monitor

Low priority for now.

CVSS
22 / 40 · 5.5 / 10
CISA KEV
0 / 30 · Not listed
EPSS
0 / 30 · 0.3%

CISA SSVC decision

Exploitation
none
Automatable
no
Technical impact
total

Vulnrichment: CISA's decision-tree inputs.

CNA vs NVD score

NVD
5.5
CNA · Linux
7.8
2.3 point gap

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

The score given by the assigning authority versus NVD’s independent score. A gap means the severity is contested.

Get told when this record changes

  • Not in KEV: no record of exploitation in the wild
  • Proof of concept exists, no weaponized module
  • A fix has been released

If any of these changes, we'll tell you in the daily email digest.

Follow CVE-2025-40040

When you'll hear from us

  • when it enters CISA KEV
  • when exploit code appears or is weaponized
  • when the record is updated (including a fixed version)
  • when EPSS rises 20 points in a week

One daily email digest (06:00 UTC); connect a webhook for KEV listings and weaponized exploits instantly.

Your free account also gets you

Running WordPress? Scan your site free with WP Lens

  • Stack alerts: add the products and versions you run, get the new CVEs that affect them
  • Uptime monitoring: 1 site, instant email when it goes down
  • Add your domain: subdomains and takeover risk scanned every week (1 domain)
  • 10 scans an hour on the security tools (3 a day without an account), an API key and MCP
  • All your scans in one panel: findings, what changed in the last scan, a report per domain or per client (PDF, share link)
All free tools

Sign up with email · Have an account? Sign in

Free account, no card. Unfollow any time.

Running WordPress? Scan your site free with WP Lens

Is your version affected? Check it

Noroxi analysis

What does it mean in your environment?

The assessment above is generated automatically from the record's data; it doesn't know your environment. Our team verifies on your systems whether this vulnerability is actually exploitable and which mitigation is enough.

We use this product, ask for help

Affected systems

Is your version affected?

Pick the product and type the version you run. It's compared with this record's version ranges in your browser; the version isn't sent anywhere.

VendorProduct
linuxlinux kernel

Affected versions

NVD version ranges (for catalog products). Add the product to your stack with a version and matching uses these.

  • linux linux kernel4.6 and later · before 5.4.302
  • linux linux kernel5.5 and later · before 5.10.247
  • linux linux kernel5.11 and later · before 5.15.197
  • linux linux kernel5.16 and later · before 6.1.158
  • linux linux kernel6.2 and later · before 6.6.114
  • linux linux kernel6.7 and later · before 6.12.55
  • linux linux kernel6.13 and later · before 6.17.3

Versions reported by the vendor

Affected version ranges reported by the assigning authority (Linux). Independent of NVD's CPE analysis and usually ahead of it.

  • Linux Linux

    • 4.6affected
    • 63c17fb8e5a46a16e10e82005748837fd11a2024 and later · before 850f1ea245bdc0ce6a3fd36bfb80d8cf9647cb71affected · git
    • 63c17fb8e5a46a16e10e82005748837fd11a2024 and later · before 788e5385d0ff69cdba1cabccb9dab8d9647b9239affected · git
    • 63c17fb8e5a46a16e10e82005748837fd11a2024 and later · before b69f19244c2b6475c8a6eb72f0fb0d53509e48cdaffected · git
    • 63c17fb8e5a46a16e10e82005748837fd11a2024 and later · before 41cb9fd904fe0c39d52e82dd84dc3c96b7aa9693affected · git
    • 63c17fb8e5a46a16e10e82005748837fd11a2024 and later · before 92b82e232b8d8b116ac6e57aeae7a6033db92c60affected · git
    • 63c17fb8e5a46a16e10e82005748837fd11a2024 and later · before ac50c6e0a8f91a02b681af81abb2362fbb67cc18affected · git
    • 63c17fb8e5a46a16e10e82005748837fd11a2024 and later · before 76385629f45740b7888f8fcd83bde955b10f61feaffected · git
    • 63c17fb8e5a46a16e10e82005748837fd11a2024 and later · before f04aad36a07cc17b7a5d5b9a2d386ce6fae63e93affected · git
    • before 4.6not affected · semver

Package-level exposure

OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.

EcosystemPackageAffected rangeFix
Debian:12linuxbefore 6.1.158-16.1.158-1
Debian:13linuxbefore 6.12.57-16.12.57-1
Debian:14linuxbefore 6.17.6-16.17.6-1
openSUSE:Leap 15.6dtb-aarch64before 6.4.0-150600.23.81.16.4.0-150600.23.81.1
openSUSE:Leap 15.6kernel-64kbbefore 6.4.0-150600.23.81.36.4.0-150600.23.81.3
openSUSE:Leap 15.6kernel-azurebefore 6.4.0-150600.8.58.16.4.0-150600.8.58.1
openSUSE:Leap 15.6kernel-debugbefore 6.4.0-150600.23.81.36.4.0-150600.23.81.3
openSUSE:Leap 15.6kernel-defaultbefore 6.4.0-150600.23.81.36.4.0-150600.23.81.3
openSUSE:Leap 15.6kernel-default-basebefore 6.4.0-150600.23.81.3.150600.12.36.36.4.0-150600.23.81.3.150600.12.36.3
openSUSE:Leap 15.6kernel-docsbefore 6.4.0-150600.23.81.16.4.0-150600.23.81.1
openSUSE:Leap 15.6kernel-kvmsmallbefore 6.4.0-150600.23.81.36.4.0-150600.23.81.3
openSUSE:Leap 15.6kernel-obs-buildbefore 6.4.0-150600.23.81.36.4.0-150600.23.81.3
openSUSE:Leap 15.6kernel-obs-qabefore 6.4.0-150600.23.81.16.4.0-150600.23.81.1
openSUSE:Leap 15.6kernel-rtbefore 6.4.0-150600.10.61.16.4.0-150600.10.61.1
openSUSE:Leap 15.6kernel-rt_debugbefore 6.4.0-150600.10.61.16.4.0-150600.10.61.1
openSUSE:Leap 15.6kernel-sourcebefore 6.4.0-150600.23.81.26.4.0-150600.23.81.2
openSUSE:Leap 15.6kernel-source-azurebefore 6.4.0-150600.8.58.16.4.0-150600.8.58.1
openSUSE:Leap 15.6kernel-source-rtbefore 6.4.0-150600.10.61.16.4.0-150600.10.61.1
openSUSE:Leap 15.6kernel-symsbefore 6.4.0-150600.23.81.16.4.0-150600.23.81.1
openSUSE:Leap 15.6kernel-syms-azurebefore 6.4.0-150600.8.58.16.4.0-150600.8.58.1
openSUSE:Leap 15.6kernel-syms-rtbefore 6.4.0-150600.10.61.16.4.0-150600.10.61.1
openSUSE:Leap 15.6kernel-zfcpdumpbefore 6.4.0-150600.23.81.36.4.0-150600.23.81.3
openSUSE:Tumbleweedkernel-sourcebefore 6.17.7-1.16.17.7-1.1
SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSSkernel-64kbbefore 5.3.18-150300.59.229.35.3.18-150300.59.229.3

+72

Other highest-scoring records for the same primary product.

  • CVE-2026-31431crypto: algif_aead - Revert to operating out-of-placeKEV
    90Now
  • CVE-2022-0847A flaw was found in the way the "flags" member of the new pipe buffer structure was lacking proper initialization in copy_page_to_iter_pipe KEV
    89Now
  • CVE-2021-22555Heap Out-Of-Bounds Write in Netfilter IP6T_SO_SET_REPLACEKEV
    85Now

Published before and after this one in the same product

  • ← EarlierCVE-2025-40005Oct 20, 2025 · spi: cadence-quadspi: Implement refcount to handle unbind during busy
    22Monitor
  • ← EarlierCVE-2025-40039Oct 28, 2025 · ksmbd: Fix race condition in RPC handle list access
    18Monitor
  • Later →CVE-2025-40082Oct 28, 2025 · hfsplus: fix slab-out-of-bounds read in hfsplus_uni2asc()
    28Monitor

Remediation

Which version to upgrade to

Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.

Product / packageFixed versionSource
Linux Linux41cb9fd904fe0c39d52e82dd84dc3c96b7aa9693Vendor (CNA)
Linux Linux76385629f45740b7888f8fcd83bde955b10f61feVendor (CNA)
Linux Linux788e5385d0ff69cdba1cabccb9dab8d9647b9239Vendor (CNA)
Linux Linux850f1ea245bdc0ce6a3fd36bfb80d8cf9647cb71Vendor (CNA)
Linux Linux92b82e232b8d8b116ac6e57aeae7a6033db92c60Vendor (CNA)
Linux Linuxac50c6e0a8f91a02b681af81abb2362fbb67cc18Vendor (CNA)
Linux Linuxb69f19244c2b6475c8a6eb72f0fb0d53509e48cdVendor (CNA)
Linux Linuxf04aad36a07cc17b7a5d5b9a2d386ce6fae63e93Vendor (CNA)
azl3 kernel 6.6.112.1-2 on Azure Linux 3.06.6.117.1-1 · CBL-Mariner ReleasesMicrosoft (MSRC)
cbl2 kernel 5.15.186.1-1 on CBL Mariner 2.05.15.200.1-1 · CBL-Mariner ReleasesMicrosoft (MSRC)
debian:linux6.1.158-1 · Debian:12Package registry (OSV)
opensuse:dtb-aarch646.4.0-150600.23.81.1 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-64kb6.4.0-150600.23.81.3 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-debug6.4.0-150600.23.81.3 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-default6.4.0-150600.23.81.3 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-default-base6.4.0-150600.23.81.3.150600.12.36.3 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-docs6.4.0-150600.23.81.1 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-kvmsmall6.4.0-150600.23.81.3 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-obs-build6.4.0-150600.23.81.3 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-obs-qa6.4.0-150600.23.81.1 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-source6.4.0-150600.23.81.2 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-syms6.4.0-150600.23.81.1 · openSUSE:Leap 15.6Package registry (OSV)
opensuse:kernel-zfcpdump6.4.0-150600.23.81.3 · openSUSE:Leap 15.6Package registry (OSV)
suse:kernel-64kb6.4.0-150600.23.81.3 · SUSE:Linux Enterprise Module for Basesystem 15 SP6Package registry (OSV)
suse:kernel-64kb6.4.0-150700.53.25.1 · SUSE:Linux Enterprise Module for Basesystem 15 SP7Package registry (OSV)
suse:kernel-azure6.4.0-150600.8.58.1 · SUSE:Linux Enterprise Module for Public Cloud 15 SP6Package registry (OSV)
suse:kernel-default6.4.0-150600.23.81.3 · SUSE:Linux Enterprise Module for Basesystem 15 SP6Package registry (OSV)
suse:kernel-default6.4.0-150700.53.25.1 · SUSE:Linux Enterprise Module for Basesystem 15 SP7Package registry (OSV)
suse:kernel-default-base6.4.0-150600.23.81.3.150600.12.36.3 · SUSE:Linux Enterprise Module for Basesystem 15 SP6Package registry (OSV)
suse:kernel-default-base6.4.0-150700.53.25.1.150700.17.17.1 · SUSE:Linux Enterprise Module for Basesystem 15 SP7Package registry (OSV)

+13

Exploit status

Proof of concept available

A public proof of concept or detection signature exists. Exploit knowledge is out there; don't delay patching.

Evidence

  • Proof-of-concept repository on GitHub ×1

Noroxi does not host or link to exploit code. Metasploit module names and Nuclei template ids are shown (names, not code); Exploit-DB entries and PoC repositories are given as counts only.

Public exploit evidence
SourceKindDate
Proof-of-concept repository on GitHubstars:122025-12-01

Research context

For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.

Timeline

From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.

  1. Published
  2. First PoC+33 d
  3. TodayNov 3, 2026+371 d

No history yet (it accumulates with the daily EPSS job).

Patch and commit links

Commit, PR and diff links among the references. A starting point for patch-diffing and variant hunting; fixes, not exploits.

No commit or PR link among the references.

Finders, reporters and analysts named in the CNA record. Click a name for that researcher’s other records.

No credits in the CNA record.

Variant candidates

Same product, same weakness class, within 18 months. If the patch missed the root cause, the sibling bug is here.

No nightly-computed relations.

Chain candidates

An authentication bypass and a privilege-requiring bug in the same product, published close together: combined they may become an unauthenticated path.

—

Bug bounty scope

No known public program.

Source: bounty-targets-data (public HackerOne, Bugcrowd, Intigriti, YesWeHack listings).

Technical details

Attack conditions

  • Someone with local access to the system can trigger it.
  • A low-privileged account is enough.
  • No user action is required.
  • No special conditions are required; it is repeatable.

If successful

Confidentiality
none
Integrity
none
Availability
high · the service can be disrupted
Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality impact
None
Integrity impact
None
Availability impact
High

Weakness class (CWE)

—

CVSS vector

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

nvd-primary

Attack context

MITRE CAPEC attack patterns and ATT&CK techniques for this weakness class (CWE). A starting point for detection rules and threat hunting.

MITRE has no CAPEC/ATT&CK mapping for this CWE.

Change log

  1. SSVC exploitation— → none
  2. Fix✗ → ✓

For records you follow, these changes also arrive as notifications. →

References

All records