🇰🇷 한글 설명
check-branches 패키지의 모든 버전에 존재하는 명령 주입 취약점입니다. 이 도구는 브랜치 이름을 신뢰하고 사용자 입력을 git 명령에 직접 연결하여 실행하므로, 원격에서 생성된 브랜치 이름을 통해 임의의 명령을 실행할 수 있습니다.
💡 쉬운 설명
git 브랜치 이름을 만들 때 특수 문자를 포함하면 다른 명령이 실행될 수 있습니다. 예를 들어 '; rm -rf /'와 같은 위험한 명령을 브랜치 이름에 숨겨서 실행할 수 있습니다.
🇺🇸 원문 (English)
All versions of the package check-branches are vulnerable to Command Injection check-branches is a command-line tool that is interacted with locally, or via CI, to confirm no conflicts exist in git branches.
However, the library follows these conventions which can be abused:
1. It trusts branch names as they are (plain text)
2. It spawns git commands by concatenating user input
Since a branch name is potentially a user input - as users can create branches remotely via pull requests, or simply due to privileged access to a repository - it can effectively be abused to run any command.
📍 영향받는 시스템
check-branches 패키지 전체 버전
⚔️ 공격 벡터
악의적인 브랜치 이름(예: `test; malicious-command`)을 리모트에서 생성하면 check-branches 실행 시 주입된 명령이 실행됨
🛡️ 대응 방법
check-branches 패키지를 즉시 업데이트하거나 삭제하고, 명령 실행 시 입력값 검증 및 이스케이핑을 수행하는 대체 도구 사용
🔧 검증 코드
check-branches가 설치되어 있으면 버전 정보가 표시되고, 설치되지 않았으면 'not installed' 메시지가 출력됨
npm list check-branches 2>/dev/null || echo 'Package not installed'