CVE-2025-40063 (GCVE-0-2025-40063)

Vulnerability from cvelistv5 – Published: 2025-10-28 11:48 – Updated: 2026-08-05 12:07
VLAI
Title
crypto: comp - Use same definition of context alloc and free ops
Summary
In the Linux kernel, the following vulnerability has been resolved: crypto: comp - Use same definition of context alloc and free ops In commit 42d9f6c77479 ("crypto: acomp - Move scomp stream allocation code into acomp"), the crypto_acomp_streams struct was made to rely on having the alloc_ctx and free_ctx operations defined in the same order as the scomp_alg struct. But in that same commit, the alloc_ctx and free_ctx members of scomp_alg may be randomized by structure layout randomization, since they are contained in a pure ops structure (containing only function pointers). If the pointers within scomp_alg are randomized, but those in crypto_acomp_streams are not, then the order may no longer match. This fixes the problem by removing the union from scomp_alg so that both crypto_acomp_streams and scomp_alg will share the same definition of alloc_ctx and free_ctx, ensuring they will always have the same layout.
Assigner
Linux CNA under the mitre root
CNA scorecard D 53/100 over 7063 records in the last 180 days details
Impacted products
Vendor Product Version CPE status
Linux Linux Affected: 42d9f6c774790d290c175e8775ce9f1366438098 , < 779d3b6f2d32c5f1da6163e959abe1e1ffe2945b (git)
Affected: 42d9f6c774790d290c175e8775ce9f1366438098 , < f75f66683ded09f7135aef2e763c245a07c8271a (git)
guessed Create a notification for this product.
Linux Linux Affected: 6.16
Unaffected: 0 , < 6.16 (semver)
Unaffected: 6.17.3 , ≤ 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": [
            "crypto/842.c",
            "crypto/lz4.c",
            "crypto/lz4hc.c",
            "crypto/lzo-rle.c",
            "crypto/lzo.c",
            "drivers/crypto/nx/nx-common-powernv.c",
            "drivers/crypto/nx/nx-common-pseries.c",
            "include/crypto/internal/scompress.h"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "779d3b6f2d32c5f1da6163e959abe1e1ffe2945b",
              "status": "affected",
              "version": "42d9f6c774790d290c175e8775ce9f1366438098",
              "versionType": "git"
            },
            {
              "lessThan": "f75f66683ded09f7135aef2e763c245a07c8271a",
              "status": "affected",
              "version": "42d9f6c774790d290c175e8775ce9f1366438098",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "crypto/842.c",
            "crypto/lz4.c",
            "crypto/lz4hc.c",
            "crypto/lzo-rle.c",
            "crypto/lzo.c",
            "drivers/crypto/nx/nx-common-powernv.c",
            "drivers/crypto/nx/nx-common-pseries.c",
            "include/crypto/internal/scompress.h"
          ],
          "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.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": "6.17.3",
                  "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\ncrypto: comp - Use same definition of context alloc and free ops\n\nIn commit 42d9f6c77479 (\"crypto: acomp - Move scomp stream allocation\ncode into acomp\"), the crypto_acomp_streams struct was made to rely on\nhaving the alloc_ctx and free_ctx operations defined in the same order\nas the scomp_alg struct. But in that same commit, the alloc_ctx and\nfree_ctx members of scomp_alg may be randomized by structure layout\nrandomization, since they are contained in a pure ops structure\n(containing only function pointers). If the pointers within scomp_alg\nare randomized, but those in crypto_acomp_streams are not, then\nthe order may no longer match. This fixes the problem by removing the\nunion from scomp_alg so that both crypto_acomp_streams and scomp_alg\nwill share the same definition of alloc_ctx and free_ctx, ensuring\nthey will always have the same layout."
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "baseScore": 7,
            "baseSeverity": "HIGH",
            "vectorString": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H",
            "version": "3.1"
          },
          "scenarios": [
            {
              "lang": "en",
              "value": "AV:L - The affected algorithms (lzo, lzo-rle, lz4, lz4hc, 842, nx842) are reached only through local kernel consumers \u2014 zswap page compression, UBIFS, and boot-time crypto self-tests \u2014 via `crypto_scomp_init_tfm()`. The only remote consumer of the compression API, IPComp/xfrm, uses deflate, which is an `acomp_alg` with its own `crypto_acomp_streams` and is unaffected.\nAC:H - Manifestation requires a kernel built with CONFIG_RANDSTRUCT_FULL/PERFORMANCE (the default is RANDSTRUCT_NONE) *and* a per-build randomization seed that actually transposes `alloc_ctx`/`free_ctx` in the pure-ops anonymous struct. Both are fixed at compile time and entirely beyond the attacker\u0027s control, so a susceptible target must be found rather than created.\nPR:L - On a susceptible build, an unprivileged local process can drive the faulty path simply by generating memory pressure that makes zswap compress its pages, which triggers per-CPU `alloc_ctx()` calls in `acomp_stream_workfn()`; no capability or namespace privilege is needed. Only basic local code execution is required.\nUI:N - Compression is performed by the kernel as part of normal swap/filesystem operation driven by the attacker\u0027s own allocations. No victim action such as mounting a filesystem or opening a file is required.\nS:U - The corruption is confined to kernel memory within the same security authority; there is no VM, IOMMU, or sandbox boundary crossed. This is a standard in-kernel memory-corruption issue.\nC:H - The garbage return value of the mis-called `free_ctx` becomes `stream-\u003ectx` and is used as the compression workspace, and the uncontrolled `kvfree()` corrupts the heap, yielding primitives that can be leveraged to read arbitrary kernel memory. Decompression additionally reads through the wild context pointer.\nI:H - `lzo1x_1_compress()` writes up to LZO1X_MEM_COMPRESS (16KB) of hash-table state through the uncontrolled `ctx` pointer, an arbitrary kernel write, and `kvfree()` on a garbage pointer is an arbitrary-free primitive enabling heap grooming and control-flow hijack.\nA:H - Calling `kvfree()` on an uninitialized register value and then dereferencing a wild pointer as a scratch buffer reliably produces an oops or panic; on CFI-enabled builds the type-mismatched indirect call itself panics. The system is effectively unbootable or crashes on first compression."
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-08-05T12:07:28.106Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/779d3b6f2d32c5f1da6163e959abe1e1ffe2945b"
        },
        {
          "url": "https://git.kernel.org/stable/c/f75f66683ded09f7135aef2e763c245a07c8271a"
        }
      ],
      "title": "crypto: comp - Use same definition of context alloc and free ops",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2025-40063",
    "datePublished": "2025-10-28T11:48:34.549Z",
    "dateReserved": "2025-04-16T07:20:57.159Z",
    "dateUpdated": "2026-08-05T12:07:28.106Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "vulnerability-lookup:meta": {
    "epss": {
      "cve": "CVE-2025-40063",
      "date": "2026-10-27",
      "epss": "0.0013",
      "percentile": "0.02585"
    },
    "nvd": {
      "cve": {
        "affected": [
          {
            "affectedData": [
              {
                "defaultStatus": "unaffected",
                "product": "Linux",
                "programFiles": [
                  "crypto/842.c",
                  "crypto/lz4.c",
                  "crypto/lz4hc.c",
                  "crypto/lzo-rle.c",
                  "crypto/lzo.c",
                  "drivers/crypto/nx/nx-common-powernv.c",
                  "drivers/crypto/nx/nx-common-pseries.c",
                  "include/crypto/internal/scompress.h"
                ],
                "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                "vendor": "Linux",
                "versions": [
                  {
                    "lessThan": "779d3b6f2d32c5f1da6163e959abe1e1ffe2945b",
                    "status": "affected",
                    "version": "42d9f6c774790d290c175e8775ce9f1366438098",
                    "versionType": "git"
                  },
                  {
                    "lessThan": "f75f66683ded09f7135aef2e763c245a07c8271a",
                    "status": "affected",
                    "version": "42d9f6c774790d290c175e8775ce9f1366438098",
                    "versionType": "git"
                  }
                ]
              },
              {
                "defaultStatus": "affected",
                "product": "Linux",
                "programFiles": [
                  "crypto/842.c",
                  "crypto/lz4.c",
                  "crypto/lz4hc.c",
                  "crypto/lzo-rle.c",
                  "crypto/lzo.c",
                  "drivers/crypto/nx/nx-common-powernv.c",
                  "drivers/crypto/nx/nx-common-pseries.c",
                  "include/crypto/internal/scompress.h"
                ],
                "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.3",
                    "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\ncrypto: comp - Use same definition of context alloc and free ops\n\nIn commit 42d9f6c77479 (\"crypto: acomp - Move scomp stream allocation\ncode into acomp\"), the crypto_acomp_streams struct was made to rely on\nhaving the alloc_ctx and free_ctx operations defined in the same order\nas the scomp_alg struct. But in that same commit, the alloc_ctx and\nfree_ctx members of scomp_alg may be randomized by structure layout\nrandomization, since they are contained in a pure ops structure\n(containing only function pointers). If the pointers within scomp_alg\nare randomized, but those in crypto_acomp_streams are not, then\nthe order may no longer match. This fixes the problem by removing the\nunion from scomp_alg so that both crypto_acomp_streams and scomp_alg\nwill share the same definition of alloc_ctx and free_ctx, ensuring\nthey will always have the same layout."
          },
          {
            "lang": "es",
            "value": "En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\ncrypto: comp - Usar la misma definici\u00f3n de operaciones de asignaci\u00f3n y liberaci\u00f3n de contexto\n\nEn el commit 42d9f6c77479 (\u0027crypto: acomp - Mover el c\u00f3digo de asignaci\u00f3n de flujo scomp a acomp\u0027), se hizo que la estructura crypto_acomp_streams dependiera de tener las operaciones alloc_ctx y free_ctx definidas en el mismo orden que la estructura scomp_alg. Pero en ese mismo commit, los miembros alloc_ctx y free_ctx de scomp_alg pueden ser aleatorizados por la aleatorizaci\u00f3n del dise\u00f1o de la estructura, ya que est\u00e1n contenidos en una estructura de operaciones pura (que contiene solo punteros a funciones). Si los punteros dentro de scomp_alg son aleatorizados, pero los de crypto_acomp_streams no lo son, entonces el orden puede dejar de coincidir. Esto soluciona el problema al eliminar la uni\u00f3n de scomp_alg para que tanto crypto_acomp_streams como scomp_alg compartan la misma definici\u00f3n de alloc_ctx y free_ctx, asegurando que siempre tendr\u00e1n el mismo dise\u00f1o."
          }
        ],
        "id": "CVE-2025-40063",
        "lastModified": "2026-10-19T21:10:00.160",
        "metrics": {
          "cvssMetricV31": [
            {
              "cvssData": {
                "attackComplexity": "HIGH",
                "attackVector": "LOCAL",
                "availabilityImpact": "HIGH",
                "baseScore": 7.0,
                "baseSeverity": "HIGH",
                "confidentialityImpact": "HIGH",
                "integrityImpact": "HIGH",
                "privilegesRequired": "LOW",
                "scope": "UNCHANGED",
                "userInteraction": "NONE",
                "vectorString": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H",
                "version": "3.1"
              },
              "exploitabilityScore": 1.0,
              "impactScore": 5.9,
              "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
              "type": "Secondary"
            }
          ]
        },
        "published": "2025-10-28T12:15:40.730",
        "references": [
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/779d3b6f2d32c5f1da6163e959abe1e1ffe2945b"
          },
          {
            "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
            "url": "https://git.kernel.org/stable/c/f75f66683ded09f7135aef2e763c245a07c8271a"
          }
        ],
        "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "vulnStatus": "Deferred"
      }
    },
    "redhat_vex": {
      "aggregate_severity": "Moderate",
      "current_release_date": "2026-07-30T08:52:54+00:00",
      "cve": "CVE-2025-40063",
      "id": "CVE-2025-40063",
      "initial_release_date": "2025-10-28T00:00:00+00:00",
      "product_status:known_affected": "14",
      "product_status:known_not_affected": "260",
      "source": "Red Hat CSAF VEX",
      "status": "final",
      "title": "kernel: crypto: comp - Use same definition of context alloc and free ops",
      "url": "https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-40063.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.