Description
In the Linux kernel, the following vulnerability has been resolved:

l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname

A reader in l2tp_session_get_by_ifname() can return a pointer to a
session whose refcount has reached zero. The getter takes its
reference with plain refcount_inc(), but every other session getter
in the same file (l2tp_v2_session_get, l2tp_v3_session_get, and the
corresponding _get_next variants) uses refcount_inc_not_zero()
because the IDR/RCU lookup can race with refcount_dec_and_test() ->
l2tp_session_free() -> kfree_rcu(). The ifname getter is the only
outlier; the inconsistency was raised on-list after 979c017803c4
("l2tp: use list_del_rcu in l2tp_session_unhash").

A reader inside rcu_read_lock_bh() that matches session->ifname can
be preempted between the strcmp() and the refcount_inc(). If the
last reference drops on another CPU in that window, the reader's
refcount_inc() runs on a counter that has reached zero. refcount_t
catches the addition-on-zero, prints "refcount_t: addition on 0;
use-after-free", saturates the counter, and returns the saturated
pointer to the caller. Session memory is held live by the in-flight
RCU read section, but the kfree_rcu() callback queued from
l2tp_session_free() will free it once the grace period closes; a
caller that dereferences the returned session past that point hits
a slab-use-after-free. On PREEMPT_RT local_bh_disable() is a per-CPU
sleeping lock and the preemption window is real; on stock PREEMPT
kernels local_bh_disable() is a preempt_count increment that closes
the cross-CPU race in practice (see below).

Use refcount_inc_not_zero() and continue the list walk on failure,
matching the other session getters in the file. The ifname getter
is the only session getter in net/l2tp/ that still uses the bare
refcount_inc() pattern; this change restores file-internal
consistency. The success path is unchanged.
Published: 2026-07-19
Score: 7.8 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

A reader in the Linux L2TP code can acquire a pointer to a session whose reference count has reached zero, then attempt to increment the count with a plain refcount_inc(). Because this operation is not guarded against zero, the function can inadvertently succeed on a freed object, causing a use‑after‑free. The resulting memory corruption can lead to a crash or a kernel privilege escalation. The weakness is a classic use‑after‑free coupled with a race condition. The likely attack vector is local, as an attacker would need to trigger concurrent L2TP session lookup and deletion on the same machine. The CVE description explicitly states that a reader within an rcu_read_lock_bh() context can be preempted between the string comparison and the refcount_inc(), leading to a use‑after‑free.

Affected Systems

The vulnerability affects the Linux kernel in any distribution that includes the L2TP implementation without the described fix. Since vendor naming is generic ("Linux:Linux"), the issue applies broadly to current and older kernels that have not yet incorporated the patch for this bug, regardless of distribution. Affected systems are those running kernel versions prior to the inclusion of the patch for this bug, regardless of distribution.

Risk and Exploitability

The CVSS score of 7.8 indicates a high severity, while the EPSS score of < 1% shows that current medium‑risk probability of exploitation is low. The vulnerability is not listed in the CISA KEV catalog, meaning it is not known to be actively exploited in the wild. However, because the flaw allows a use‑after‑free that can lead to arbitrary code execution at kernel level, the potential impact remains significant for local attackers. The problem is mitigated by the fact that the race requires a specific timing window and careful interaction with L2TP, but an attacker could potentially craft such conditions. Given these characteristics, the overall risk is high for affected hosts.

Generated by OpenCVE AI on August 4, 2026 at 18:18 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Apply the latest kernel release that includes the L2TP refcount_inc_not_zero fix (commit 05f95729 or any newer stable kernel after the patch).
  • If an immediate kernel upgrade is not possible, disable L2TP services or unload the L2TP kernel module to remove the vulnerable code path.
  • Block inbound L2TP traffic using firewall rules until the kernel is updated to prevent exploitation devices from reaching the vulnerable code path.

Generated by OpenCVE AI on August 4, 2026 at 18:18 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Ubuntu USN Ubuntu USN USN-8593-1 Linux kernel vulnerabilities
Ubuntu USN Ubuntu USN USN-8603-1 Linux kernel (Azure) vulnerabilities
Ubuntu USN Ubuntu USN USN-8618-1 Linux kernel vulnerabilities
History

Wed, 22 Jul 2026 00:15:00 +0000

Type Values Removed Values Added
Weaknesses CWE-911
References
Metrics threat_severity

None

threat_severity

Moderate


Mon, 20 Jul 2026 14:45:00 +0000

Type Values Removed Values Added
Metrics cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}


Sun, 19 Jul 2026 15:30:00 +0000

Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname A reader in l2tp_session_get_by_ifname() can return a pointer to a session whose refcount has reached zero. The getter takes its reference with plain refcount_inc(), but every other session getter in the same file (l2tp_v2_session_get, l2tp_v3_session_get, and the corresponding _get_next variants) uses refcount_inc_not_zero() because the IDR/RCU lookup can race with refcount_dec_and_test() -> l2tp_session_free() -> kfree_rcu(). The ifname getter is the only outlier; the inconsistency was raised on-list after 979c017803c4 ("l2tp: use list_del_rcu in l2tp_session_unhash"). A reader inside rcu_read_lock_bh() that matches session->ifname can be preempted between the strcmp() and the refcount_inc(). If the last reference drops on another CPU in that window, the reader's refcount_inc() runs on a counter that has reached zero. refcount_t catches the addition-on-zero, prints "refcount_t: addition on 0; use-after-free", saturates the counter, and returns the saturated pointer to the caller. Session memory is held live by the in-flight RCU read section, but the kfree_rcu() callback queued from l2tp_session_free() will free it once the grace period closes; a caller that dereferences the returned session past that point hits a slab-use-after-free. On PREEMPT_RT local_bh_disable() is a per-CPU sleeping lock and the preemption window is real; on stock PREEMPT kernels local_bh_disable() is a preempt_count increment that closes the cross-CPU race in practice (see below). Use refcount_inc_not_zero() and continue the list walk on failure, matching the other session getters in the file. The ifname getter is the only session getter in net/l2tp/ that still uses the bare refcount_inc() pattern; this change restores file-internal consistency. The success path is unchanged.
Title l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References

Subscriptions

Linux Linux Kernel
cve-icon MITRE

Status: PUBLISHED

Assigner: Linux

Published:

Updated: 2026-08-05T12:37:12.656Z

Reserved: 2026-07-19T07:54:57.020Z

Link: CVE-2026-63918

cve-icon Vulnrichment

No data.

cve-icon NVD

No data.

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-07-19T00:00:00Z

Links: CVE-2026-63918 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-08-04T18:30:12Z

Weaknesses
  • CWE-911

    Improper Update of Reference Count