🇰🇷 한글 설명
Gitea의 조직 저장소 생성 API가 write:organization 권한만 요구하고 write:repository 권한을 누락하여 발생한 취약점입니다. 이로 인해 저장소 쓰기 권한이 없는 토큰을 가진 사용자도 조직 권한이 있다면 조직 소유의 저장소를 생성할 수 있습니다. 이는 토큰의 위임된 권한 범위를 우회하는 결과를 초래합니다.
💡 쉬운 설명
사용자가 특정 권한(저장소 만들기)을 제한해 둔 토큰을 사용하더라도, 조직 관리 권한만 있다면 몰래 새로운 저장소를 만들 수 있는 문제입니다. 토큰이 허용된 범위를 벗어나 권한을 남용할 수 있는 보안 허점이 존재합니다.
🇺🇸 원문 (English)
Gitea's organization repository-creation API requires write:organization but omits the write:repository token scope enforced by other repository-creation routes. A personal access token or OAuth application token without repository-write scope can therefore create organization-owned repositories if the authorizing user has permission to do so. This bypasses the token's delegated scope boundary while remaining subject to the user's organization permissions.
📍 영향받는 시스템
Gitea (해당 취약점이 해결되기 전 버전)
⚔️ 공격 벡터
write:repository 권한이 없는 개인 액세스 토큰(PAT) 또는 OAuth 토큰을 사용하여 조직 저장소 생성 API 호출
🛡️ 대응 방법
Gitea를 최신 보안 패치가 적용된 버전으로 업데이트하고, API 호출 시 write:repository 권한을 반드시 검증하도록 수정해야 합니다.
🔧 검증 코드
저장소 쓰기 권한이 없는 토큰으로 API 호출 시 성공(Vulnerable)하면 취약한 상태이며, 오류가 발생하면 안전한 상태입니다.
curl -s -X POST "https://<gitea-url>/api/v1/orgs/<org_name>/repos" -H "Authorization: token <token_without_repo_write_scope>" -d '{"name":"test-repo"}' | grep -q 'repository' && echo 'Vulnerable' || echo 'Not Vulnerable'