CVE-2024-49940

l2tp: prevent possible tunnel refcount underflow

7.8 high EPSS 0.33%

Published 21 Oct 2024 Updated 30 Oct 2026 CNA: Linux

Check your servers for CVE-2024-49940

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2024-49940 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

Description

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

l2tp: prevent possible tunnel refcount underflow

When a session is created, it sets a backpointer to its tunnel. When the session refcount drops to 0, l2tp_session_free drops the tunnel refcount if session->tunnel is non-NULL. However, session->tunnel is set in l2tp_session_create, before the tunnel refcount is incremented by l2tp_session_register, which leaves a small window where session->tunnel is non-NULL when the tunnel refcount hasn't been bumped.

Moving the assignment to l2tp_session_register is trivial but l2tp_session_create calls l2tp_session_set_header_len which uses session->tunnel to get the tunnel's encap. Add an encap arg to l2tp_session_set_header_len to avoid using session->tunnel.

If l2tpv3 sessions have colliding IDs, it is possible for l2tp_v3_session_get to race with l2tp_session_register and fetch a session which doesn't yet have session->tunnel set. Add a check for this case.

Severity (CVSS)

7.8 high CVSS 3.1 from Linux (CNA)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Attack vector
local: the attacker needs local access, or a user has to open a prepared file
Attack complexity
low: an attack works without special conditions
Privileges required
low: the attacker needs an ordinary user account
User interaction
none: nobody has to click or open anything
Scope
unchanged: the damage stays inside the vulnerable component
Impact
confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)

Exploitation

EPSS 0.33%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 27.5% of all scored CVEs. Scores of 1 Dec 2026.

The assessment of CISA (SSVC, 22 Oct 2024):

Exploitation
none: CISA did not find evidence of exploitation or a public proof of concept
Automatable
no: each attack takes manual steps
Technical impact
partial: limited control or limited data

Affected products

As the CNA lists them.

ProductVersions
Linux
affected from 3953ae7b218df4d1e544b98a393666f9ae58a78c, before aa7132362e79abc4f2add4d8657dd1679341edc5
affected from 3953ae7b218df4d1e544b98a393666f9ae58a78c, before 98691b2e28a6c3dac0680914493d54c77f215755
affected from 3953ae7b218df4d1e544b98a393666f9ae58a78c, before f7415e60c25a6108cd7955a20b2e66b6251ffe02
affected from 3953ae7b218df4d1e544b98a393666f9ae58a78c, before 24256415d18695b46da06c93135f5b51c548b950
affected b102bfc2a90d14f342580285782a9a51c74f7369
affected 10c15ddabbcf888922adbdd44ca3fecf6eab19d9
affected 8d1c650d452c53fcb3f02a7b1d772741639f89a4
affected 12b5fb58ac993c24210cf8cbc72d407d3a4e6490
affected aef37401b467a0b1a9517c69924a1d66937e0789
affected from 3.2.99, before 3.3
affected from 3.16.54, before 3.17
affected from 4.4.225, before 4.5
affected from 4.9.225, before 4.10
affected from 4.14.182, before 4.15
Other versions: unaffected
Linux
affected 4.15
unaffected before 4.15
unaffected from 6.1.191 up to and including 6.1.*
unaffected from 6.6.160 up to and including 6.6.*
unaffected from 6.11.3 up to and including 6.11.*
unaffected 6.12 and later
Other versions: affected

Is my server affected?

This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:

uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2024-49940 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2024-49940

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2024-49940
trivy image --scanners vuln IMAGE | grep CVE-2024-49940

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2024-49940 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.