CVE-2026-138921
published high CVSS 3.1 · 7.8crypto: caam - fix double-free in caam_rsa_set_priv_key_form()
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Linux | — | Linux52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < 068e85ed81838a9d98c3018d532402dbd360fd1f · 52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < 35b3176839fa1842ae1a6e3b2bbbc37d34237614 · 52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < a5e1e36dace783c8d1688a299a3919f4d624217d · 52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < ad78e2cd8b4dde0b8c52bb5227e09faf3f49b939 · 52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < e7a5cea8804f1210fe45c3a0281b11943c58553f · 52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < f3e503a31d3cfdc8fae1baeb0ad5ba8471ceea9d · 52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < 523eb58df5c11531a99f2e75d08e10f20cc28565 · 52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < a91d9346a70b68f77884cba9d9ec3b70f96bf9d2 · Other versions: unaffected | Affected | Not stated | Linux |
| Linux | — | Linux4.13 (affected) · 0 to < 4.13 (unaffected · semver) · 5.10.275 through 5.10.* (unaffected · semver) · 5.15.226 through 5.15.* (unaffected · semver) · 6.1.193 through 6.1.* (unaffected · semver) · 6.6.163 through 6.6.* (unaffected · semver) · 6.12.117 through 6.12.* (unaffected · semver) · 6.18.63 through 6.18.* (unaffected · semver) · 7.3.4 through 7.3.* (unaffected · semver) · 7.4-rc1 and later (unaffected · original_commit_for_fix) · Other versions: affected | Version-specific | Not stated | Linux |
| Amazon Linux | AL2 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
| Amazon Linux | AL2023 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
Description
In the Linux kernel, the following vulnerability has been resolved: crypto: caam - fix double-free in caam_rsa_set_priv_key_form() caam_rsa_set_priv_key_form() frees the partially allocated key components (p, q, tmp1, tmp2, dp, dq) with kfree_sensitive() on its error path, but does not set those pointers to NULL afterward. When the function returns an error, caam_rsa_set_priv_key() jumps to its err label and calls caam_rsa_free_key(), which frees all of those same pointers again, resulting in a double-free. This is reachable when the allocation of q, tmp1, tmp2, dp, dq or qinv fails, e.g. under memory pressure, or for a malformed key whose CRT members decode to zero length and make caam_read_rsa_crt() return NULL. Set each pointer to NULL right after freeing it so that the subsequent caam_rsa_free_key() call becomes a no-op for the already-freed fields.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.8 / 10
- Severity
- high
- Provider
- Linux · cna
- Vector string
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Scenarios
- en: AV:L - The malformed RSA key is local data: a process adds a PKCS#8 blob with add_key("asymmetric") and then calls keyctl(KEYCTL_PKEY_QUERY), and software_key_query() passes it to crypto_akcipher_set_priv_key() on rsa-caam. No network protocol carries the key, and AF_ALG has no akcipher interface. AC:L - On a CAAM/PKHA system with the PKCS#8 parser available, a key whose prime2 or a CRT field is INTEGER 0 passes rsa_get_q()/rsa_get_dp(), but caam_read_raw_data()/caam_read_rsa_crt() return NULL. caam_rsa_set_priv_key_form() then frees p (and more) and caam_rsa_free_key() frees them again, every time, with no race and no need for memory pressure. PR:L - Any ordinary user can add an asymmetric key to their own session keyring and query it; keyctl_pkey_params_get() only requires KEY_NEED_SEARCH on a key the caller owns. No capability, user namespace or root is needed. UI:N - The attacker performs the add_key and keyctl calls with their own key. No other user or administrator has to do anything at the time of the attack. S:U - The double free corrupts the kernel's own slab allocator, inside the same kernel that runs the CAAM driver. Turning it into root is an ordinary kernel privilege escalation and crosses no VM or IOMMU boundary. C:H - caam_rsa_free_key() frees key->d, whose size the attacker chooses, between the two kfree_sensitive(key->p) calls, which gets past SLUB's simple double-free check. The object ends up on the freelist twice, so two later allocations overlap, and that can be used to read kernel memory. I:H - The same overlap lets the attacker write through one object into another, for example credentials or function-pointer structures, which can lead to arbitrary kernel write and control-flow hijack. Allocation sizes follow the p/q/d lengths in the key, and the attack can be repeated. A:H - Even without exploitation, freeing p twice either hits the SLAB_FREELIST_HARDENED BUG_ON or corrupts the freelist, and the kernel later oopses or panics. Any local user can repeat it with keyctl queries.
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Linux | Linux | 52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < 068e85ed81838a9d98c3018d532402dbd360fd1f (affected · git)52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < 35b3176839fa1842ae1a6e3b2bbbc37d34237614 (affected · git)52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < a5e1e36dace783c8d1688a299a3919f4d624217d (affected · git)52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < ad78e2cd8b4dde0b8c52bb5227e09faf3f49b939 (affected · git)52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < e7a5cea8804f1210fe45c3a0281b11943c58553f (affected · git)52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < f3e503a31d3cfdc8fae1baeb0ad5ba8471ceea9d (affected · git)52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < 523eb58df5c11531a99f2e75d08e10f20cc28565 (affected · git)52e26d77b8b3de2e9ed6c7126f68e04cad5fe852 to < a91d9346a70b68f77884cba9d9ec3b70f96bf9d2 (affected · git)Default: unaffected | Linux · cna |
| Linux | Linux | 4.13 (affected)0 to < 4.13 (unaffected · semver)5.10.275 through 5.10.* (unaffected · semver)5.15.226 through 5.15.* (unaffected · semver)6.1.193 through 6.1.* (unaffected · semver)6.6.163 through 6.6.* (unaffected · semver)6.12.117 through 6.12.* (unaffected · semver)6.18.63 through 6.18.* (unaffected · semver)7.3.4 through 7.3.* (unaffected · semver)7.4-rc1 and later (unaffected · original_commit_for_fix)Default: affected | Linux · cna |
Weaknesses
0No weakness assertions.
References
8- https://git.kernel.org/stable/c/068e85ed81838a9d98c3018d532402dbd360fd1f
- https://git.kernel.org/stable/c/35b3176839fa1842ae1a6e3b2bbbc37d34237614
- https://git.kernel.org/stable/c/523eb58df5c11531a99f2e75d08e10f20cc28565
- https://git.kernel.org/stable/c/a5e1e36dace783c8d1688a299a3919f4d624217d
- https://git.kernel.org/stable/c/a91d9346a70b68f77884cba9d9ec3b70f96bf9d2
- https://git.kernel.org/stable/c/ad78e2cd8b4dde0b8c52bb5227e09faf3f49b939
- https://git.kernel.org/stable/c/e7a5cea8804f1210fe45c3a0281b11943c58553f
- https://git.kernel.org/stable/c/f3e503a31d3cfdc8fae1baeb0ad5ba8471ceea9d
Provider assertions
1Linux · cna
crypto: caam - fix double-free in caam_rsa_set_priv_key_form()
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- f4e183de30b14d391ee92d625af528bf1cf51b410391c2dd9023f33b0bef20b8
- Ingested
- 01 Dec 2026, 05:47:22 UTC
- Source record
- Official CVE record