CVE-2024-50301: Vulnerability in Linux Linux
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 Analysis
Technical Summary
CVE-2024-50301 is a vulnerability in the Linux kernel's security keys subsystem, specifically within the key_task_permission function. The issue is a slab-out-of-bounds read detected by Kernel Address Sanitizer (KASAN), which occurs due to improper handling of keyring data structures during nested keyring searches. The vulnerability arises when the search_nested_keyrings function iterates through slots in a node of the keyring tree. If a slot pointer is a shortcut and the node is the root, the pointer may be incorrectly treated as a keyring pointer due to overlapping subtype values (KEYRING_PTR_SUBTYPE and ASSOC_ARRAY_PTR_SUBTYPE_MASK both being 0x2UL). This leads to an out-of-bounds read when the code dereferences the pointer as a keyring, resulting in a slab-out-of-bounds memory access. The vulnerability can be reproduced by adding more than 32 keys with similar hashes ending with the pattern '0xxxxxxxe6' to the keyring tree, causing the tree to split and form a structure where a root slot points to a shortcut. The flaw is fixed by ensuring that any shortcut pointer, regardless of whether the node is root or not, triggers a descent into the node rather than being treated as a keyring pointer. This vulnerability affects Linux kernel versions including commit b2a4df200d570b2c33a57e1ebfa5896e4bc81b69 and likely others in the 5.10 kernel series. No known exploits are reported in the wild at this time. The vulnerability was reported by syzbot, an automated kernel fuzzing tool, and is documented with detailed technical analysis and a proposed fix.
Potential Impact
For European organizations, this vulnerability poses a risk primarily to systems running affected Linux kernel versions, especially those using the security keys subsystem extensively, such as servers, cloud infrastructure, and embedded devices. The out-of-bounds read could potentially lead to kernel crashes (denial of service) or information disclosure if exploited in a crafted environment. Although no direct privilege escalation or remote code execution is described, the memory corruption could be leveraged in complex attack chains. Given Linux's widespread use in European data centers, telecommunications, and critical infrastructure, unpatched systems could experience stability issues or be targeted for further exploitation attempts. The impact is heightened in environments where untrusted users or processes can add keys or manipulate the keyring subsystem, such as multi-tenant cloud platforms or containerized environments. The vulnerability's exploitation requires specific conditions (adding many keys with similar hashes), which may limit ease of exploitation but does not eliminate risk. Organizations relying on Linux kernel 5.10 or similar versions should consider this a significant security concern.
Mitigation Recommendations
1. Apply the official Linux kernel patch that corrects the key_task_permission function to properly handle shortcut pointers in the keyring tree, ensuring the fix described in the advisory is implemented. 2. Upgrade Linux kernel versions to the latest stable release that includes this fix, preferably beyond the affected 5.10 series. 3. Restrict the ability to add keys to the security keyring subsystem to trusted users and processes only, minimizing the risk of malicious key insertion. 4. Monitor kernel logs for KASAN or slab-out-of-bounds errors that may indicate attempted exploitation or instability related to this vulnerability. 5. In containerized or multi-tenant environments, enforce strict namespace and capability isolation to prevent unprivileged users from manipulating kernel keyrings. 6. Conduct regular vulnerability scanning and patch management to ensure timely application of kernel security updates. 7. Consider deploying runtime security tools that can detect anomalous kernel memory access patterns or crashes related to keyring operations.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Poland, Italy, Spain, Belgium
CVE-2024-50301: Vulnerability in Linux Linux
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-Powered Analysis
Technical Analysis
CVE-2024-50301 is a vulnerability in the Linux kernel's security keys subsystem, specifically within the key_task_permission function. The issue is a slab-out-of-bounds read detected by Kernel Address Sanitizer (KASAN), which occurs due to improper handling of keyring data structures during nested keyring searches. The vulnerability arises when the search_nested_keyrings function iterates through slots in a node of the keyring tree. If a slot pointer is a shortcut and the node is the root, the pointer may be incorrectly treated as a keyring pointer due to overlapping subtype values (KEYRING_PTR_SUBTYPE and ASSOC_ARRAY_PTR_SUBTYPE_MASK both being 0x2UL). This leads to an out-of-bounds read when the code dereferences the pointer as a keyring, resulting in a slab-out-of-bounds memory access. The vulnerability can be reproduced by adding more than 32 keys with similar hashes ending with the pattern '0xxxxxxxe6' to the keyring tree, causing the tree to split and form a structure where a root slot points to a shortcut. The flaw is fixed by ensuring that any shortcut pointer, regardless of whether the node is root or not, triggers a descent into the node rather than being treated as a keyring pointer. This vulnerability affects Linux kernel versions including commit b2a4df200d570b2c33a57e1ebfa5896e4bc81b69 and likely others in the 5.10 kernel series. No known exploits are reported in the wild at this time. The vulnerability was reported by syzbot, an automated kernel fuzzing tool, and is documented with detailed technical analysis and a proposed fix.
Potential Impact
For European organizations, this vulnerability poses a risk primarily to systems running affected Linux kernel versions, especially those using the security keys subsystem extensively, such as servers, cloud infrastructure, and embedded devices. The out-of-bounds read could potentially lead to kernel crashes (denial of service) or information disclosure if exploited in a crafted environment. Although no direct privilege escalation or remote code execution is described, the memory corruption could be leveraged in complex attack chains. Given Linux's widespread use in European data centers, telecommunications, and critical infrastructure, unpatched systems could experience stability issues or be targeted for further exploitation attempts. The impact is heightened in environments where untrusted users or processes can add keys or manipulate the keyring subsystem, such as multi-tenant cloud platforms or containerized environments. The vulnerability's exploitation requires specific conditions (adding many keys with similar hashes), which may limit ease of exploitation but does not eliminate risk. Organizations relying on Linux kernel 5.10 or similar versions should consider this a significant security concern.
Mitigation Recommendations
1. Apply the official Linux kernel patch that corrects the key_task_permission function to properly handle shortcut pointers in the keyring tree, ensuring the fix described in the advisory is implemented. 2. Upgrade Linux kernel versions to the latest stable release that includes this fix, preferably beyond the affected 5.10 series. 3. Restrict the ability to add keys to the security keyring subsystem to trusted users and processes only, minimizing the risk of malicious key insertion. 4. Monitor kernel logs for KASAN or slab-out-of-bounds errors that may indicate attempted exploitation or instability related to this vulnerability. 5. In containerized or multi-tenant environments, enforce strict namespace and capability isolation to prevent unprivileged users from manipulating kernel keyrings. 6. Conduct regular vulnerability scanning and patch management to ensure timely application of kernel security updates. 7. Consider deploying runtime security tools that can detect anomalous kernel memory access patterns or crashes related to keyring operations.
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- Linux
- Date Reserved
- 2024-10-21T19:36:19.987Z
- Cisa Enriched
- false
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 682d9824c4522896dcbdf792
Added to database: 5/21/2025, 9:08:52 AM
Last enriched: 6/28/2025, 1:56:53 PM
Last updated: 8/14/2025, 5:46:24 PM
Views: 24
Related Threats
CVE-2025-41242: Vulnerability in VMware Spring Framework
MediumCVE-2025-47206: CWE-787 in QNAP Systems Inc. File Station 5
HighCVE-2025-5296: CWE-59 Improper Link Resolution Before File Access ('Link Following') in Schneider Electric SESU
HighCVE-2025-6625: CWE-20 Improper Input Validation in Schneider Electric Modicon M340
HighCVE-2025-57703: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in Delta Electronics DIAEnergie
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.