GCVE Workshop - 22 September 2026 (14:00-18:00), Luxembourg Before The Vulnopticon Conference - Registration

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.
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-09-17",
      "epss": "0.00121",
      "percentile": "0.022"
    },
    "nvd": "{\"cve\":{\"id\":\"CVE-2025-40063\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2025-10-28T12:15:40.730\",\"lastModified\":\"2026-07-30T06:24:08.960\",\"vulnStatus\":\"Deferred\",\"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.\"}],\"affected\":[{\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"affectedData\":[{\"vendor\":\"Linux\",\"product\":\"Linux\",\"defaultStatus\":\"unaffected\",\"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\",\"versions\":[{\"version\":\"42d9f6c774790d290c175e8775ce9f1366438098\",\"lessThan\":\"779d3b6f2d32c5f1da6163e959abe1e1ffe2945b\",\"versionType\":\"git\",\"status\":\"affected\"},{\"version\":\"42d9f6c774790d290c175e8775ce9f1366438098\",\"lessThan\":\"f75f66683ded09f7135aef2e763c245a07c8271a\",\"versionType\":\"git\",\"status\":\"affected\"}]},{\"vendor\":\"Linux\",\"product\":\"Linux\",\"defaultStatus\":\"affected\",\"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\",\"versions\":[{\"version\":\"6.16\",\"status\":\"affected\"},{\"version\":\"0\",\"lessThan\":\"6.16\",\"versionType\":\"semver\",\"status\":\"unaffected\"},{\"version\":\"6.17.3\",\"lessThanOrEqual\":\"6.17.*\",\"versionType\":\"semver\",\"status\":\"unaffected\"},{\"version\":\"6.18\",\"lessThanOrEqual\":\"*\",\"versionType\":\"original_commit_for_fix\",\"status\":\"unaffected\"}]}]}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"type\":\"Secondary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H\",\"baseScore\":7.0,\"baseSeverity\":\"HIGH\",\"attackVector\":\"LOCAL\",\"attackComplexity\":\"HIGH\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"HIGH\",\"integrityImpact\":\"HIGH\",\"availabilityImpact\":\"HIGH\"},\"exploitabilityScore\":1.0,\"impactScore\":5.9}]},\"references\":[{\"url\":\"https://git.kernel.org/stable/c/779d3b6f2d32c5f1da6163e959abe1e1ffe2945b\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/f75f66683ded09f7135aef2e763c245a07c8271a\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"}]}}",
    "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…

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.

Loading…

Detection rules are retrieved from Rulezet.

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.


Loading…