CVE-2025-40018 ipvs: Defer ip_vs_ftp unregister during netns cleanup

High 7.8 Published Updated

A use-after-free in the Linux kernel IPVS FTP module during network namespace cleanup allows attackers to potentially execute code or escalate privileges.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2025-40018?

CVE-2025-40018 is a high-severity use after free vulnerability in Linux, published on 24 Oct 2025. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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

ipvs: Defer ip_vs_ftp unregister during netns cleanup

On the netns cleanup path, __ip_vs_ftp_exit() may unregister ip_vs_ftp before connections with valid cp->app pointers are flushed, leading to a use-after-free.

Fix this by introducing a global `exiting_module` flag, set to true in ip_vs_ftp_exit() before unregistering the pernet subsystem. In __ip_vs_ftp_exit(), skip ip_vs_ftp unregister if called during netns cleanup (when exiting_module is false) and defer it to __ip_vs_cleanup_batch(), which unregisters all apps after all connections are flushed. If called during module exit, unregister ip_vs_ftp immediately.

Which versions are affected by CVE-2025-40018?

How do I fix CVE-2025-40018?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2025-40018 being exploited?

There is no known exploitation of CVE-2025-40018 in the wild and no public exploit code.

Sources

Also known as AZL-68769, BELL-CVE-2025-40018, DEBIAN-CVE-2025-40018, GHSA-25rg-2wrr-633h, ROOT-OS-DEBIAN-11-CVE-2025-40018, ROOT-OS-DEBIAN-12-CVE-2025-40018 and 3 more.

Is CVE-2025-40018 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free