Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Vulnerabilities

GitHub Issues Abused in Copilot Attack Leading to Repository Takeover

Attackers can inject malicious instructions in a GitHub Issue that are automatically processed by Copilot when launching a Codespace from that issue.

GitHub vulnerability

A vulnerability in GitHub Codespaces could have allowed attackers to take over repositories by injecting malicious Copilot instructions in a GitHub issue.

The attack, Orca Security says, could have allowed attackers to trigger passive prompt injections via GitHub issues, instructing Copilot to silently leak a user’s GitHub token.

“By manipulating Copilot in a Codespace to check out a crafted pull request that contains a symbolic link to an internal file, an attacker can cause Copilot to read that file and (via a remote JSON $schema) exfiltrate a privileged GITHUB_TOKEN to a remote server,” Orca explains.

A cloud-based development environment powered by Visual Studio (VS) Code, Codespaces provides a workspace for a repository, integrates with Copilot for AI-assisted suggestions, and can be launched from repositories, pull requests, commits, and issues.

When launching Codespaces from an issue, “the in-environment Copilot AI assistant is immediately prompted with the issue’s description,” Orca explains.

The supply chain attack, which the cybersecurity firm has named RoguePilot, abuses several Codespaces features meant to increase its usability, as well as Copilot’s deep integration within the development workspace.

Advertisement. Scroll to continue reading.

For example, an attacker can manipulate an issue’s description using HTML comments to hide malicious content, thus injecting malicious Copilot instructions without triggering the developer’s suspicion when visually inspecting the code.

Because VS Code supports fetching JSON schemas from the web and the setting is enabled by default in Codespaces, Orca explains, an attacker can abuse these features to exfiltrate data by appending it to the schema URL.

Furthermore, GitHub preserves symbolic links in repositories and, because these may point to sensitive information and they can be followed in certain contexts, an attacker could “exploit this behavior to access or exfiltrate data,” Orca says.

Additionally, attackers can target the GITHUB_TOKEN environment variable, which is automatically generated and provides read and write access to the repository in use.

In a RoguePilot attack, a threat actor injects a malicious prompt instructing Copilot to perform a series of actions to exfiltrate the GITHUB_TOKEN in a JSON file created by the assistant within the workspace, without requiring approval.

“In our research, we demonstrated a practical chain: issue text bound to an in-environment Copilot agent, repository symlinks that reach shared runtime files, and automatic JSON schema downloads together enabled exfiltration of a Codespaces GITHUB_TOKEN and a full repository takeover,” Orca notes.

GitHub patched the vulnerability after it was notified by the security firm. 

Related: Autonomous AI Agents Provide New Class of Supply Chain Attack

Related: VS Code Configs Expose GitHub Codespaces to Attacks

Related: ‘PackageGate’ Flaws Open JavaScript Ecosystem to Supply Chain Attacks

Related: eScan Antivirus Delivers Malware in Supply Chain Attack

Written By

Ionut Arghire is an international correspondent for SecurityWeek.

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing for the latest cybersecurity threats, trends, and expert insights.

Trending

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Today’s attackers are no longer breaking in — they’re logging in. Join this live webinar as we break down the modern identity attack chain and examine how recent breaches exploited weaknesses in authentication, identity verification, and access management processes.

Register

AI has accelerated both sides of the fight. Adversaries are weaponizing vulnerabilities faster, while defenders are racing to ship detections and configurations. Join this live webinar as we explore how to prove your controls actually hold against new threats, map your security maturity, and unite breach simulation with automated pentesting into a single, coordinated program.

Register

People on the Move

Stephen Garcia has been named Chief Information Security Officer at BreachRx.

Kasper Lindgaard has been appointed Vice President of Security Strategy at CoreView.

Chaim Mazal has been named Chief Information Security Officer at GitLab.

More People On The Move

Expert Insights

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest cybersecurity news, threats, and expert insights. Unsubscribe at any time.