Local memory-protection bypass via truncated VMA flags
Published Oct 28, 2025 · Updated Oct 28, 2025
A flag-handling flaw in the Linux kernel allows local users to crash the kernel or bypass memory protections through madvise(). In ksm_madvise(), complementing the 32-bit VM_MERGEABLE constant before promotion to unsigned long zeroes the upper 32 bits of vm_flags rather than clearing only the mergeable bit. An unprivileged process can trigger the deterministic path in its own address space; affected flags can cause a panic on userfaultfd close or remove sealing, protection-key, and shadow-stack controls.
Summary
What happened
A flag-handling flaw in the Linux kernel allows local users to crash the kernel or bypass memory protections through madvise(). In ksm_madvise(), complementing the 32-bit VM_MERGEABLE constant before promotion to unsigned long zeroes the upper 32 bits of vm_flags rather than clearing only the mergeable bit. An unprivileged process can trigger the deterministic path in its own address space; affected flags can cause a panic on userfaultfd close or remove sealing, protection-key, and shadow-stack controls.
The record
- CVE
- CVE-2025-40040
- Published
- Oct 28, 2025
- Updated
- Oct 28, 2025
- Vendor
- The Linux Kernel Organization
- Product
- Linux
- Classifications
- T1499
- Attack vector
- local
- Privileges
- authenticated
Timeline
How it unfolded
- Oct 28, 2025CVE publishedPublication date reported by the CVE source.
- Oct 28, 2025Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
Compare these published version ranges with your installed build and any vendor patches.
- Affected versionversion=5.13
- Affected versionversion=7677f7fd8be76659cd2d0db8ff4093bbb51c20e5 <76385629f45740b7888f8fcd83bde955b10f61fe
- Affected versionversion=7677f7fd8be76659cd2d0db8ff4093bbb51c20e5 <92b82e232b8d8b116ac6e57aeae7a6033db92c60
- Affected versionversion=7677f7fd8be76659cd2d0db8ff4093bbb51c20e5 <ac50c6e0a8f91a02b681af81abb2362fbb67cc18
- Affected versionversion=7677f7fd8be76659cd2d0db8ff4093bbb51c20e5 <f04aad36a07cc17b7a5d5b9a2d386ce6fae63e93
What conditions does exploitation require?
What is affected?
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Weakness, pattern, technique
Public exploit references
No public exploit references are available in this record.
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo