🇰🇷 한글 설명
cal.com(현재 cal.diy)의 GitHub Actions 워크플로우에서 저장소 탈취 취약점이 발견되었습니다. 공격자가 pull_request_target 트리거를 악용하여 쓰기 권한이 있는 GITHUB_TOKEN을 획득함으로써 저장소의 코드를 수정하거나 브랜치를 삭제하는 등 전체 제어권을 가질 수 있습니다.
💡 쉬운 설명
해커가 가짜 수정 요청을 보내면, 시스템이 자동으로 해커의 악성 코드를 실행하면서 관리자 권한을 넘겨주는 보안 구멍이 발견되었습니다. 이를 통해 해커는 프로젝트의 소스 코드를 마음대로 바꾸거나 삭제할 수 있습니다.
🇺🇸 원문 (English)
cal.com (calcom repository, later renamed cal.diy) is affected by a repository takeover vulnerability in its GitHub Actions workflows. The workflow pr.yml uses the pull_request_target trigger with the repository's default write permissions and passes them down to check-types.yml. check-types.yml then performs a 'dangerous' checkout of the attacker-submitted pull request code (via the dangerous-git-checkout action) and subsequently executes it (through yarn install and package.json scripts). An attacker can open a pull request whose code runs arbitrary commands with the repository's write-scoped GITHUB_TOKEN, allowing them to push commits, merge or mutate pull requests, add or delete comments, and delete or force-push branches, thereby compromising the repository. The main branch is affected; no patched version is available.
📍 영향받는 시스템
cal.com (cal.diy) repository (main branch)
⚔️ 공격 벡터
악성 코드가 포함된 Pull Request를 생성하여 GitHub Actions의 권한 오남용 유도
🛡️ 대응 방법
GitHub Actions 워크플로우에서 pull_request_target 트리거 사용 시 권한을 최소화하고, 신뢰할 수 없는 코드의 체크아웃 및 실행을 금지하도록 수정해야 함
🔧 검증 코드
명령어 결과로 pull_request_target 트리거와 dangerous-git-checkout 액션이 동시에 검색되면 취약한 설정이 존재함을 의미함
grep -r "pull_request_target" .github/workflows/ && grep -r "dangerous-git-checkout" .github/workflows/