# CVE-2024-49940: l2tp: prevent possible tunnel refcount underflow

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.32% (percentile 17, 2026-11-26)
- **Published:** 2024-10-21T18:01:59.668Z
- **Modified:** 2026-10-30T13:17:39.873Z

## Who should check

- Anyone running Linux \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< aa7132362e79abc4f2add4d8657dd1679341edc5; \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< 98691b2e28a6c3dac0680914493d54c77f215755; \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< f7415e60c25a6108cd7955a20b2e66b6251ffe02; \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< 24256415d18695b46da06c93135f5b51c548b950; b102bfc2a90d14f342580285782a9a51c74f7369; 10c15ddabbcf888922adbdd44ca3fecf6eab19d9; 8d1c650d452c53fcb3f02a7b1d772741639f89a4; 12b5fb58ac993c24210cf8cbc72d407d3a4e6490; aef37401b467a0b1a9517c69924a1d66937e0789; \>= 3.2.99, \< 3.3; …
- Anyone running Linux 4.15

## 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.

## Affected and fixed versions

- Linux: \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< aa7132362e79abc4f2add4d8657dd1679341edc5; \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< 98691b2e28a6c3dac0680914493d54c77f215755; \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< f7415e60c25a6108cd7955a20b2e66b6251ffe02; \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< 24256415d18695b46da06c93135f5b51c548b950; b102bfc2a90d14f342580285782a9a51c74f7369; 10c15ddabbcf888922adbdd44ca3fecf6eab19d9; 8d1c650d452c53fcb3f02a7b1d772741639f89a4; 12b5fb58ac993c24210cf8cbc72d407d3a4e6490; aef37401b467a0b1a9517c69924a1d66937e0789; \>= 3.2.99, \< 3.3; … (cvelist)
- Linux: 4.15 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-49940. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-49940.md
Affected: Linux >= 3953ae7b218df4d1e544b98a393666f9ae58a78c, < aa7132362e79abc4f2add4d8657dd1679341edc5; >= 3953ae7b218df4d1e544b98a393666f9ae58a78c, < 98691b2e28a6c3dac0680914493d54c77f215755; >= 3953ae7b218df4d1e544b98a393666f9ae58a78c, < f7415e60c25a6108cd7955a20b2e66b6251ffe02; >= 3953ae7b218df4d1e544b98…
Fixed in: Linux 98691b2e28a6c3dac0680914493d54c77f215755, Linux 24256415d18695b46da06c93135f5b51c548b950, Linux 3.3

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-49940 being exploited?

There is no confirmed exploitation: CVE-2024-49940 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.32% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-49940?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-49940?

Linux \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< aa7132362e79abc4f2add4d8657dd1679341edc5; \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< 98691b2e28a6c3dac0680914493d54c77f215755; \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< f7415e60c25a6108cd7955a20b2e66b6251ffe02; \>= 3953ae7b218df4d1e544b98a393666f9ae58a78c, \< 24256415d18695b46da06c93135f5b51c548b950; b102bfc2a90d14f342580285782a9a51c74f7369; 10c15ddabbcf888922adbdd44ca3fecf6eab19d9; 8d1c650d452c53fcb3f02a7b1d772741639f89a4; 12b5fb58ac993c24210cf8cbc72d407d3a4e6490; aef37401b467a0b1a9517c69924a1d66937e0789; \>= 3.2.99, \< 3.3; …; Linux 4.15.

### Is there a fix for CVE-2024-49940?

Yes. Fixed in Linux 98691b2e28a6c3dac0680914493d54c77f215755, Linux 24256415d18695b46da06c93135f5b51c548b950, Linux 3.3. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2024-49940?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/f7415e60c25a6108cd7955a20b2e66b6251ffe02>
- patch: <https://git.kernel.org/stable/c/24256415d18695b46da06c93135f5b51c548b950>
- other: <https://git.kernel.org/stable/c/aa7132362e79abc4f2add4d8657dd1679341edc5>
- other: <https://git.kernel.org/stable/c/98691b2e28a6c3dac0680914493d54c77f215755>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-49940>

HTML: <https://flawdb.com/CVE-2024-49940> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-49940>
