AI 生成的 GitHub Copilot“自动修复”功能导致 Snowflake 的 Jira 系统遭到入侵
AI-Generated GitHub Copilot “Autofix” Allowed Compromise of Snowflake's Jira

原始链接: https://www.wiz.io/blog/red-agent-snowflake-copilot-cicd-bug

Wiz Research 的自主“红队代理”(Red Agent)近期在 Snowflake 的一个 GitHub 代码库中发现并成功利用了一个关键的工作流注入漏洞。该漏洞允许未经身份验证的用户执行任意命令,是 GitHub Copilot Autofix 无意中引入的。该人工智能助手将一种安全的、专注于过滤的代码模式替换为了存在漏洞的直接字符串插值,凸显了 AI 编程工具可能绕过既定安全措施的问题。 在发现漏洞后,Wiz 的 AI 代理自主优化了漏洞利用载荷以避开 Bash 语法错误,并成功窃取了内部 Jira 凭据。Wiz 于 2026 年 6 月 23 日通过 Snowflake 的 HackerOne 项目负责任地披露了这一发现。Snowflake 对该漏洞进行了修复,重置了受影响的凭据,并确认在五天的暴露窗口期内没有第三方参与者利用过该漏洞。 此事件突显了行业内的两个关键转变:一是 AI 生成代码引发回归的风险,即自动化工具缺乏保持安全最佳实践的背景知识;二是随着安全工具日益自动化,“发现窗口”正在不断缩短。建议各组织对 AI 编写的代码进行与人类贡献代码同等严格的安全审查,并建立防护机制,防止结构化数据解析器被不安全的 Shell 命令插值所取代。

近期 Snowflake 的 Jira 集成中出现的一项安全漏洞,凸显了在缺乏适当验证的情况下使用 AI 辅助代码生成的重大风险。GitHub Copilot 辅助生成的“自动修复”(Autofix)建议,将不受信任的问题标题直接插入到 GitHub Action 的 Shell 命令中,从而引入了一个严重的命令注入缺陷。 此事件在 Hacker News 上引发了关于 AI、CI/CD 安全与现代开发实践交集的热烈讨论。主要结论包括: * **“人在回路”(Human-in-the-Loop)的问题:** 虽然 AI 可以加速编码,但它也极大地降低了引入缺陷的成本。审查人员往往会对 AI 生成的代码“盖章放行”,从而忽略了经验丰富的开发人员本应一眼识别出的安全回归问题。 * **GitHub Actions 的脆弱性:** 评论者批评了 GitHub Actions 的设计,指出在 YAML 中嵌入 Shell 脚本极易导致注入错误。该平台倾向于“默认放行”(例如将空值视为真),从而产生了意想不到的安全漏洞。 * **工具至关重要:** 社区强调了使用静态分析工具(如 `zizmor` 或 `actionlint`)的必要性,以便在代码进入生产环境前捕获常见的安全配置错误。 * **“LGTM”(看起来没问题)文化:** 许多人认为,AI 工具的兴起加剧了忽视严格代码审查的倾向;他们强调,即使代码生成是“免费”的,其维护成本依然高昂。
相关文章

原文

As part of ongoing security research conducted through Snowflake’s HackerOne vulnerability disclosure program, Wiz Research’s "Red Agent"—an autonomous, AI-powered security research tool—identified a critical GitHub Actions workflow vulnerability in one of Snowflake’s public repositories.

This incident highlights a rapidly emerging reality in software development: how AI coding assistants can inadvertently introduce workflow injection vulnerabilities, and how automated AI agents can rapidly surface them in the wild.

Upon responsible disclosure on June 23, 2026 by Wiz, Snowflake remediated the vulnerability on the same day, rotated the affected credential, and verified via detailed audit logs that Wiz was the sole actor during the exposure window. Wiz confirmed that all data accessed during proof-of-concept testing was securely deleted.

Wiz Red Agent identified a script injection vulnerability in snowflakedb/snowflake-connector-net. The issue allowed an unauthenticated user to execute arbitrary commands within a GitHub Actions runner by opening a GitHub issue with a specially crafted title.

Crucially, the vulnerability was introduced on June 18, 2026—just five days prior to discovery—via a commit co-authored by Copilot Autofix powered by AI (PR #1218). The AI assistant removed the repository's existing sanitized input pattern and replaced it with direct string expansion in a shell script.

Screenshot demonstrating access to Snowflake's Jira portal, via an exfiltrated token

Discovery

Wiz Red Agent's CI/CD capability scanned Snowflake's GitHub organization and flagged the jira_issue.yml Workflow in snowflakedb/snowflake-connector-net as vulnerable to script injection via untrusted input in run: blocks. 

AI Assistant (Github Copilot) Change

- env:
  - ISSUE_TITLE: ${{ github.event.issue.title }}
- run: jq -n --arg title "$ISSUE_TITLE" ...
+ run: TITLE=$(echo '${{ github.event.issue.title }}' | sed ...)

The workflow triggered on issues: opened - meaning any GitHub user could fire it by opening an issue - and interpolated the attacker-controlled issue title directly into a shell script:

run: | TITLE=$(echo '${{ github.event.issue.title }}' | sed 's/"/\\"/g' | sed "s/'/\\\'/g") 

The sed escaping runs after GitHub's template expansion, a single quote in the title breaks out of echo '...' and allows arbitrary command execution.

The injectable pattern was introduced just days earlier, on June 18, 2026, commit 4a1b8ce (PR #1218: “SNOW-2069227: Update jira workflows”) - co-authored by Copilot Autofix powered by AI.

The commit introducing the vulnerable pattern

It removed the repository’s existing safe pattern, which passed the issue title through an env: variable and built the JSON payload with jq. Instead it used the direct ${{ github.event.issue.title }} interpolation shown above. In other words, an AI “autofix” commit created the very injection vector.

The code change introducing the vulnerable pattern

The Open “Security Gate”

The workflow had an if: condition that appeared protective:

However, on issues events, github.event.pull_request is always null. 

So the condition reduces to (null != 'whitesource-for-github-com[bot]'). This is always true, and every GitHub user passes the gate.

The Open “Security Gate”

We crafted an issue title that, after template expansion, breaks out of the echo string and exfiltrates the Jira credentials via an out-of-band callback:

Crucially, when Red Agent’s cicd capability initially attempted exfiltration using a standard comment character (#), the runner returned a bash syntax error because the comment consumed the closing parenthetical of TITLE=$(...). Rather than stopping or failing, Red Agent:

  1. autonomously analyzed the syntax execution error

  2. adjusted its payload to use ; echo ' to properly close the shell block, and

  3. successfully received the out-of-band callback

Within seconds, our listener received the callback from a GitHub Actions runner (Azure IP 20.106.182.197) containing base64-encoded credentials.

The POC PR with payload in the Issue title

Note: Our first attempt used # to comment out the rest of the line, which caused an unexpected EOF bash error because it also ate the closing ) of TITLE=$(...). The fix was using ; echo ' to properly close the shell syntax.

The workflow log showing successful exploitation
The exfiltrated token linked to [email protected]

The exfiltrated token authenticated as [email protected] to snowflakecomputing.atlassian.net, granting read access across Snowflake's engineering, security compliance, and bug bounty tracking projects.

  1. Same-Day Patching: Snowflake patched the workflow on June 23, 2026 (1dc7766, PR #1402), fully restoring the safe env: variable and jq --arg parsing pattern.

  2. Credential Revocation: The JIRA token in question was revoked and rotated.

  3. Forensic Verification: Comprehensive audit log analysis confirmed that no external third parties accessed the endpoint during the 5-day exposure window. All anomalous queries were strictly matched to Wiz's testing IPs.

  • AI Code Generation Demands Rigorous Oversight: AI coding tools predict code based on probabilistic patterns, which can inadvertently reintroduce deprecated or insecure shell patterns. AI-generated PRs must undergo the same static analysis and security scrutiny as human code.

  • Collapsing Discovery Windows: The vulnerability was live for only five days before an automated agent discovered and validated it. Security operations must adapt to a landscape where automated discovery occurs in hours, requiring rapid patch cycles and short-lived credentials.

  • Preventing AI Security Regressions: Automated AI assistants often lack historical context regarding why specific code patterns were chosen. In this incident, an automated PR removed a safe env: + jq parsing pattern that had been explicitly implemented to prevent shell injection. Security teams must implement Guardrails that block AI agents from replacing structured data parsers with direct string interpolation.

Disclosure Timeline 

Snowflake appreciates Wiz's responsible reporting of and collaboration around these findings through our vulnerability disclosure and bug bounty program, HackerOne. Wiz Research reported a security vulnerability in one of Snowflake's public GitHub repositories. The disclosure was received on June 23, 2026, and it was immediately investigated and remediated, and our investigation found no evidence of unauthorized access. Protecting our systems remains a top priority, and we remain committed to continually strengthening our software development and security practices. We are working together with Wiz to share these learnings with the broader industry to encourage widespread adoption of these security best practices.

联系我们 contact @ memedata.com