{"uuid": "45e8916a-d3bb-4aff-8a42-8ab4c6c33515", "vulnerability_lookup_origin": "1a89b78e-f703-45f3-bb86-59eb712668bd", "author": "9f56dd64-161d-43a6-b9c3-555944290a09", "vulnerability": "CVE-2024-50301", "type": "published-proof-of-concept", "source": "https://t.me/cvedetector/11414", "content": "{\n  \"Source\": \"CVE FEED\",\n  \"Title\": \"CVE-2024-50301 - Huawei Linux Keys KASAN Slab Out-of-Bounds Read\", \n  \"Content\": \"CVE ID : CVE-2024-50301 \nPublished : Nov. 19, 2024, 2:16 a.m. | 41\u00a0minutes ago \nDescription : In the Linux kernel, the following vulnerability has been resolved:  \n  \nsecurity/keys: fix slab-out-of-bounds in key_task_permission  \n  \nKASAN reports an out of bounds read:  \nBUG: KASAN: slab-out-of-bounds in __kuid_val include/linux/uidgid.h:36  \nBUG: KASAN: slab-out-of-bounds in uid_eq include/linux/uidgid.h:63 [inline]  \nBUG: KASAN: slab-out-of-bounds in key_task_permission+0x394/0x410  \nsecurity/keys/permission.c:54  \nRead of size 4 at addr ffff88813c3ab618 by task stress-ng/4362  \n  \nCPU: 2 PID: 4362 Comm: stress-ng Not tainted 5.10.0-14930-gafbffd6c3ede #15  \nCall Trace:  \n __dump_stack lib/dump_stack.c:82 [inline]  \n dump_stack+0x107/0x167 lib/dump_stack.c:123  \n print_address_description.constprop.0+0x19/0x170 mm/kasan/report.c:400  \n __kasan_report.cold+0x6c/0x84 mm/kasan/report.c:560  \n kasan_report+0x3a/0x50 mm/kasan/report.c:585  \n __kuid_val include/linux/uidgid.h:36 [inline]  \n uid_eq include/linux/uidgid.h:63 [inline]  \n key_task_permission+0x394/0x410 security/keys/permission.c:54  \n search_nested_keyrings+0x90e/0xe90 security/keys/keyring.c:793  \n  \nThis issue was also reported by syzbot.  \n  \nIt can be reproduced by following these steps(more details [1]):  \n1. Obtain more than 32 inputs that have similar hashes, which ends with the  \n   pattern '0xxxxxxxe6'.  \n2. Reboot and add the keys obtained in step 1.  \n  \nThe reproducer demonstrates how this issue happened:  \n1. In the search_nested_keyrings function, when it iterates through the  \n   slots in a node(below tag ascend_to_node), if the slot pointer is meta  \n   and node-&gt;back_pointer != NULL(it means a root), it will proceed to  \n   descend_to_node. However, there is an exception. If node is the root,  \n   and one of the slots points to a shortcut, it will be treated as a  \n   keyring.  \n2. Whether the ptr is keyring decided by keyring_ptr_is_keyring function.  \n   However, KEYRING_PTR_SUBTYPE is 0x2UL, the same as  \n   ASSOC_ARRAY_PTR_SUBTYPE_MASK.  \n3. When 32 keys with the similar hashes are added to the tree, the ROOT  \n   has keys with hashes that are not similar (e.g. slot 0) and it splits  \n   NODE A without using a shortcut. When NODE A is filled with keys that  \n   all hashes are xxe6, the keys are similar, NODE A will split with a  \n   shortcut. Finally, it forms the tree as shown below, where slot 6 points  \n   to a shortcut.  \n  \n                      NODE A  \n              +------&gt;+---+  \n      ROOT    |       | 0 | xxe6  \n      +---+   |       +---+  \n xxxx | 0 | shortcut  :   : xxe6  \n      +---+   |       +---+  \n xxe6 :   :   |       |   | xxe6  \n      +---+   |       +---+  \n      | 6 |---+       :   : xxe6  \n      +---+           +---+  \n xxe6 :   :           | f | xxe6  \n      +---+           +---+  \n xxe6 | f |  \n      +---+  \n  \n4. As mentioned above, If a slot(slot 6) of the root points to a shortcut,  \n   it may be mistakenly transferred to a key*, leading to a read  \n   out-of-bounds read.  \n  \nTo fix this issue, one should jump to descend_to_node if the ptr is a  \nshortcut, regardless of whether the node is root or not.  \n  \n[1]   \n  \n[jarkko: tweaked the commit message a bit to have an appropriate closes  \n tag.] \nSeverity: 0.0 | NA \nVisit the link for more details, such as CVSS details, affected products, timeline, and more...\",\n  \"Detection Date\": \"19 Nov 2024\",\n  \"Type\": \"Vulnerability\"\n}\n\ud83d\udd39 t.me/cvedetector \ud83d\udd39", "creation_timestamp": "2024-11-19T04:15:51.000000Z"}