{ "dataType": "CVE_RECORD", "dataVersion": "5.2", "cveMetadata": { "cveId": "CVE-2025-40018", "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "state": "PUBLISHED", "assignerShortName": "Linux", "dateReserved": "2025-04-16T07:20:57.152Z", "datePublished": "2025-10-24T11:44:28.955Z", "dateUpdated": "2026-08-05T12:07:05.588Z" }, "containers": { "cna": { "providerMetadata": { "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "shortName": "Linux", "dateUpdated": "2026-08-05T12:07:05.588Z" }, "descriptions": [ { "lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nipvs: Defer ip_vs_ftp unregister during netns cleanup\n\nOn the netns cleanup path, __ip_vs_ftp_exit() may unregister ip_vs_ftp\nbefore connections with valid cp->app pointers are flushed, leading to a\nuse-after-free.\n\nFix this by introducing a global `exiting_module` flag, set to true in\nip_vs_ftp_exit() before unregistering the pernet subsystem. In\n__ip_vs_ftp_exit(), skip ip_vs_ftp unregister if called during netns\ncleanup (when exiting_module is false) and defer it to\n__ip_vs_cleanup_batch(), which unregisters all apps after all connections\nare flushed. If called during module exit, unregister ip_vs_ftp\nimmediately." } ], "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 use-after-free is triggered by network namespace teardown, which requires local access (unshare/exit of a netns, or `ip netns del`); while a remote client can populate the FTP-bound IPVS connections through the load balancer, the free-and-use sequence itself is driven locally.\nAC:L - The bad ordering is deterministic — pernet exit callbacks always run in reverse registration order, so `__ip_vs_ftp_exit()` always precedes the connection flush — and the attacker controls both the connection creation and the netns destruction, with ordinary heap grooming sufficing to reclaim the freed `ip_vs_app` objects.\nPR:L - Configuring the IPVS FTP virtual service needs CAP_NET_ADMIN, but `do_ip_vs_set_ctl()` checks `ns_capable(net->user_ns, CAP_NET_ADMIN)` and IPVS was explicitly made usable in non-init user namespaces, so an unprivileged local user obtains it with `unshare -Urn`.\nUI:N - The attacker performs the entire sequence — namespace creation, IPVS service setup, connection establishment and namespace teardown — with no action from any other user.\nS:U - The corruption and any resulting privilege escalation stay within the kernel's own security authority; no VM, IOMMU, or other trust boundary is crossed.\nC:H - `ip_vs_unbind_app()` dereferences the freed `inc` and the already-kfree()'d `inc->app`, so reclaiming those slab objects lets an attacker read and leak kernel heap contents and pointers.\nI:H - The use-after-free yields a write primitive (`atomic_dec(&inc->usecnt)` and `module_put()` through a dangling `inc->app` pointer) plus an indirect call through the freed `inc->done_conn`/`unbind_conn` function pointers, which is a control-flow hijack primitive after heap spraying.\nA:H - Even unexploited, the use-after-free calls a function pointer from reclaimed memory and corrupts refcounts during netns cleanup, reliably producing a kernel oops or panic." } ] } ], "affected": [ { "product": "Linux", "vendor": "Linux", "defaultStatus": "unaffected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "net/netfilter/ipvs/ip_vs_ftp.c" ], "versions": [ { "version": "61b1ab4583e275af216c8454b9256de680499b19", "lessThan": "8a6ecab3847c213ce2855b0378e63ce839085de3", "status": "affected", "versionType": "git" }, { "version": "61b1ab4583e275af216c8454b9256de680499b19", "lessThan": "421b1ae1574dfdda68b835c15ac4921ec0030182", "status": "affected", "versionType": "git" }, { "version": "61b1ab4583e275af216c8454b9256de680499b19", "lessThan": "1d79471414d7b9424d699afff2aa79fff322f52d", "status": "affected", "versionType": "git" }, { "version": "61b1ab4583e275af216c8454b9256de680499b19", "lessThan": "53717f8a4347b78eac6488072ad8e5adbaff38d9", "status": "affected", "versionType": "git" }, { "version": "61b1ab4583e275af216c8454b9256de680499b19", "lessThan": "8cbe2a21d85727b66d7c591fd5d83df0d8c4f757", "status": "affected", "versionType": "git" }, { "version": "61b1ab4583e275af216c8454b9256de680499b19", "lessThan": "dc1a481359a72ee7e548f1f5da671282a7c13b8f", "status": "affected", "versionType": "git" }, { "version": "61b1ab4583e275af216c8454b9256de680499b19", "lessThan": "a343811ef138a265407167294275201621e9ebb2", "status": "affected", "versionType": "git" }, { "version": "61b1ab4583e275af216c8454b9256de680499b19", "lessThan": "134121bfd99a06d44ef5ba15a9beb075297c0821", "status": "affected", "versionType": "git" } ] }, { "product": "Linux", "vendor": "Linux", "defaultStatus": "affected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "net/netfilter/ipvs/ip_vs_ftp.c" ], "versions": [ { "version": "2.6.39", "status": "affected" }, { "version": "0", "lessThan": "2.6.39", "status": "unaffected", "versionType": "semver" }, { "version": "5.4.301", "lessThanOrEqual": "5.4.*", "status": "unaffected", "versionType": "semver" }, { "version": "5.10.246", "lessThanOrEqual": "5.10.*", "status": "unaffected", "versionType": "semver" }, { "version": "5.15.195", "lessThanOrEqual": "5.15.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.1.156", "lessThanOrEqual": "6.1.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.6.112", "lessThanOrEqual": "6.6.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.12.53", "lessThanOrEqual": "6.12.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.17.3", "lessThanOrEqual": "6.17.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.18", "lessThanOrEqual": "*", "status": "unaffected", "versionType": "original_commit_for_fix" } ] } ], "cpeApplicability": [ { "nodes": [ { "operator": "OR", "negate": false, "cpeMatch": [ { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.6.39", "versionEndExcluding": "5.4.301" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.6.39", "versionEndExcluding": "5.10.246" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.6.39", "versionEndExcluding": "5.15.195" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.6.39", "versionEndExcluding": "6.1.156" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.6.39", "versionEndExcluding": "6.6.112" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.6.39", "versionEndExcluding": "6.12.53" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.6.39", "versionEndExcluding": "6.17.3" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "2.6.39", "versionEndExcluding": "6.18" } ] } ] } ], "references": [ { "url": "https://git.kernel.org/stable/c/8a6ecab3847c213ce2855b0378e63ce839085de3" }, { "url": "https://git.kernel.org/stable/c/421b1ae1574dfdda68b835c15ac4921ec0030182" }, { "url": "https://git.kernel.org/stable/c/1d79471414d7b9424d699afff2aa79fff322f52d" }, { "url": "https://git.kernel.org/stable/c/53717f8a4347b78eac6488072ad8e5adbaff38d9" }, { "url": "https://git.kernel.org/stable/c/8cbe2a21d85727b66d7c591fd5d83df0d8c4f757" }, { "url": "https://git.kernel.org/stable/c/dc1a481359a72ee7e548f1f5da671282a7c13b8f" }, { "url": "https://git.kernel.org/stable/c/a343811ef138a265407167294275201621e9ebb2" }, { "url": "https://git.kernel.org/stable/c/134121bfd99a06d44ef5ba15a9beb075297c0821" } ], "title": "ipvs: Defer ip_vs_ftp unregister during netns cleanup", "x_generator": { "engine": "bippy-1.2.0" } } } }