VYPR
High severity7.1NVD Advisory· Published Nov 19, 2024· Updated May 12, 2026

CVE-2024-50301

CVE-2024-50301

Description

In the Linux kernel, the following vulnerability has been resolved:

security/keys: fix slab-out-of-bounds in key_task_permission

KASAN reports an out of bounds read: BUG: KASAN: slab-out-of-bounds in __kuid_val include/linux/uidgid.h:36 BUG: KASAN: slab-out-of-bounds in uid_eq include/linux/uidgid.h:63 [inline] BUG: KASAN: slab-out-of-bounds in key_task_permission+0x394/0x410 security/keys/permission.c:54 Read of size 4 at addr ffff88813c3ab618 by task stress-ng/4362

CPU: 2 PID: 4362 Comm: stress-ng Not tainted 5.10.0-14930-gafbffd6c3ede #15 Call Trace: __dump_stack lib/dump_stack.c:82 [inline] dump_stack+0x107/0x167 lib/dump_stack.c:123 print_address_description.constprop.0+0x19/0x170 mm/kasan/report.c:400 __kasan_report.cold+0x6c/0x84 mm/kasan/report.c:560 kasan_report+0x3a/0x50 mm/kasan/report.c:585 __kuid_val include/linux/uidgid.h:36 [inline] uid_eq include/linux/uidgid.h:63 [inline] key_task_permission+0x394/0x410 security/keys/permission.c:54 search_nested_keyrings+0x90e/0xe90 security/keys/keyring.c:793

This issue was also reported by syzbot.

It can be reproduced by following these steps(more details [1]): 1. Obtain more than 32 inputs that have similar hashes, which ends with the pattern '0xxxxxxxe6'. 2. Reboot and add the keys obtained in step 1.

The reproducer demonstrates how this issue happened: 1. In the search_nested_keyrings function, when it iterates through the slots in a node(below tag ascend_to_node), if the slot pointer is meta and node->back_pointer != NULL(it means a root), it will proceed to descend_to_node. However, there is an exception. If node is the root, and one of the slots points to a shortcut, it will be treated as a keyring. 2. Whether the ptr is keyring decided by keyring_ptr_is_keyring function. However, KEYRING_PTR_SUBTYPE is 0x2UL, the same as ASSOC_ARRAY_PTR_SUBTYPE_MASK. 3. When 32 keys with the similar hashes are added to the tree, the ROOT has keys with hashes that are not similar (e.g. slot 0) and it splits NODE A without using a shortcut. When NODE A is filled with keys that all hashes are xxe6, the keys are similar, NODE A will split with a shortcut. Finally, it forms the tree as shown below, where slot 6 points to a shortcut.

NODE A +------>+---+ ROOT | | 0 | xxe6 +---+ | +---+ xxxx | 0 | shortcut : : xxe6 +---+ | +---+ xxe6 : : | | | xxe6 +---+ | +---+ | 6 |---+ : : xxe6 +---+ +---+ xxe6 : : | f | xxe6 +---+ +---+ xxe6 | f | +---+

4. As mentioned above, If a slot(slot 6) of the root points to a shortcut, it may be mistakenly transferred to a key*, leading to a read out-of-bounds read.

To fix this issue, one should jump to descend_to_node if the ptr is a shortcut, regardless of whether the node is root or not.

[1] https://lore.kernel.org/linux-kernel/1cfa878e-8c7b-4570-8606-21daf5e13ce7@huaweicloud.com/

[jarkko: tweaked the commit message a bit to have an appropriate closes tag.]

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

CVE-2024-50301 is a Linux kernel slab-out-of-bounds read in key_task_permission, triggered via crafted key hashes and a flawed assoc_array traversal logic.

Root

Cause

CVE-2024-50301 is a slab-out-of-bounds read vulnerability in the Linux kernel's key management subsystem, specifically in the key_task_permission function within security/keys/permission.c. The bug occurs when the kernel attempts to compare user IDs via the uid_eq macro, which reads a 4-byte value from a kuid_t structure. Under certain conditions, the pointer to the kuid_t structure is invalid, leading to an out-of-bounds read. The issue manifests in search_nested_keyrings in security/keys/keyring.c, where the traversal of the associative array (assoc_array) incorrectly handles shortcuts (intermediate nodes). When a root node contains a slot that points to a shortcut (not a keyring), the code treats that slot as a keyring due to the KEYRING_PTR_SUBTYPE constant (0x2UL) coinciding with ASSOC_ARRAY_PTR_SUBTYPE_MASK. This results in an erroneous dereference of a non-keyring object as a keyring structure, causing the slab-out-of-bounds read [1][2].

Attack

Vector

Exploitation requires local access and the ability to add keys to the kernel's keyring with crafted hashes. The reproducer involves obtaining more than 32 inputs with similar hashes (ending in the pattern 0xxxxxxxe6) and adding them to the keyring after a reboot. During the traversal of the associative array, the flawed logic causes the kernel to read beyond the bounds of a slab-allocated keyring object. The attack surface is limited to local users with privileges to add keys (e.g., via add_key syscall or similar) [3].

Impact

An attacker who successfully triggers the out-of-bounds read can cause a kernel crash (denial of service) due to KASAN detection or memory corruption. The read itself leaks up to 4 bytes of kernel memory from adjacent slab objects, potentially disclosing sensitive information such as other data structures' contents. However, the primary impact from the official advisory is denial of service (system crash) as indicated by the CVSS score of 7.1 (High severity) [4]. The vulnerability does not require authentication beyond local system access and can be triggered by unprivileged users if they have permission to add keys.

Mitigation

The vulnerability has been fixed in the Linux kernel stable tree via commit 1e4332581cd4eed75aea77af6f66cdcdda8b49b9. Users should apply kernel updates from their distribution vendors. The Siemens advisory (SSA-355557) lists this CVE as affecting SIMATIC S7-1500 TM MFP - GNU/Linux subsystem (all versions), though the referenced CVEs in that advisory are unrelated; the inclusion here may indicate the affected product. There is no evidence of active exploitation or inclusion in the Known Exploited Vulnerabilities (KEV) catalog at the time of publication.

AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

340

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

13

News mentions

0

No linked articles in our index yet.