🇰🇷 한글 설명
virtualenv의 bash activate 스크립트가 zsh 환경에서 환경 변수를 적절히 이스케이프하지 않아 발생하는 취약점입니다. PROMPT_SUBST가 활성화된 zsh 사용자의 경우, 조작된 환경 이름이나 프롬프트 값이 PS1에 할당될 때 임의의 명령어가 실행될 수 있습니다.
💡 쉬운 설명
가상 환경을 만들 때 사용하는 도구의 설정 오류로 인해, 악의적으로 만들어진 폴더 이름이 포함된 환경을 실행하면 해커가 사용자의 컴퓨터에서 몰래 명령어를 실행할 수 있습니다. zsh라는 터미널을 사용하는 사용자에게 특히 위험합니다.
🇺🇸 원문 (English)
virtualenv is a tool for creating isolated virtual python environments. Prior to 21.13.0, the bash activate script that zsh also sources leaves the environment name unescaped; from 21.13.0 until 21.14.4, it escapes backslashes, dollar signs, and backticks only when BASH_VERSION is set, so zsh receives the raw value. The script assigns that value to PS1. In zsh with PROMPT_SUBST, an attacker-influenced environment directory, --prompt, or VIRTUALENV_PROMPT value containing command, parameter, or arithmetic expansion syntax can therefore execute commands in the user's shell each time the prompt is drawn. A percent sign is separately interpreted as a zsh prompt escape but does not by itself execute commands. Plain zsh with PROMPT_SUBST disabled and bash are not affected by this mechanism. This issue is fixed in version 21.14.4.
📍 영향받는 시스템
virtualenv 21.13.0 미만 및 21.13.0 이상 21.14.4 미만 버전
⚔️ 공격 벡터
조작된 환경 이름, --prompt 옵션 또는 VIRTUALENV_PROMPT 값을 이용한 명령 실행
🛡️ 대응 방법
virtualenv를 21.14.4 이상의 최신 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 버전이 21.14.4보다 낮으면 취약한 상태입니다.
pip show virtualenv | grep Version