CVE-2025-40256 (GCVE-0-2025-40256)

Vulnerability from cvelistv5 – Published: 2025-12-04 16:08 – Updated: 2026-05-11 21:45
VLAI
Title
xfrm: also call xfrm_state_delete_tunnel at destroy time for states that were never added
Summary
In the Linux kernel, the following vulnerability has been resolved: xfrm: also call xfrm_state_delete_tunnel at destroy time for states that were never added In commit b441cf3f8c4b ("xfrm: delete x->tunnel as we delete x"), I missed the case where state creation fails between full initialization (->init_state has been called) and being inserted on the lists. In this situation, ->init_state has been called, so for IPcomp tunnels, the fallback tunnel has been created and added onto the lists, but the user state never gets added, because we fail before that. The user state doesn't go through __xfrm_state_delete, so we don't call xfrm_state_delete_tunnel for those states, and we end up leaking the FB tunnel. There are several codepaths affected by this: the add/update paths, in both net/key and xfrm, and the migrate code (xfrm_migrate, xfrm_state_migrate). A "proper" rollback of the init_state work would probably be doable in the add/update code, but for migrate it gets more complicated as multiple states may be involved. At some point, the new (not-inserted) state will be destroyed, so call xfrm_state_delete_tunnel during xfrm_state_gc_destroy. Most states will have their fallback tunnel cleaned up during __xfrm_state_delete, which solves the issue that b441cf3f8c4b (and other patches before it) aimed at. All states (including FB tunnels) will be removed from the lists once xfrm_state_fini has called flush_work(&xfrm_state_gc_work).
Severity
No CVSS data available.
Assigner
Linux CNA under the mitre root
CNA scorecard D 53/100 over 6843 records in the last 180 days details
Impacted products
Vendor Product Version CPE status
Linux Linux Affected: 1b28a7fae0128fa140a7dccd995182ff6cd1c67b , < 57b72d74d4651dc19d046308a8304eb9abfe66ac (git)
Affected: 4b2c17d0f9be8b58bb30468bc81a4b61c985b04e , < 1dad653643f28ccc89be93f9440b8804cded85b2 (git)
Affected: 0da961fa46da1b37ef868d9b603bd202136f8f8e , < 64441724387b4ac92f67ef51caaaeffe99c950d1 (git)
Affected: d0e0d1097118461463b76562c7ebaabaa5b90b13 , < 763e5c351206c1e4d910db4a1159053f6263689c (git)
Affected: dc3636912d41770466543623cb76e7b88fdb42c7 , < f7d879c19d306512c2e260f37e8a3e5c85e37c50 (git)
Affected: b441cf3f8c4b8576639d20c8eb4aa32917602ecd , < d6fe5c740c573af10943b8353992e1325cdb2715 (git)
Affected: b441cf3f8c4b8576639d20c8eb4aa32917602ecd , < 10deb69864840ccf96b00ac2ab3a2055c0c04721 (git)
guessed Create a notification for this product.
Linux Linux Affected: 6.16
Unaffected: 0 , < 6.16 (semver)
Unaffected: 6.17.10 , ≤ 6.17.* (semver)
Unaffected: 6.18 , ≤ * (original_commit_for_fix)
guessed Create a notification for this product.
Show details on NVD website

{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "net/xfrm/xfrm_state.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "57b72d74d4651dc19d046308a8304eb9abfe66ac",
              "status": "affected",
              "version": "1b28a7fae0128fa140a7dccd995182ff6cd1c67b",
              "versionType": "git"
            },
            {
              "lessThan": "1dad653643f28ccc89be93f9440b8804cded85b2",
              "status": "affected",
              "version": "4b2c17d0f9be8b58bb30468bc81a4b61c985b04e",
              "versionType": "git"
            },
            {
              "lessThan": "64441724387b4ac92f67ef51caaaeffe99c950d1",
              "status": "affected",
              "version": "0da961fa46da1b37ef868d9b603bd202136f8f8e",
              "versionType": "git"
            },
            {
              "lessThan": "763e5c351206c1e4d910db4a1159053f6263689c",
              "status": "affected",
              "version": "d0e0d1097118461463b76562c7ebaabaa5b90b13",
              "versionType": "git"
            },
            {
              "lessThan": "f7d879c19d306512c2e260f37e8a3e5c85e37c50",
              "status": "affected",
              "version": "dc3636912d41770466543623cb76e7b88fdb42c7",
              "versionType": "git"
            },
            {
              "lessThan": "d6fe5c740c573af10943b8353992e1325cdb2715",
              "status": "affected",
              "version": "b441cf3f8c4b8576639d20c8eb4aa32917602ecd",
              "versionType": "git"
            },
            {
              "lessThan": "10deb69864840ccf96b00ac2ab3a2055c0c04721",
              "status": "affected",
              "version": "b441cf3f8c4b8576639d20c8eb4aa32917602ecd",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "net/xfrm/xfrm_state.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.16"
            },
            {
              "lessThan": "6.16",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.17.*",
              "status": "unaffected",
              "version": "6.17.10",
              "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": "6.17.10",
                  "versionStartIncluding": "6.16",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.18",
                  "versionStartIncluding": "6.16",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nxfrm: also call xfrm_state_delete_tunnel at destroy time for states that were never added\n\nIn commit b441cf3f8c4b (\"xfrm: delete x-\u003etunnel as we delete x\"), I\nmissed the case where state creation fails between full\ninitialization (-\u003einit_state has been called) and being inserted on\nthe lists.\n\nIn this situation, -\u003einit_state has been called, so for IPcomp\ntunnels, the fallback tunnel has been created and added onto the\nlists, but the user state never gets added, because we fail before\nthat. The user state doesn\u0027t go through __xfrm_state_delete, so we\ndon\u0027t call xfrm_state_delete_tunnel for those states, and we end up\nleaking the FB tunnel.\n\nThere are several codepaths affected by this: the add/update paths, in\nboth net/key and xfrm, and the migrate code (xfrm_migrate,\nxfrm_state_migrate). A \"proper\" rollback of the init_state work would\nprobably be doable in the add/update code, but for migrate it gets\nmore complicated as multiple states may be involved.\n\nAt some point, the new (not-inserted) state will be destroyed, so call\nxfrm_state_delete_tunnel during xfrm_state_gc_destroy. Most states\nwill have their fallback tunnel cleaned up during __xfrm_state_delete,\nwhich solves the issue that b441cf3f8c4b (and other patches before it)\naimed at. All states (including FB tunnels) will be removed from the\nlists once xfrm_state_fini has called flush_work(\u0026xfrm_state_gc_work)."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-05-11T21:45:48.998Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/57b72d74d4651dc19d046308a8304eb9abfe66ac"
        },
        {
          "url": "https://git.kernel.org/stable/c/1dad653643f28ccc89be93f9440b8804cded85b2"
        },
        {
          "url": "https://git.kernel.org/stable/c/64441724387b4ac92f67ef51caaaeffe99c950d1"
        },
        {
          "url": "https://git.kernel.org/stable/c/763e5c351206c1e4d910db4a1159053f6263689c"
        },
        {
          "url": "https://git.kernel.org/stable/c/f7d879c19d306512c2e260f37e8a3e5c85e37c50"
        },
        {
          "url": "https://git.kernel.org/stable/c/d6fe5c740c573af10943b8353992e1325cdb2715"
        },
        {
          "url": "https://git.kernel.org/stable/c/10deb69864840ccf96b00ac2ab3a2055c0c04721"
        }
      ],
      "title": "xfrm: also call xfrm_state_delete_tunnel at destroy time for states that were never added",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2025-40256",
    "datePublished": "2025-12-04T16:08:17.756Z",
    "dateReserved": "2025-04-16T07:20:57.181Z",
    "dateUpdated": "2026-05-11T21:45:48.998Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "epss": {
      "cve": "CVE-2025-40256",
      "date": "2026-10-22",
      "epss": "0.00207",
      "percentile": "0.10222"
    },
    "nvd": {
      "cve": {
        "affected": [
          {
            "affectedData": [
              {
                "defaultStatus": "unaffected",
                "product": "Linux",
                "programFiles": [
                  "net/xfrm/xfrm_state.c"
                ],
                "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                "vendor": "Linux",
                "versions": [
                  {
                    "lessThan": "57b72d74d4651dc19d046308a8304eb9abfe66ac",
                    "status": "affected",
                    "version": "1b28a7fae0128fa140a7dccd995182ff6cd1c67b",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "1dad653643f28ccc89be93f9440b8804cded85b2",
                    "status": "affected",
                    "version": "4b2c17d0f9be8b58bb30468bc81a4b61c985b04e",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "64441724387b4ac92f67ef51caaaeffe99c950d1",
                    "status": "affected",
                    "version": "0da961fa46da1b37ef868d9b603bd202136f8f8e",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "763e5c351206c1e4d910db4a1159053f6263689c",
                    "status": "affected",
                    "version": "d0e0d1097118461463b76562c7ebaabaa5b90b13",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "f7d879c19d306512c2e260f37e8a3e5c85e37c50",
                    "status": "affected",
                    "version": "dc3636912d41770466543623cb76e7b88fdb42c7",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "d6fe5c740c573af10943b8353992e1325cdb2715",
                    "status": "affected",
                    "version": "b441cf3f8c4b8576639d20c8eb4aa32917602ecd",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "10deb69864840ccf96b00ac2ab3a2055c0c04721",
                    "status": "affected",
                    "version": "b441cf3f8c4b8576639d20c8eb4aa32917602ecd",
                    "versionType": "git"
                  }
                ]
              },
              {
                "defaultStatus": "affected",
                "product": "Linux",
                "programFiles": [
                  "net/xfrm/xfrm_state.c"
                ],
                "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                "vendor": "Linux",
                "versions": [
                  {
                    "status": "affected",
                    "version": "6.16"
                  },
                  {
                    "lessThan": "6.16",
                    "status": "unaffected",
                    "version": "0",
                    "versionType": "semver"
                  },
                  {
                    "lessThanOrEqual": "6.17.*",
                    "status": "unaffected",
                    "version": "6.17.10",
                    "versionType": "semver"
                  },
                  {
                    "lessThanOrEqual": "*",
                    "status": "unaffected",
                    "version": "6.18",
                    "versionType": "original_commit_for_fix"
                  }
                ]
              }
            ],
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
          }
        ],
        "cveTags": [],
        "descriptions": [
          {
            "lang": "en",
            "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nxfrm: also call xfrm_state_delete_tunnel at destroy time for states that were never added\n\nIn commit b441cf3f8c4b (\"xfrm: delete x-\u003etunnel as we delete x\"), I\nmissed the case where state creation fails between full\ninitialization (-\u003einit_state has been called) and being inserted on\nthe lists.\n\nIn this situation, -\u003einit_state has been called, so for IPcomp\ntunnels, the fallback tunnel has been created and added onto the\nlists, but the user state never gets added, because we fail before\nthat. The user state doesn\u0027t go through __xfrm_state_delete, so we\ndon\u0027t call xfrm_state_delete_tunnel for those states, and we end up\nleaking the FB tunnel.\n\nThere are several codepaths affected by this: the add/update paths, in\nboth net/key and xfrm, and the migrate code (xfrm_migrate,\nxfrm_state_migrate). A \"proper\" rollback of the init_state work would\nprobably be doable in the add/update code, but for migrate it gets\nmore complicated as multiple states may be involved.\n\nAt some point, the new (not-inserted) state will be destroyed, so call\nxfrm_state_delete_tunnel during xfrm_state_gc_destroy. Most states\nwill have their fallback tunnel cleaned up during __xfrm_state_delete,\nwhich solves the issue that b441cf3f8c4b (and other patches before it)\naimed at. All states (including FB tunnels) will be removed from the\nlists once xfrm_state_fini has called flush_work(\u0026xfrm_state_gc_work)."
          },
          {
            "lang": "es",
            "value": "En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nxfrm: tambi\u00e9n llamar a xfrm_state_delete_tunnel en el momento de la destrucci\u00f3n para estados que nunca fueron a\u00f1adidos\n\nEn el commit b441cf3f8c4b (\u201cxfrm: eliminar x -\u003e tunnel al eliminar x\u201d), omit\u00ed el caso en que la creaci\u00f3n del estado falla entre la inicializaci\u00f3n completa (se ha llamado a  -\u003e init_state) y su inserci\u00f3n en las listas.\n\nEn esta situaci\u00f3n, se ha llamado a  -\u003e init_state, por lo tanto, para los t\u00faneles IPcomp, el t\u00fanel de respaldo ha sido creado y a\u00f1adido a las listas, pero el estado de usuario nunca se a\u00f1ade, porque fallamos antes de eso. El estado de usuario no pasa por __xfrm_state_delete, por lo que no llamamos a xfrm_state_delete_tunnel para esos estados, y terminamos fugando el t\u00fanel FB.\n\nHay varias rutas de c\u00f3digo afectadas por esto: las rutas de adici\u00f3n/actualizaci\u00f3n, tanto en net/key como en xfrm, y el c\u00f3digo de migraci\u00f3n (xfrm_migrate, xfrm_state_migrate). Una reversi\u00f3n \u201cadecuada\u201d del trabajo de init_state probablemente ser\u00eda factible en el c\u00f3digo de adici\u00f3n/actualizaci\u00f3n, pero para la migraci\u00f3n se complica m\u00e1s ya que pueden estar involucrados m\u00faltiples estados.\n\nEn alg\u00fan momento, el nuevo estado (no insertado) ser\u00e1 destruido, as\u00ed que se llama a xfrm_state_delete_tunnel durante xfrm_state_gc_destroy. La mayor\u00eda de los estados tendr\u00e1n su t\u00fanel de respaldo limpiado durante __xfrm_state_delete, lo que resuelve el problema al que apuntaba b441cf3f8c4b (y otros parches anteriores). Todos los estados (incluidos los t\u00faneles FB) ser\u00e1n eliminados de las listas una vez que xfrm_state_fini haya llamado a flush_work(\u0026xfrm_state_gc_work)."
          }
        ],
        "id": "CVE-2025-40256",
        "lastModified": "2026-10-19T19:10:00.130",
        "metrics": {},
        "published": "2025-12-04T16:16:19.367",
        "references": [
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/10deb69864840ccf96b00ac2ab3a2055c0c04721"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/1dad653643f28ccc89be93f9440b8804cded85b2"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/57b72d74d4651dc19d046308a8304eb9abfe66ac"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/64441724387b4ac92f67ef51caaaeffe99c950d1"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/763e5c351206c1e4d910db4a1159053f6263689c"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/d6fe5c740c573af10943b8353992e1325cdb2715"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/f7d879c19d306512c2e260f37e8a3e5c85e37c50"
          }
        ],
        "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "vulnStatus": "Deferred"
      }
    },
    "redhat_vex": {
      "aggregate_severity": "Moderate",
      "current_release_date": "2026-06-30T10:15:17+00:00",
      "cve": "CVE-2025-40256",
      "id": "CVE-2025-40256",
      "initial_release_date": "2025-12-04T00:00:00+00:00",
      "product_status:known_not_affected": "274",
      "source": "Red Hat CSAF VEX",
      "status": "final",
      "title": "kernel: xfrm: also call xfrm_state_delete_tunnel at destroy time for states that were never added",
      "url": "https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-40256.json",
      "version": "3"
    }
  }
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.