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

CVE-2024-14040: Linux Kernel Privilege Escalation Flaw

CVE-2024-14040 is a privilege escalation vulnerability in the Linux kernel nexthop module affecting ECMP weight configurations. This article covers the technical details, affected versions, impact, and mitigation.

Published:

CVE-2024-14040 Overview

CVE-2024-14040 addresses a resolved issue in the Linux kernel networking subsystem, specifically within the nexthop group weight handling in net/nexthop. The kernel used an 8-bit unsigned integer (u8) for Equal-Cost Multi-Path (ECMP) nexthop weights, which was insufficient for large Clos network deployments requiring finer-grained weight ratios such as 1000:999. The fix widens the weight field from u8 to u16 while preserving backward compatibility with existing userspace tooling by repurposing a previously reserved field (resvd1) as weight_high.

Critical Impact

Local exploitation potential exists through the kernel networking stack, with a CVSS 3.1 base score of 7.8 impacting confidentiality, integrity, and availability.

Affected Products

  • Linux kernel networking subsystem (net/nexthop)
  • Systems configured with ECMP nexthop groups
  • Distributions shipping affected upstream kernel versions prior to the referenced patch

Discovery Timeline

  • 2026-07-26 - CVE-2024-14040 published to NVD
  • 2026-07-27 - Last updated in NVD database

Technical Details for CVE-2024-14040

Vulnerability Analysis

The issue resides in the Linux kernel net/nexthop code, where nexthop group member weights were stored as an 8-bit unsigned integer. In Clos network topologies with high fan-out and many nodes, operators need to express ECMP weight ratios that exceed the 255 maximum representable by u8. The narrow integer width forced approximation of intended weight ratios, and manipulation of the reserved fields in struct nexthop_grp could lead to inconsistent state within the kernel routing tables.

The patch converts the internal weight representation from u8 to u16. The conversion was performed by first replacing u8 with a single-member structure to force compilation failures at every use site, allowing type correctness auditing, before finalizing on a u16 type.

Root Cause

The root cause is a numeric truncation and integer width limitation in the nexthop weight field. The user-space API (UAPI) struct nexthop_grp defined weight as __u8 alongside reserved fields. Insufficient integer width combined with reserved-field handling created conditions where kernel state could diverge from operator intent in high-scale ECMP deployments.

Attack Vector

The attack vector is local, requiring low privileges and no user interaction. An attacker with permissions to configure kernel networking (typically CAP_NET_ADMIN within a namespace) could interact with the nexthop UAPI in ways affecting confidentiality, integrity, and availability of kernel networking state. The vulnerability is not exploitable remotely and no public proof-of-concept exploit is available.

// Structure change described in the patch (prose reference):
// Before: struct nexthop_grp { __u32 id; __u8 weight; __u8 resvd1; __u16 resvd2; };
// After: struct nexthop_grp { __u32 id; __u8 weight; __u8 weight_high; __u16 resvd2; };
// See the upstream commit for exact implementation details.

Detection Methods for CVE-2024-14040

Indicators of Compromise

  • Unexpected modifications to nexthop group configurations logged via rtnetlink audit events
  • Kernel log entries referencing nexthop weight validation failures or unexpected NHA_GROUP attribute payloads
  • Anomalous CAP_NET_ADMIN usage by non-networking processes in user namespaces

Detection Strategies

  • Audit kernel version reporting via package inventory to identify hosts running unpatched Linux kernel builds
  • Monitor netlink socket activity for processes issuing RTM_NEWNEXTHOP messages outside of expected orchestration tooling
  • Correlate namespace creation with subsequent networking capability use to identify local privilege escalation attempts

Monitoring Recommendations

  • Enable auditd rules covering netlink syscalls and capability grants for CAP_NET_ADMIN
  • Ingest kernel and audit logs into a centralized analytics pipeline for cross-host correlation
  • Track patch compliance state for the Linux kernel across Linux fleets, including container hosts

How to Mitigate CVE-2024-14040

Immediate Actions Required

  • Apply the upstream kernel patch referenced in the Kernel Git Patch as soon as vendor-supported builds are available
  • Inventory hosts running kernels with nexthop group support and prioritize those exposed to untrusted local users or container workloads
  • Restrict CAP_NET_ADMIN in user namespaces where operationally feasible

Patch Information

The upstream fix widens the nexthop weight from u8 to u16 and repurposes the previously reserved resvd1 field as weight_high, keeping the existing weight field encoded as value-minus-one for backward compatibility. Old userspace continues to function unchanged because it always sets weight_high to zero. New userspace communicating with an unpatched kernel is bounced when attempting to configure weights greater than 8 bits. Refer to the Kernel Git Patch for the authoritative implementation.

Workarounds

  • Limit local access to systems until the kernel patch is deployed through the distribution channel
  • Disable or restrict use of nexthop groups in environments that do not require ECMP configurations
  • Enforce seccomp and namespace policies that constrain access to networking syscalls for untrusted workloads
bash
# Example: verify current kernel version and check for the fix
uname -r
# Confirm the patched commit is present in your distribution's kernel changelog
# before deploying to production hosts.

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

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

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.