CVE-2025-21966 Overview
CVE-2025-21966 is a memory corruption vulnerability in the Linux kernel's dm-flakey device mapper target. The flaw resides in the optional corrupt_bio_byte feature and stems from an incorrect parameter being passed to bio_init(). Local attackers with the privileges required to configure device mapper targets can trigger out-of-bounds memory writes, categorized as [CWE-787]. Successful exploitation can corrupt kernel memory structures, enabling privilege escalation or denial of service. The Linux kernel maintainers resolved the issue across multiple stable branches.
Critical Impact
Local exploitation can corrupt kernel memory, leading to system compromise, privilege escalation, or kernel panic on affected Linux systems.
Affected Products
- Linux Kernel 6.14-rc1 through 6.14-rc6
- Linux Kernel stable branches prior to the fix commits
- Systems using the dm-flakey device mapper target with corrupt_bio_byte enabled
Discovery Timeline
- 2025-04-01 - CVE-2025-21966 published to the National Vulnerability Database
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2025-21966
Vulnerability Analysis
The vulnerability lives in the dm-flakey device mapper target, a testing facility that intentionally injects I/O failures to validate error-handling paths in higher-level storage code. The optional corrupt_bio_byte feature allows administrators to corrupt a specific byte in a block I/O request (bio). The kernel code passed an incorrect parameter to bio_init(), causing the biovec sizing and initialization to become inconsistent with the actual allocation. When the corruption path executes, the kernel writes outside the intended memory bounds.
Because dm-flakey operates in kernel context and touches block layer structures, an out-of-bounds write can overwrite adjacent slab objects, function pointers, or kernel metadata. The result is classic [CWE-787] out-of-bounds write behavior in a privileged execution context.
Root Cause
The root cause is an incorrect argument passed to bio_init() during setup of the corruption path in dm-flakey. The bio_init() function expects the caller to provide accurate biovec inline count and buffer sizing. Passing a mismatched value causes subsequent operations against the bio structure to reference memory beyond what was allocated for it.
Attack Vector
Exploitation requires local access with the ability to configure device mapper targets, typically capability CAP_SYS_ADMIN within a namespace that has device mapper access. An attacker configures a dm-flakey target with the corrupt_bio_byte option and drives I/O through the target to trigger the miscalculated bio_init() path. The resulting out-of-bounds write corrupts kernel memory. In containerized environments where users are granted device mapper privileges, the attack surface widens correspondingly.
No public proof-of-concept exploit or in-the-wild exploitation has been reported. See the upstream fix commits for technical details on the corrected bio_init() invocation: Linux Kernel Commit da070843.
Detection Methods for CVE-2025-21966
Indicators of Compromise
- Unexpected kernel oops or panic messages referencing dm-flakey, bio_init, or slab corruption in dmesg and journal logs
- KASAN reports flagging out-of-bounds writes in the block I/O subsystem on kernels compiled with sanitizers
- Presence of dm-flakey targets configured with corrupt_bio_byte on production systems where testing targets should not exist
Detection Strategies
- Inventory running kernels with uname -r and compare against the fixed stable versions referenced in the upstream commits
- Audit dmsetup table output across hosts to identify any flakey targets and their feature strings
- Monitor kernel logs for block layer warnings, BUG: entries, or SLUB debug output indicating memory corruption
Monitoring Recommendations
- Forward kernel logs (/var/log/kern.log, journald) to a central platform and alert on kernel oops signatures involving the device mapper subsystem
- Track privileged syscalls related to device mapper ioctls (DM_TABLE_LOAD, DM_DEV_CREATE) originating from unexpected users or containers
- Baseline device mapper configurations and alert when new flakey targets appear outside of maintenance windows
How to Mitigate CVE-2025-21966
Immediate Actions Required
- Apply the vendor-supplied kernel update that includes the upstream fix commits and reboot affected systems
- Restrict CAP_SYS_ADMIN and device mapper access to trusted administrators; do not expose device mapper controls to untrusted containers or workloads
- Verify that production systems are not running dm-flakey targets, which are intended for testing rather than production storage stacks
Patch Information
The Linux kernel maintainers merged fixes across multiple stable branches. Review and apply the appropriate commit for your kernel line: Linux Kernel Commit 57e9417f, Linux Kernel Commit 5a87e46d, Linux Kernel Commit 818330f7, and Linux Kernel Commit da070843. Consume the corresponding stable release from your Linux distribution's security channel.
Workarounds
- Unload or blacklist the dm-flakey kernel module on systems that do not require it: add blacklist dm-flakey to a file under /etc/modprobe.d/ and rebuild the initramfs
- Remove or refuse to load any dm-flakey device mapper table entries until patched kernels are deployed
- Constrain container runtimes so that workloads cannot invoke device mapper ioctls, for example by dropping CAP_SYS_ADMIN and using a restrictive seccomp profile
# Verify kernel version and check for dm-flakey usage
uname -r
lsmod | grep dm_flakey
sudo dmsetup table | grep flakey
# Prevent dm-flakey from loading until patched
echo "blacklist dm_flakey" | sudo tee /etc/modprobe.d/disable-dm-flakey.conf
sudo update-initramfs -u
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

