🇰🇷 한글 설명
GitHub Copilot CLI 0.0.422 이하 버전의 shell 도구가 bash 파라미터 확장 패턴을 통해 임의 코드 실행을 허용합니다. 공격자가 리포지토리 파일, MCP 서버 응답, 사용자 지시를 통해 명령어에 영향을 미칠 수 있다면, ${var@P}, ${var=value}, ${!var} 등의 bash 파라미터 변환 연산자를 이용해 read-only로 분류된 명령어를 우회하여 악의적 코드를 실행할 수 있습니다. 버전 0.0.423에서 패치되었습니다.
💡 쉬운 설명
GitHub Copilot CLI에 숨겨진 코드를 명령어에 끼워넣어 실행시킬 수 있는 보안 구멍이 있습니다. 악의적인 파일이나 지시를 통해 공격자가 당신의 컴퓨터에서 원하는 명령어를 몰래 실행할 수 있습니다.
🇺🇸 원문 (English)
The shell tool within GitHub Copilot CLI versions prior to and including 0.0.422 can allow arbitrary code execution through crafted bash parameter expansion patterns. An attacker who can influence the commands executed by the agent (e.g., via prompt injection through repository files, MCP server responses, or user instructions) can exploit bash parameter transformation operators to execute hidden commands, bypassing the safety assessment that classifies commands as "read-only." This has been patched in version 0.0.423.
The vulnerability stems from how the CLI's shell safety assessment evaluates commands before execution. The safety layer parses and classifies shell commands as either read-only (safe) or write-capable (requires user approval). However, several bash parameter expansion features can embed executable code within arguments to otherwise read-only commands, causing them to appear safe while actually performing arbitrary operations.
The specific dangerous patterns are ${var@P}, ${var=value} / ${var:=value}, ${!var}, and nested $(cmd) or <(cmd) inside ${...} expansions. An attacker who can influence command text sent to the shell tool - for example, through prompt injection via malicious repository content (README files, code comments, issue bodies), compromised or malicious MCP server responses, or crafted user instructions containing obfuscated commands - could achieve arbitrary code execution on the user's workstation. This is possible even in permission modes that require user approval for write operations, since the commands can appear to use only read-only utilities to ultimately trigger write operations. Successful exploitation could lead to data exfiltration, file modification, or further system compromise.
📍 영향받는 시스템
GitHub Copilot CLI 버전 0.0.422 이하
⚔️ 공격 벡터
프롬프트 주입 (리포지토리 파일, MCP 서버, 사용자 지시)을 통해 bash 파라미터 확장으로 코드 실행
🛡️ 대응 방법
GitHub Copilot CLI를 버전 0.0.423 이상으로 업데이트
🔧 검증 코드
Vulnerable이 출력되면 0.0.422 이하 버전 설치됨. 출력이 없으면 0.0.423 이상 또는 설치되지 않음
gh copilot --version 2>/dev/null | grep -oP '\d+\.\d+\.\d+' | awk -F. '{if($1==0 && $2==0 && $3<=422) print "Vulnerable"}'