{"id":"CVE-2026-63918","state":"PUBLISHED","title":"l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nl2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname\n\nA reader in l2tp_session_get_by_ifname() can return a pointer to a\nsession whose refcount has reached zero. The getter takes its\nreference with plain refcount_inc(), but every other session getter\nin the same file (l2tp_v2_session_get, l2tp_v3_session_get, and the\ncorresponding _get_next variants) uses refcount_inc_not_zero()\nbecause the IDR/RCU lookup can race with refcount_dec_and_test() ->\nl2tp_session_free() -> kfree_rcu(). The ifname getter is the only\noutlier; the inconsistency was raised on-list after 979c017803c4\n(\"l2tp: use list_del_rcu in l2tp_session_unhash\").\n\nA reader inside rcu_read_lock_bh() that matches session->ifname can\nbe preempted between the strcmp() and the refcount_inc(). If the\nlast reference drops on another CPU in that window, the reader's\nrefcount_inc() runs on a counter that has reached zero. refcount_t\ncatches the addition-on-zero, prints \"refcount_t: addition on 0;\nuse-after-free\", saturates the counter, and returns the saturated\npointer to the caller. Session memory is held live by the in-flight\nRCU read section, but the kfree_rcu() callback queued from\nl2tp_session_free() will free it once the grace period closes; a\ncaller that dereferences the returned session past that point hits\na slab-use-after-free. On PREEMPT_RT local_bh_disable() is a per-CPU\nsleeping lock and the preemption window is real; on stock PREEMPT\nkernels local_bh_disable() is a preempt_count increment that closes\nthe cross-CPU race in practice (see below).\n\nUse refcount_inc_not_zero() and continue the list walk on failure,\nmatching the other session getters in the file. The ifname getter\nis the only session getter in net/l2tp/ that still uses the bare\nrefcount_inc() pattern; this change restores file-internal\nconsistency. The success path is unchanged.","publishedAt":"2026-07-19T14:55:21.414Z","updatedAt":"2026-08-05T12:37:12.656Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"abe7a1a7d0b69e63b1bca5f9531023a52336784f","status":"affected","lessThan":"ee80455feffb9cb62b5b58715cabeff495e666b2","versionType":"git"},{"version":"abe7a1a7d0b69e63b1bca5f9531023a52336784f","status":"affected","lessThan":"947013fd7c8c35dd5856557b215840098a3f67f8","versionType":"git"},{"version":"abe7a1a7d0b69e63b1bca5f9531023a52336784f","status":"affected","lessThan":"782d60a6596aee9b29c2eecfa70033899278bf65","versionType":"git"},{"version":"abe7a1a7d0b69e63b1bca5f9531023a52336784f","status":"affected","lessThan":"05f95729ca844704d15e49ce14868af4b403b32b","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/l2tp/l2tp_core.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.12","versionType":"semver"},{"version":"6.12.93","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.35","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.0.12","status":"unaffected","lessThanOrEqual":"7.0.*","versionType":"semver"},{"version":"7.1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/l2tp/l2tp_core.c"]}],"references":["https://git.kernel.org/stable/c/ee80455feffb9cb62b5b58715cabeff495e666b2","https://git.kernel.org/stable/c/947013fd7c8c35dd5856557b215840098a3f67f8","https://git.kernel.org/stable/c/782d60a6596aee9b29c2eecfa70033899278bf65","https://git.kernel.org/stable/c/05f95729ca844704d15e49ce14868af4b403b32b"],"weaknesses":[],"ingestedAt":"2026-10-29T20:12:41.951Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/63xxx/CVE-2026-63918.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-63918","state":"PUBLISHED","datePublished":"2026-07-19T14:55:21.414Z","dateUpdated":"2026-08-05T12:37:12.656Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-07-19T07:54:57.020Z"},"containers":{"cna":{"title":"l2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nl2tp: use refcount_inc_not_zero in l2tp_session_get_by_ifname\n\nA reader in l2tp_session_get_by_ifname() can return a pointer to a\nsession whose refcount has reached zero. The getter takes its\nreference with plain refcount_inc(), but every other session getter\nin the same file (l2tp_v2_session_get, l2tp_v3_session_get, and the\ncorresponding _get_next variants) uses refcount_inc_not_zero()\nbecause the IDR/RCU lookup can race with refcount_dec_and_test() ->\nl2tp_session_free() -> kfree_rcu(). The ifname getter is the only\noutlier; the inconsistency was raised on-list after 979c017803c4\n(\"l2tp: use list_del_rcu in l2tp_session_unhash\").\n\nA reader inside rcu_read_lock_bh() that matches session->ifname can\nbe preempted between the strcmp() and the refcount_inc(). If the\nlast reference drops on another CPU in that window, the reader's\nrefcount_inc() runs on a counter that has reached zero. refcount_t\ncatches the addition-on-zero, prints \"refcount_t: addition on 0;\nuse-after-free\", saturates the counter, and returns the saturated\npointer to the caller. Session memory is held live by the in-flight\nRCU read section, but the kfree_rcu() callback queued from\nl2tp_session_free() will free it once the grace period closes; a\ncaller that dereferences the returned session past that point hits\na slab-use-after-free. On PREEMPT_RT local_bh_disable() is a per-CPU\nsleeping lock and the preemption window is real; on stock PREEMPT\nkernels local_bh_disable() is a preempt_count increment that closes\nthe cross-CPU race in practice (see below).\n\nUse refcount_inc_not_zero() and continue the list walk on failure,\nmatching the other session getters in the file. The ifname getter\nis the only session getter in net/l2tp/ that still uses the bare\nrefcount_inc() pattern; this change restores file-internal\nconsistency. The success path is unchanged."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"abe7a1a7d0b69e63b1bca5f9531023a52336784f","status":"affected","lessThan":"ee80455feffb9cb62b5b58715cabeff495e666b2","versionType":"git"},{"version":"abe7a1a7d0b69e63b1bca5f9531023a52336784f","status":"affected","lessThan":"947013fd7c8c35dd5856557b215840098a3f67f8","versionType":"git"},{"version":"abe7a1a7d0b69e63b1bca5f9531023a52336784f","status":"affected","lessThan":"782d60a6596aee9b29c2eecfa70033899278bf65","versionType":"git"},{"version":"abe7a1a7d0b69e63b1bca5f9531023a52336784f","status":"affected","lessThan":"05f95729ca844704d15e49ce14868af4b403b32b","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/l2tp/l2tp_core.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.12","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.12","versionType":"semver"},{"version":"6.12.93","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.35","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.0.12","status":"unaffected","lessThanOrEqual":"7.0.*","versionType":"semver"},{"version":"7.1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/l2tp/l2tp_core.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/ee80455feffb9cb62b5b58715cabeff495e666b2"},{"url":"https://git.kernel.org/stable/c/947013fd7c8c35dd5856557b215840098a3f67f8"},{"url":"https://git.kernel.org/stable/c/782d60a6596aee9b29c2eecfa70033899278bf65"},{"url":"https://git.kernel.org/stable/c/05f95729ca844704d15e49ce14868af4b403b32b"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerable code is only reached via the L2TP genetlink management API (netlink syscall), not from the L2TP data-plane packet receive path. Attackers must issue local netlink commands such as SESSION_GET, SESSION_DELETE, or SESSION_MODIFY with L2TP_ATTR_IFNAME.\nAC:L - Exploitation requires racing session lookup-by-ifname against concurrent session deletion, and an attacker with CAP_NET_ADMIN can control both sides by issuing parallel netlink operations. On PREEMPT_RT kernels the preemption window between strcmp() and refcount_inc() is real and reliably winnable.\nPR:L - All affected genetlink commands are gated by GENL_UNS_ADMIN_PERM, requiring CAP_NET_ADMIN in the network namespace. That capability is obtainable by unprivileged users via user/network namespaces (unshare -Urn), not only by init-namespace root.\nUI:N - No victim interaction is required; the attacker triggers the race directly through netlink management commands without needing another user to mount, open, or configure anything.\nS:U - Impact is confined to kernel memory corruption and privilege escalation within the same kernel security domain. This is not a VM escape, sandbox boundary cross, or IOMMU bypass.\nC:H - The bug is a slab use-after-free on struct l2tp_session; returning and later dereferencing a session whose refcount reached zero enables reading freed kernel heap memory and leaking kernel pointers or other sensitive data.\nI:H - UAF on struct l2tp_session corrupts a heap object that contains function pointers (recv_skb, session_close) and is subsequently used by session_delete/modify/notify handlers, enabling arbitrary kernel write or code execution via heap grooming.\nA:H - Dereferencing the freed l2tp_session after the RCU grace period causes kernel oops or panic. Even failed exploitation attempts trigger refcount_t \"addition on 0; use-after-free\" warnings and can crash the system under load."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:37:12.656Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.12.93"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.18.35"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"7.0.12"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"7.1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}