<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Kernel-Vulnerability — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/kernel-vulnerability/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 03 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/kernel-vulnerability/feed.xml" rel="self" type="application/rss+xml"/><item><title>Linux Kernel proc_readdir_de() Use-After-Free Local Privilege Escalation</title><link>https://feed.craftedsignal.io/briefs/2024-01-linux-kernel-lpe/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-linux-kernel-lpe/</guid><description>A local privilege escalation vulnerability exists in the Linux Kernel versions ~3.14+ through 6.18-rc5 due to a use-after-free in the proc_readdir_de() function, where a concurrent traversal can dereference a freed entry's fields during network device unregistration, leading to privilege escalation via modprobe_path overwrite.</description><content:encoded><![CDATA[<p>A local privilege escalation vulnerability, CVE-2025-40271, affects Linux Kernel versions from approximately 3.14 up to 6.18-rc5. The vulnerability lies in the <code>proc_readdir_de()</code> function within the kernel&rsquo;s proc filesystem implementation. When a <code>proc_dir_entry</code> is removed from the parent&rsquo;s red-black tree, it isn&rsquo;t properly marked as detached, leaving stale rb-links. An attacker can exploit this use-after-free condition to gain elevated privileges on the system by triggering a race condition. This involves calling <code>getdents64()</code> on a <code>/proc</code> subdirectory, specifically <code>/proc/self/net/dev_snmp6/</code>, while concurrently unregistering network devices. Successful exploitation allows an attacker to overwrite the <code>modprobe_path</code> for local privilege escalation. The vulnerability was patched in stable versions 5.10.247, 6.1.159, 6.12.73, and 6.18-rc6.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker sets up a user namespace with CAP_NET_ADMIN capabilities to manipulate network devices.</li>
<li>The attacker creates multiple veth (virtual ethernet) pairs. These veth pairs populate the <code>/proc/self/net/dev_snmp6/</code> directory, which the exploit will target.</li>
<li>The attacker initiates a race condition by calling <code>getdents64()</code> on the <code>/proc/self/net/dev_snmp6/</code> directory. This reads directory entries from the proc filesystem.</li>
<li>Concurrently with the <code>getdents64()</code> call, the attacker triggers the unregistration of network devices. This action removes proc entries, potentially freeing a <code>proc_dir_entry</code>.</li>
<li>Due to the vulnerability, the removed <code>proc_dir_entry</code> is not properly cleared, leaving stale links in the red-black tree.</li>
<li>The <code>getdents64()</code> call encounters the freed <code>proc_dir_entry</code> and attempts to dereference its fields, resulting in a use-after-free condition. The attacker sprays the freed kmalloc-192 slots with <code>msg_msg</code>.</li>
<li>The attacker extracts a kernel heap address from the leaked <code>d_ino</code> field, which is part of the <code>msg_msg</code> header.</li>
<li>The extracted kernel heap address is used to calculate the address of <code>modprobe_path</code>, and the attacker overwrites it, leading to local privilege escalation.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows an unprivileged local attacker to escalate their privileges to root. This can lead to complete system compromise, including data theft, malware installation, and denial of service. While the provided exploit shows a hit rate of 40-60% per attempt and may require several attempts, the impact is significant due to the potential for full system control. This vulnerability affects a wide range of Linux kernel versions and could impact numerous systems if left unpatched.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply the appropriate kernel patch from the Linux Kernel org, specifically commit 895b4c0c79b092d732544011c3cecaf7322c36a1, which adds the <code>pde_erase()</code> helper function that calls <code>RB_CLEAR_NODE()</code> after <code>rb_erase()</code>.</li>
<li>Monitor for anomalous <code>d_ino</code> values in <code>getdents64</code> output, as indicated in the exploit description, which are indicative of a UAF condition. Deploy the Sigma rule <code>Detect Anomalous d_ino Values in getdents64 Output</code> to identify potential exploitation attempts.</li>
<li>Implement restrictions on user namespaces and network namespace creation to limit the attack surface, as the exploit requires CAP_NET_ADMIN.</li>
<li>Monitor process creation events for unexpected modifications to <code>modprobe_path</code>. Use the Sigma rule <code>Detect modprobe_path Overwrite</code> to identify attempts to escalate privileges.</li>
<li>Review systems for the presence of vulnerable kernel versions (~3.14+ through 6.18-rc5) as detailed in the overview to prioritize patching efforts.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>local-privilege-escalation</category><category>kernel-vulnerability</category><category>use-after-free</category><category>linux</category></item></channel></rss>