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]
- BDU:2026-02395
- openSUSE-SU-2025:15702-1
- SUSE-SU-2025:4393-1
- SUSE-SU-2025:4422-1
- SUSE-SU-2025:4505-1
- SUSE-SU-2025:4506-1
- SUSE-SU-2025:4516-1
- SUSE-SU-2025:4517-1
- SUSE-SU-2025:4521-1
- SUSE-SU-2025:4530-1
- SUSE-SU-2026:0029-1
- SUSE-SU-2026:0032-1
- SUSE-SU-2026:0033-1
- SUSE-SU-2026:0034-1
- SUSE-SU-2026:20039-1
- SUSE-SU-2026:20059-1
- SUSE-SU-2026:20473-1
- SUSE-SU-2026:20496-1
- Published
- Oct 28, 2025
- Updated
- Oct 19, 2026
- EPSS
- 0.3% · 31th percentile
- CWE
- —
Report tools
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.
Running WordPress? Scan your site free with WP Lens
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 helpAffected 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.
| Vendor | Product | CPE |
|---|---|---|
| linux | linux kernel | cpe:2.3:o:linux:linux_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.
| Ecosystem | Package | Affected range | Fix |
|---|---|---|---|
| Debian:12 | linux | before 6.1.158-1 | 6.1.158-1 |
| Debian:13 | linux | before 6.12.57-1 | 6.12.57-1 |
| Debian:14 | linux | before 6.17.6-1 | 6.17.6-1 |
| openSUSE:Leap 15.6 | dtb-aarch64 | before 6.4.0-150600.23.81.1 | 6.4.0-150600.23.81.1 |
| openSUSE:Leap 15.6 | kernel-64kb | before 6.4.0-150600.23.81.3 | 6.4.0-150600.23.81.3 |
| openSUSE:Leap 15.6 | kernel-azure | before 6.4.0-150600.8.58.1 | 6.4.0-150600.8.58.1 |
| openSUSE:Leap 15.6 | kernel-debug | before 6.4.0-150600.23.81.3 | 6.4.0-150600.23.81.3 |
| openSUSE:Leap 15.6 | kernel-default | before 6.4.0-150600.23.81.3 | 6.4.0-150600.23.81.3 |
| openSUSE:Leap 15.6 | kernel-default-base | before 6.4.0-150600.23.81.3.150600.12.36.3 | 6.4.0-150600.23.81.3.150600.12.36.3 |
| openSUSE:Leap 15.6 | kernel-docs | before 6.4.0-150600.23.81.1 | 6.4.0-150600.23.81.1 |
| openSUSE:Leap 15.6 | kernel-kvmsmall | before 6.4.0-150600.23.81.3 | 6.4.0-150600.23.81.3 |
| openSUSE:Leap 15.6 | kernel-obs-build | before 6.4.0-150600.23.81.3 | 6.4.0-150600.23.81.3 |
| openSUSE:Leap 15.6 | kernel-obs-qa | before 6.4.0-150600.23.81.1 | 6.4.0-150600.23.81.1 |
| openSUSE:Leap 15.6 | kernel-rt | before 6.4.0-150600.10.61.1 | 6.4.0-150600.10.61.1 |
| openSUSE:Leap 15.6 | kernel-rt_debug | before 6.4.0-150600.10.61.1 | 6.4.0-150600.10.61.1 |
| openSUSE:Leap 15.6 | kernel-source | before 6.4.0-150600.23.81.2 | 6.4.0-150600.23.81.2 |
| openSUSE:Leap 15.6 | kernel-source-azure | before 6.4.0-150600.8.58.1 | 6.4.0-150600.8.58.1 |
| openSUSE:Leap 15.6 | kernel-source-rt | before 6.4.0-150600.10.61.1 | 6.4.0-150600.10.61.1 |
| openSUSE:Leap 15.6 | kernel-syms | before 6.4.0-150600.23.81.1 | 6.4.0-150600.23.81.1 |
| openSUSE:Leap 15.6 | kernel-syms-azure | before 6.4.0-150600.8.58.1 | 6.4.0-150600.8.58.1 |
| openSUSE:Leap 15.6 | kernel-syms-rt | before 6.4.0-150600.10.61.1 | 6.4.0-150600.10.61.1 |
| openSUSE:Leap 15.6 | kernel-zfcpdump | before 6.4.0-150600.23.81.3 | 6.4.0-150600.23.81.3 |
| openSUSE:Tumbleweed | kernel-source | before 6.17.7-1.1 | 6.17.7-1.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP3-LTSS | kernel-64kb | before 5.3.18-150300.59.229.3 | 5.3.18-150300.59.229.3 |
+72
Same product
linux: all recordsOther highest-scoring records for the same primary product.
- CVE-2026-31431crypto: algif_aead - Revert to operating out-of-placeKEV90Now
- 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 KEV89Now
- CVE-2021-22555Heap Out-Of-Bounds Write in Netfilter IP6T_SO_SET_REPLACEKEV85Now
Published before and after this one in the same product
- ← EarlierCVE-2025-40005Oct 20, 2025 · spi: cadence-quadspi: Implement refcount to handle unbind during busy22Monitor
- ← EarlierCVE-2025-40039Oct 28, 2025 · ksmbd: Fix race condition in RPC handle list access18Monitor
- 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 / package | Fixed version | Source |
|---|---|---|
| Linux Linux | 41cb9fd904fe0c39d52e82dd84dc3c96b7aa9693 | Vendor (CNA) |
| Linux Linux | 76385629f45740b7888f8fcd83bde955b10f61fe | Vendor (CNA) |
| Linux Linux | 788e5385d0ff69cdba1cabccb9dab8d9647b9239 | Vendor (CNA) |
| Linux Linux | 850f1ea245bdc0ce6a3fd36bfb80d8cf9647cb71 | Vendor (CNA) |
| Linux Linux | 92b82e232b8d8b116ac6e57aeae7a6033db92c60 | Vendor (CNA) |
| Linux Linux | ac50c6e0a8f91a02b681af81abb2362fbb67cc18 | Vendor (CNA) |
| Linux Linux | b69f19244c2b6475c8a6eb72f0fb0d53509e48cd | Vendor (CNA) |
| Linux Linux | f04aad36a07cc17b7a5d5b9a2d386ce6fae63e93 | Vendor (CNA) |
| azl3 kernel 6.6.112.1-2 on Azure Linux 3.0 | 6.6.117.1-1 · CBL-Mariner Releases | Microsoft (MSRC) |
| cbl2 kernel 5.15.186.1-1 on CBL Mariner 2.0 | 5.15.200.1-1 · CBL-Mariner Releases | Microsoft (MSRC) |
| debian:linux | 6.1.158-1 · Debian:12 | Package registry (OSV) |
| opensuse:dtb-aarch64 | 6.4.0-150600.23.81.1 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-64kb | 6.4.0-150600.23.81.3 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-debug | 6.4.0-150600.23.81.3 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-default | 6.4.0-150600.23.81.3 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-default-base | 6.4.0-150600.23.81.3.150600.12.36.3 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-docs | 6.4.0-150600.23.81.1 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-kvmsmall | 6.4.0-150600.23.81.3 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-obs-build | 6.4.0-150600.23.81.3 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-obs-qa | 6.4.0-150600.23.81.1 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-source | 6.4.0-150600.23.81.2 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-syms | 6.4.0-150600.23.81.1 · openSUSE:Leap 15.6 | Package registry (OSV) |
| opensuse:kernel-zfcpdump | 6.4.0-150600.23.81.3 · openSUSE:Leap 15.6 | Package registry (OSV) |
| suse:kernel-64kb | 6.4.0-150600.23.81.3 · SUSE:Linux Enterprise Module for Basesystem 15 SP6 | Package registry (OSV) |
| suse:kernel-64kb | 6.4.0-150700.53.25.1 · SUSE:Linux Enterprise Module for Basesystem 15 SP7 | Package registry (OSV) |
| suse:kernel-azure | 6.4.0-150600.8.58.1 · SUSE:Linux Enterprise Module for Public Cloud 15 SP6 | Package registry (OSV) |
| suse:kernel-default | 6.4.0-150600.23.81.3 · SUSE:Linux Enterprise Module for Basesystem 15 SP6 | Package registry (OSV) |
| suse:kernel-default | 6.4.0-150700.53.25.1 · SUSE:Linux Enterprise Module for Basesystem 15 SP7 | Package registry (OSV) |
| suse:kernel-default-base | 6.4.0-150600.23.81.3.150600.12.36.3 · SUSE:Linux Enterprise Module for Basesystem 15 SP6 | Package registry (OSV) |
| suse:kernel-default-base | 6.4.0-150700.53.25.1.150700.17.17.1 · SUSE:Linux Enterprise Module for Basesystem 15 SP7 | Package 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.
| Source | Kind | Date |
|---|---|---|
| Proof-of-concept repository on GitHub | stars:12 | 2025-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.
- Published
- First PoC+33 d
- 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.
Credits
All researchersFinders, 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
- SSVC exploitation— → none
- Fix✗ → ✓
For records you follow, these changes also arrive as notifications. →
References
Show all references (7 more)Show less
- git.kernel.org/stable/c/76385629f45740b7888f8fcd83bde955b10f61fe
- git.kernel.org/stable/c/788e5385d0ff69cdba1cabccb9dab8d9647b9239
- git.kernel.org/stable/c/850f1ea245bdc0ce6a3fd36bfb80d8cf9647cb71
- git.kernel.org/stable/c/92b82e232b8d8b116ac6e57aeae7a6033db92c60
- git.kernel.org/stable/c/ac50c6e0a8f91a02b681af81abb2362fbb67cc18
- git.kernel.org/stable/c/b69f19244c2b6475c8a6eb72f0fb0d53509e48cd
- git.kernel.org/stable/c/f04aad36a07cc17b7a5d5b9a2d386ce6fae63e93
Vendor advisories and official records. Exploit/PoC links are deliberately left out.