CVE-2026-6386 Overview
A memory corruption vulnerability exists in the FreeBSD kernel's handling of protection keys for userspace (PKU) on AMD64 systems. The pmap_pkru_update_range() subroutine, responsible for applying protection keys to address ranges by updating page table entries, fails to properly account for 1GB largepage mappings created using the shm_create_largepage(3) interface. Specifically, the function always treats a page directory page entry as pointing to another page table page, regardless of whether it represents a largepage mapping.
This improper handling allows an unprivileged local user to cause pmap_pkru_update_range() to misinterpret userspace memory as a page table page, potentially leading to unauthorized memory overwrites and information disclosure.
Critical Impact
Unprivileged local attackers can exploit this kernel vulnerability to access memory regions beyond their normal privileges, potentially exposing sensitive system information.
Affected Products
- FreeBSD AMD64 systems with PKU (Protection Keys for Userspace) support
- Systems utilizing shm_create_largepage(3) with 1GB page mappings
Discovery Timeline
- 2026-04-22 - CVE CVE-2026-6386 published to NVD
- 2026-04-22 - Last updated in NVD database
Technical Details for CVE-2026-6386
Vulnerability Analysis
This vulnerability stems from a fundamental mishandling of page table entry types within the FreeBSD kernel's memory management subsystem. The affected code path resides in pmap_pkru_update_range(), which is invoked when applying Intel Memory Protection Keys (PKU) to virtual address ranges.
The FreeBSD kernel supports multiple page sizes on AMD64 architecture, including standard 4KB pages, 2MB large pages, and 1GB superpages. When processing page directory entries, the vulnerable function assumes all entries point to subordinate page table pages rather than considering that entries may directly map large physical memory regions.
When a 1GB superpage created via shm_create_largepage(3) is encountered, the function incorrectly dereferences the page directory entry as if it were a pointer to another page table structure. This causes the kernel to interpret arbitrary userspace-controlled memory as page table metadata, enabling memory corruption beyond the process's normal access boundaries.
The vulnerability is classified under CWE-269 (Improper Privilege Management), as it allows unprivileged users to manipulate kernel memory management structures.
Root Cause
The root cause is the absence of proper page size detection logic within pmap_pkru_update_range(). The function fails to check the PS (Page Size) bit in page directory entries, which indicates whether the entry maps a large page directly or points to another level of page tables. This oversight causes the kernel to unconditionally traverse what it assumes to be page table hierarchies, even when those entries represent direct 1GB physical mappings.
Attack Vector
The attack requires local access to the target system. An attacker can exploit this vulnerability by:
- Creating a 1GB largepage mapping using shm_create_largepage(3)
- Triggering a protection key update operation on an address range that encompasses the largepage
- Causing the kernel to misinterpret userspace memory contents as page table entries
- Leveraging the resulting memory corruption to read or modify memory outside their process boundaries
The vulnerability requires the attacker to craft specific memory layouts that will be interpreted as page table structures by the confused kernel code. While exploitation complexity exists, the attack does not require any special privileges beyond basic user access.
Detection Methods for CVE-2026-6386
Indicators of Compromise
- Unexpected kernel panics or crashes related to page table management or memory faults
- Unusual usage patterns of shm_create_largepage(3) system calls by non-privileged processes
- Memory access violations or corruption in kernel space logged in system messages
Detection Strategies
- Monitor for processes creating large shared memory segments with 1GB page mappings using system call auditing
- Implement kernel integrity monitoring to detect unauthorized modifications to page table structures
- Deploy host-based intrusion detection systems (HIDS) capable of detecting anomalous memory operations
Monitoring Recommendations
- Enable FreeBSD audit logging for shm_create_largepage() system calls
- Monitor dmesg and kernel logs for page fault errors or pmap-related warnings
- Review system processes for unusual shared memory segment creation patterns
How to Mitigate CVE-2026-6386
Immediate Actions Required
- Apply the latest FreeBSD security patches addressing this vulnerability
- Review and limit access to systems where untrusted users have local shell access
- Consider disabling 1GB superpage support temporarily if patching is not immediately possible
Patch Information
FreeBSD has released a security advisory addressing this vulnerability. System administrators should apply the patches referenced in FreeBSD Security Advisory SA-26:11.
The patch corrects the page size detection logic in pmap_pkru_update_range() to properly identify and handle 1GB largepage mappings, preventing the kernel from misinterpreting page directory entries as pointers to page table pages.
Workarounds
- Restrict local user access to systems where this vulnerability poses a significant risk
- Disable PKU functionality at the kernel level if not required for operations (reduces attack surface but impacts security features)
- Limit the use of shm_create_largepage(3) to trusted applications only through mandatory access controls
# Check current FreeBSD version and patch level
freebsd-version -kru
# Update FreeBSD system with latest security patches
freebsd-update fetch
freebsd-update install
# Verify patch application
freebsd-version -k
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


