keys: fix out-of-bounds read in keyring_get_key_chunk()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ f771fde82051976a6fc0fd570f8b86de4a92124b · < e9417d21a22ad2ec398e78fcf084b717ce92cf2f| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
keys: fix out-of-bounds read in keyring_get_key_chunk()
For description-level chunks keyring_get_key_chunk() advances the read pointer by level * sizeof(long) past the inline prefix but only bounds-checks the prefix, so a long enough key description is read past its kmemdup(desc, desc_len + 1) allocation. Compute the full byte offset and bounds-check the description against it before reading.
The walk only reaches a description-level chunk when two keys collide through the hash, x, type and domain_tag chunks, so this is reached from an unprivileged add_key(2) with a crafted pair of same-type keys whose index hashes collide; KASAN reports a slab-out-of-bounds read.
From the CVE record · Linux
The Linux kernel’s keyring_get_key_chunk() can read past an allocated key description when processing a description-level chunk. A local, unprivileged attacker can trigger the out-of-bounds read with add_key(2) using a crafted pair of same-type keys whose index hashes collide; no user interaction is described.
Anyone running the Linux kernel should check their version against the vendor advisory; affected versions were not provided.