George0Papasotiriou/CVE-2026-6666-XPC-Service-NSKeyedUnarchiver-Deserialization-Attack-macOS-iOS-simulation-
GitHub: George0Papasotiriou/CVE-2026-6666-XPC-Service-NSKeyedUnarchiver-Deserialization-Attack-macOS-iOS-simulation-
一个模拟 macOS/iOS XPC Service 因 NSKeyedUnarchiver 不安全反序列化导致远程代码执行漏洞的概念验证项目。
Stars: 0 | Forks: 0
## CVE-2026-6666 – XPC Service NSKeyedUnarchiver 反序列化攻击(macOS/iOS 模拟)
### **程序代码(Python 模拟)**
```
#!/usr/bin/env python3
# vulnerable_xpc_service.py - 使用不安全的 plist 反序列化模拟 XPC 服务
import plistlib, subprocess, socketserver, struct
# Mach 消息模拟:我们只是通过 TCP 接受二进制 plist。
class XPCHandler(socketserver.BaseRequestHandler):
def handle(self):
raw = self.request.recv(4096)
# Insecure: using plistlib.loads on untrusted data without sanitization
plist_data = plistlib.loads(raw) # In real macOS, NSKeyedUnarchiver can execute code
# Simulate a command being embedded in the plist
command = plist_data.get("runCommand")
if command:
subprocess.Popen(command, shell=True)
self.request.sendall(b"Success")
server = socketserver.TCPServer(('localhost', 8888), XPCHandler)
print("Vulnerable XPC service on :8888")
server.serve_forever()
```
# CVE-2026-6666 – XPC Service NSKeyedUnarchiver 反序列化 RCE

## 概述
macOS/iOS 上的某个 XPC service 使用 `NSKeyedUnarchiver` 对传入的 Mach 消息进行反序列化,且未设置安全的编码白名单。攻击者可以构造一个序列化的对象图,使其在反序列化时执行任意代码。
## 漏洞详情
- **类型:** 不安全的反序列化
- **影响:** 以 XPC service 的权限执行任意代码。
- **根本原因:** `NSKeyedUnarchiver` 被用于处理不受信任的数据且没有类白名单,从而允许实例化会触发代码执行的对象(例如 `NSInvocation`)。
## 漏洞利用演示
1. 启动模拟的 XPC service:
python vulnerable_xpc_service.py
2. 发送恶意 payload:
python exploit_xpc.py
标签:Go语言工具, iOS, Python, XPC, 反序列化, 无后门, 逆向工具