CVE-2025-40063 (GCVE-0-2025-40063)
Vulnerability from cvelistv5
Published
2025-10-28 11:48
Modified
2026-08-05 12:07
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.
Impacted products
Vendor Product Version
Linux Linux Version: 42d9f6c774790d290c175e8775ce9f1366438098
Version: 42d9f6c774790d290c175e8775ce9f1366438098
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"
}


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…