CVE-2025-22056 Overview
CVE-2025-22056 is a heap out-of-bounds write vulnerability in the Linux kernel's netfilter subsystem, specifically within the nft_tunnel module. The flaw exists in the parsing logic for handling multiple NFTA_TUNNEL_KEY_OPTS_GENEVE attributes, where incorrect pointer arithmetic leads to memory corruption. When processing geneve_opt structures, the code erroneously performs type conversion before pointer addition, causing subsequent writes to occur outside the allocated heap buffer.
This vulnerability allows a local attacker with low privileges to potentially escalate privileges, execute arbitrary code in kernel context, or cause system instability through memory corruption.
Critical Impact
Local attackers can exploit this heap out-of-bounds write to corrupt kernel memory, potentially achieving privilege escalation or arbitrary code execution in kernel space.
Affected Products
- Linux Kernel (multiple versions with netfilter/nftables support)
- Systems using GENEVE tunnel encapsulation with nftables
- Debian Linux (see LTS announcements for affected versions)
Discovery Timeline
- April 16, 2025 - CVE-2025-22056 published to NVD
- November 3, 2025 - Last updated in NVD database
Technical Details for CVE-2025-22056
Vulnerability Analysis
The vulnerability resides in the nft_tunnel_obj_init function within the netfilter nftables tunnel implementation. When parsing multiple GENEVE tunnel option attributes (NFTA_TUNNEL_KEY_OPTS_GENEVE), the kernel must place each geneve_opt structure compactly in memory. The parsing logic calculates the position for the next geneve_opt by performing pointer arithmetic.
The root cause is a type confusion error in the pointer arithmetic. The code incorrectly casts the pointer type before performing the addition operation, which changes the arithmetic scale factor. Instead of advancing by the correct byte offset (char * arithmetic), the pointer advances by multiples of the structure size, causing writes to land outside the allocated buffer.
The KASAN (Kernel Address Sanitizer) trace from the bug report shows a write of 124 bytes occurring at an out-of-bounds address during the memcpy operation within nft_tunnel_obj_init. This confirms heap corruption occurring during the initialization of tunnel objects.
Root Cause
The type confusion occurs in pointer addition operations within the geneve option parsing code. In C, pointer arithmetic is scaled by the size of the pointed-to type. When handling geneve_opt structures that should be placed compactly, the code must use char * arithmetic (1-byte scaling) to calculate byte offsets correctly.
The vulnerable code performs the type cast before the addition, resulting in pointer arithmetic scaled by the geneve_opt structure size instead of single bytes. This causes the calculated next position to be far beyond the intended location, leading to heap out-of-bounds writes when subsequent structures are copied into memory.
Attack Vector
Exploitation requires local access to the system with privileges sufficient to configure netfilter/nftables rules. An attacker would:
- Create a netlink message targeting the nftables subsystem
- Include a tunnel object with multiple NFTA_TUNNEL_KEY_OPTS_GENEVE attributes
- Trigger the vulnerable parsing path in nf_tables_newobj
- The type confusion causes heap corruption when processing subsequent geneve options
The attack surface is limited to users with CAP_NET_ADMIN capability or equivalent permissions to configure netfilter rules, though unprivileged users in certain namespace configurations may also be able to trigger the vulnerability.
Detection Methods for CVE-2025-22056
Indicators of Compromise
- KASAN reports indicating slab-out-of-bounds errors in nft_tunnel_obj_init
- Kernel oops or panics related to netfilter or nftables tunnel processing
- Unexpected system crashes when processing GENEVE tunnel configurations
- Memory corruption symptoms in kernel heap allocations
Detection Strategies
- Enable KASAN (Kernel Address Sanitizer) in development/testing environments to detect heap corruption
- Monitor kernel logs for nftables-related errors, particularly in tunnel object initialization
- Deploy kernel audit rules to track netfilter configuration changes
- Use endpoint detection solutions that monitor for kernel exploitation attempts
Monitoring Recommendations
- Configure syslog alerting for kernel KASAN reports and memory error messages
- Monitor for unusual nftables rule modifications, especially those involving tunnel objects
- Track processes making netlink syscalls to the netfilter subsystem
- Implement kernel live patching infrastructure for rapid vulnerability response
How to Mitigate CVE-2025-22056
Immediate Actions Required
- Update the Linux kernel to a patched version immediately
- If unable to patch, consider restricting CAP_NET_ADMIN privileges to trusted users only
- Disable user namespaces if not required to reduce attack surface from unprivileged users
- Monitor systems for signs of exploitation attempts while patching is in progress
Patch Information
The Linux kernel maintainers have released patches across multiple stable branches. The fix corrects the pointer arithmetic in both the parse and dump code paths to ensure proper byte-level addressing when handling geneve_opt structures.
Patches are available via the kernel git repository:
- Kernel Git Commit 0a93a71
- Kernel Git Commit 1b755d8
- Kernel Git Commit 28d88ee
- Kernel Git Commit 31d49eb
- Kernel Git Commit 446d948
- Kernel Git Commit 708e268
- Kernel Git Commit a263d31
- Kernel Git Commit ca2adfc
Debian users should refer to the Debian LTS Security Announcements for distribution-specific patches.
Workarounds
- Restrict netfilter/nftables configuration capabilities to trusted administrators only
- Remove CAP_NET_ADMIN from untrusted processes and containers
- Disable unprivileged user namespaces via sysctl kernel.unprivileged_userns_clone=0
- If GENEVE tunneling is not required, avoid using nftables tunnel objects with GENEVE options
# Restrict unprivileged user namespaces (temporary mitigation)
sysctl -w kernel.unprivileged_userns_clone=0
# Make the change persistent
echo "kernel.unprivileged_userns_clone = 0" >> /etc/sysctl.d/99-security.conf
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

