CVE-2025-40018 (GCVE-0-2025-40018)
Vulnerability from cvelistv5
Published
2025-10-24 11:44
Modified
2026-08-05 12:07
Summary
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.
Impacted products
Vendor Product Version
Linux Linux Version: 61b1ab4583e275af216c8454b9256de680499b19
Version: 61b1ab4583e275af216c8454b9256de680499b19
Version: 61b1ab4583e275af216c8454b9256de680499b19
Version: 61b1ab4583e275af216c8454b9256de680499b19
Version: 61b1ab4583e275af216c8454b9256de680499b19
Version: 61b1ab4583e275af216c8454b9256de680499b19
Version: 61b1ab4583e275af216c8454b9256de680499b19
Version: 61b1ab4583e275af216c8454b9256de680499b19
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "net/netfilter/ipvs/ip_vs_ftp.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "8a6ecab3847c213ce2855b0378e63ce839085de3",
              "status": "affected",
              "version": "61b1ab4583e275af216c8454b9256de680499b19",
              "versionType": "git"
            },
            {
              "lessThan": "421b1ae1574dfdda68b835c15ac4921ec0030182",
              "status": "affected",
              "version": "61b1ab4583e275af216c8454b9256de680499b19",
              "versionType": "git"
            },
            {
              "lessThan": "1d79471414d7b9424d699afff2aa79fff322f52d",
              "status": "affected",
              "version": "61b1ab4583e275af216c8454b9256de680499b19",
              "versionType": "git"
            },
            {
              "lessThan": "53717f8a4347b78eac6488072ad8e5adbaff38d9",
              "status": "affected",
              "version": "61b1ab4583e275af216c8454b9256de680499b19",
              "versionType": "git"
            },
            {
              "lessThan": "8cbe2a21d85727b66d7c591fd5d83df0d8c4f757",
              "status": "affected",
              "version": "61b1ab4583e275af216c8454b9256de680499b19",
              "versionType": "git"
            },
            {
              "lessThan": "dc1a481359a72ee7e548f1f5da671282a7c13b8f",
              "status": "affected",
              "version": "61b1ab4583e275af216c8454b9256de680499b19",
              "versionType": "git"
            },
            {
              "lessThan": "a343811ef138a265407167294275201621e9ebb2",
              "status": "affected",
              "version": "61b1ab4583e275af216c8454b9256de680499b19",
              "versionType": "git"
            },
            {
              "lessThan": "134121bfd99a06d44ef5ba15a9beb075297c0821",
              "status": "affected",
              "version": "61b1ab4583e275af216c8454b9256de680499b19",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "net/netfilter/ipvs/ip_vs_ftp.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "2.6.39"
            },
            {
              "lessThan": "2.6.39",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.4.*",
              "status": "unaffected",
              "version": "5.4.301",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.246",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.195",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.156",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.6.*",
              "status": "unaffected",
              "version": "6.6.112",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.12.*",
              "status": "unaffected",
              "version": "6.12.53",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.17.*",
              "status": "unaffected",
              "version": "6.17.3",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.18",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.4.301",
                  "versionStartIncluding": "2.6.39",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.10.246",
                  "versionStartIncluding": "2.6.39",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.15.195",
                  "versionStartIncluding": "2.6.39",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.1.156",
                  "versionStartIncluding": "2.6.39",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.6.112",
                  "versionStartIncluding": "2.6.39",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.12.53",
                  "versionStartIncluding": "2.6.39",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.17.3",
                  "versionStartIncluding": "2.6.39",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.18",
                  "versionStartIncluding": "2.6.39",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "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-\u003eapp 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": {
            "baseScore": 7.8,
            "baseSeverity": "HIGH",
            "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
            "version": "3.1"
          },
          "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 \u2014 pernet exit callbacks always run in reverse registration order, so `__ip_vs_ftp_exit()` always precedes the connection flush \u2014 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-\u003euser_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 \u2014 namespace creation, IPVS service setup, connection establishment and namespace teardown \u2014 with no action from any other user.\nS:U - The corruption and any resulting privilege escalation stay within the kernel\u0027s 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()\u0027d `inc-\u003eapp`, 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(\u0026inc-\u003eusecnt)` and `module_put()` through a dangling `inc-\u003eapp` pointer) plus an indirect call through the freed `inc-\u003edone_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."
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-08-05T12:07:05.588Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "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"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2025-40018",
    "datePublished": "2025-10-24T11:44:28.955Z",
    "dateReserved": "2025-04-16T07:20:57.152Z",
    "dateUpdated": "2026-08-05T12:07:05.588Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…