AI Security AI安全 2h ago Updated 1h ago 更新于 1小时前 46

Leaked n8n API Tokens Exposed Live Instances to Credential Theft 泄露的 n8n API 令牌使实时实例面临凭证窃取风险

GitGuardian identified 4,576 leaked n8n API tokens across 1,255 unique hostnames in public GitHub commits, with 321 instances (36% of reachable) still accepting those credentials Attackers can exploit leaked tokens through four documented REST API techniques without any CVE exploitation, accessing workflow definitions, stored credentials, and downstream secrets n8n API keys often lack expiration claims ("exp"), allowing tokens committed months earlier to remain valid indefinitely until manually GitGuardian扫描发现321个n8n实例接受了GitHub提交中泄露的API令牌,涉及4,576个唯一凭证和1,255个主机名 泄露的令牌无需利用软件漏洞即可提供认证访问,攻击者可通过四种方式访问敏感数据和下游凭证 n8n实例作为自动化平台连接数据库、云环境、AI服务等关键系统,泄露令牌可暴露工作流定义、执行数据和存储的凭证值 58%的被扫描实例运行着受已知安全漏洞影响的版本,包括CVSS 9.9的表达式注入漏洞CVE-2025-68613 旧版n8n API令牌缺乏过期机制,2025年2月版本1.78.0才引入30天默认过期策略

65
Hot 热度
72
Quality 质量
58
Impact 影响力

Analysis 深度分析

TL;DR

  • GitGuardian identified 4,576 leaked n8n API tokens across 1,255 unique hostnames in public GitHub commits, with 321 instances (36% of reachable) still accepting those credentials
  • Attackers can exploit leaked tokens through four documented REST API techniques without any CVE exploitation, accessing workflow definitions, stored credentials, and downstream secrets
  • n8n API keys often lack expiration claims ("exp"), allowing tokens committed months earlier to remain valid indefinitely until manually revoked
  • 58% of scanned instances ran versions affected by known security advisories, including CVE-2025-68613 (CVSS 9.9) added to CISA's Known Exploited Vulnerabilities catalog
  • The blast radius extends beyond n8n itself: compromised instances can expose databases, cloud environments, AI services, and internal systems connected through workflow integrations

Why It Matters

This research highlights a critical gap in credential hygiene for automation platforms that serve as central nervous systems for enterprise integrations. For AI practitioners and security teams, it demonstrates how leaked tokens—often overlooked compared to direct vulnerability exploitation—can provide authenticated access to sensitive data pipelines and downstream credentials without touching a single CVE.

Technical Details

  • Scope: Scanned public GitHub commits since April 2025 for n8n API tokens; validated 896 reachable instances, confirmed 321 accepting leaked tokens; also tested 372 MCP (Model Context Protocol) tokens with 7 still valid (2%)
  • Token Structure: n8n API keys are signed JWTs with "aud": "public-api" claim; many lack exp expiration fields, remaining valid until explicit revocation; n8n introduced 30-day default expiration only in version 1.78.0 (February 2025)
  • Attack Vectors: Four techniques reproduced using only documented REST API and standard HTTP requests—no specialized tooling or CVE exploitation required; validation via curl -H "X-N8N-API-KEY: <token>" GET /api/v1/workflows returning 200 for valid tokens
  • Credential Storage: n8n encrypts stored credentials at rest using N8N_ENCRYPTION_KEY, but decrypts them at runtime for workflow execution; attackers with API privileges can reference credentials in new workflows to make the instance use them on the attacker's behalf
  • Vulnerability Landscape: 58% of scanned instances ran versions with known security advisories; CVE-2025-68613 (expression injection, CVSS 9.9) enables sandbox escape and arbitrary filesystem read/write access

Industry Insight

  • Organizations should audit all n8n instances for exposed API tokens in version control systems and implement automated token rotation policies; treat leaked credentials as actively exploitable even without vulnerability patching
  • The n8n case illustrates a broader pattern: low-code automation platforms that centralize credentials become high-value targets where token leakage alone can compromise entire integration ecosystems—security teams should prioritize credential monitoring alongside vulnerability management
  • AI agent platforms using Model Context Protocol (MCP) represent a newer exposure surface; the 2% validation rate for MCP tokens suggests similar hygiene gaps exist across emerging AI integration standards that warrant immediate scrutiny

TL;DR

  • GitGuardian扫描发现321个n8n实例接受了GitHub提交中泄露的API令牌,涉及4,576个唯一凭证和1,255个主机名
  • 泄露的令牌无需利用软件漏洞即可提供认证访问,攻击者可通过四种方式访问敏感数据和下游凭证
  • n8n实例作为自动化平台连接数据库、云环境、AI服务等关键系统,泄露令牌可暴露工作流定义、执行数据和存储的凭证值
  • 58%的被扫描实例运行着受已知安全漏洞影响的版本,包括CVSS 9.9的表达式注入漏洞CVE-2025-68613
  • 旧版n8n API令牌缺乏过期机制,2025年2月版本1.78.0才引入30天默认过期策略

为什么值得看

这篇文章揭示了自动化工作流平台因凭证泄露导致的严重安全风险,对使用n8n等集成平台的组织具有重要警示意义。它展示了即使不利用软件漏洞,仅凭泄露的API令牌即可实现认证访问并获取敏感数据,突显了凭证管理和密钥轮换的重要性。

技术解析

  • GitGuardian通过扫描公共GitHub提交,识别出4,576个n8n API令牌和372个MCP令牌,其中321个实例接受了泄露的REST API令牌,7个MCP令牌仍然有效
  • n8n API密钥是带有"aud": "public-api"声明的签名JWT,旧版本令牌缺少exp声明,导致令牌可能永久有效直到被显式删除或撤销
  • 攻击者可通过X-N8N-API-KEY头发送HTTP请求验证令牌有效性,200响应表示令牌被接受,401表示令牌无效或已删除
  • n8n使用N8N_ENCRYPTION_KEY主密钥加密存储的凭证,但工作流执行时需要解密使用,高权限令牌持有者可引用这些凭证创建新工作流
  • 超过10万个n8n实例可通过Shodan可见,自2026年1月以来已发布50多个安全公告,多个CVE允许攻击者逃逸执行沙箱并获取主机文件系统访问权限

行业启示

  • 组织应实施严格的API密钥轮换策略,避免将凭证硬编码到代码中或提交到公共仓库,建议使用密钥管理服务
  • 对于n8n等集成平台,应定期审计公开暴露的实例,确保所有令牌设置合理的过期时间,并及时更新到最新版本以修复已知漏洞
  • 企业应建立自动化监控机制,持续扫描公共代码仓库中的敏感凭证泄露,并制定快速响应流程以撤销已泄露的访问令牌

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Security 安全 Open Source 开源