Skip to main content
Vulnerability Database/CVE-2024-35896

CVE-2024-35896: Linux Kernel Buffer Overflow Vulnerability

CVE-2024-35896 is a buffer overflow flaw in Linux Kernel netfilter that fails to validate user input length before copying data. This post explains its technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-35896 Overview

CVE-2024-35896 is an out-of-bounds read vulnerability [CWE-125] in the Linux kernel netfilter subsystem. The flaw resides in the IPv4 ip_tablesdo_replace() code path invoked via setsockopt(). The kernel failed to validate the user-supplied optlen argument before copying data, allowing a local user to trigger a slab-out-of-bounds read in copy_from_sockptr_offset(). The issue was surfaced by syzbot after a BPF change (commit 20f2505fb436) altered allocation patterns in cgroup/{s,g}etsockopt, exposing pre-existing missing length checks in netfilter.

Critical Impact

A local, low-privileged attacker can read adjacent kernel slab memory and trigger kernel instability by issuing crafted setsockopt() calls to the netfilter interface.

Affected Products

  • Linux Kernel (multiple stable branches including 6.9-rc1 and 6.9-rc2)
  • Debian Linux 10.0 (LTS)
  • NetApp and Siemens products shipping the affected kernel (per vendor advisories)

Discovery Timeline

  • 2024-05-19 - CVE-2024-35896 published to the National Vulnerability Database (NVD)
  • 2026-10-15 - Last updated in NVD database

Technical Details for CVE-2024-35896

Vulnerability Analysis

The vulnerability is an out-of-bounds read in the IPv4 netfilter do_replace() function (net/ipv4/netfilter/ip_tables.c). When a userspace process issues setsockopt() with an IPT_SO_SET_REPLACE operation, the kernel calls do_ipt_set_ctl() which invokes do_replace(). That function copies a struct ipt_replace from the user-provided sockptr_t buffer using copy_from_sockptr() without first confirming that optlen is at least sizeof(struct ipt_replace).

KASAN output in the report shows a read of 96 bytes from a 1-byte kmalloc-8 slab object, confirming the kernel reads past the end of the allocation. The result is kernel-memory information disclosure and potential denial of service through kernel panics triggered by invalid memory access.

Root Cause

The root cause is missing input validation on the optlen argument to setsockopt() inside the netfilter table-replace code path. Historically, higher layers allocated a buffer large enough that the undersized read was benign. The BPF change in commit 20f2505fb436 ("bpf: Try to avoid kzalloc in cgroup/{s,g}etsockopt") removed the oversized allocation, exposing the missing length check and allowing the copy to read beyond the allocated slab object.

Attack Vector

Exploitation requires local access and a process able to open a raw socket and call setsockopt() with netfilter control codes. The attacker crafts a setsockopt() invocation that passes an optlen smaller than sizeof(struct ipt_replace), causing copy_from_sockptr() to read past the user buffer slab allocation. Successful triggering leaks adjacent kernel heap contents or crashes the kernel. No remote vector exists; interaction is limited to local privilege scenarios where a user can create and configure sockets.

No public proof-of-concept exploit is listed in Exploit-DB and the issue is not present on the CISA Known Exploited Vulnerabilities catalog. See Linux Kernel Commit 0c83842 for the upstream fix.

Detection Methods for CVE-2024-35896

Indicators of Compromise

  • Kernel ring-buffer entries containing KASAN: slab-out-of-bounds in copy_from_sockptr or do_ipt_set_ctl call-stack traces.
  • Unexpected kernel oops or panic events referencing net/ipv4/netfilter/ip_tables.c on hosts running vulnerable kernels.
  • setsockopt() system calls originating from non-privileged processes targeting netfilter option codes with abnormally small optlen values.

Detection Strategies

  • Deploy eBPF or auditd rules that log setsockopt() calls with level SOL_IP/netfilter option names and record the optlen parameter for anomaly review.
  • Correlate kernel crash telemetry (dmesg, kdump) with process execution context to identify suspicious local actors triggering netfilter code paths.
  • Compare running kernel version and build metadata against vendor advisories such as the Debian LTS Security Announcement and NetApp Security Advisory ntap-20250321-0004 to identify unpatched hosts.

Monitoring Recommendations

  • Centralize kernel log collection and alert on KASAN or oops signatures involving copy_from_sockptr or do_replace.
  • Monitor loaded kernel versions across Linux fleets and flag hosts running kernels prior to the stable commits listed in the vendor advisories.
  • Baseline normal setsockopt() usage per workload so that unexpected netfilter configuration attempts from user-space processes are investigated.

How to Mitigate CVE-2024-35896

Immediate Actions Required

  • Apply the vendor-supplied kernel update that incorporates the netfilter length-validation patch across all stable branches.
  • Reboot patched systems to activate the fixed kernel image; live-patch solutions are an acceptable interim option where supported.
  • Inventory containers and virtual machines that share host kernels and schedule coordinated restarts.

Patch Information

The fix validates optlen against the expected structure size before invoking copy_from_sockptr(). Upstream commits include Linux Kernel Commit 0c83842, Linux Kernel Commit 0f03824, Linux Kernel Commit 18aae2c, Linux Kernel Commit 440e948, Linux Kernel Commit 58f2bfb, and Linux Kernel Commit 81d51b9. Distribution-specific guidance is available in the Debian LTS Security Announcement and Siemens Security Advisory SSA-265688.

Workarounds

  • Restrict local shell and container access to trusted users to reduce the pool of actors able to invoke setsockopt() on netfilter sockets.
  • Use seccomp or Linux Security Module (LSM) policies to deny unprivileged workloads access to the setsockopt() system call for SOL_IP netfilter options.
  • Disable or unload the ip_tables module on hosts that do not require legacy iptables functionality.
bash
# Verify running kernel version and confirm patch presence
uname -r
# Debian / Ubuntu: apply kernel updates
sudo apt update && sudo apt install --only-upgrade linux-image-$(uname -r | sed 's/.*-//')
# Reboot to activate the patched kernel
sudo systemctl reboot

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.