🇰🇷 한글 설명
Gitea의 저장소 마이그레이션 API가 비공개 저장소 생성을 요청할 때 공개 전용 토큰을 허용하는 취약점입니다. 공개 리소스에만 권한이 있는 위임된 토큰을 사용하여 사용자의 계정이나 조직 내에 비공개 저장소 및 마이그레이션 작업을 생성할 수 있습니다.
💡 쉬운 설명
공개적인 활동만 할 수 있는 권한을 가진 열쇠로 몰래 개인적인 저장소를 만들 수 있는 보안 허점입니다. 원래는 권한이 없는 작업이지만, 마이그레이션이라는 특정 경로를 통해 보안 검사를 우회할 수 있습니다.
🇺🇸 원문 (English)
Gitea's repository migration API accepts a public-only token when the request specifies creation of a private repository. A delegated token intended to operate only on public resources can create a private repository and migration task under the authorizing account or an organization where that user has the necessary permissions. The ordinary private repository-creation route rejects the same token, but the migration path omits that restriction.
📍 영향받는 시스템
Gitea (repository migration API를 사용하는 버전)
⚔️ 공격 벡터
공개 전용 토큰을 사용하여 마이그레이션 API를 통해 비공개 저장소 생성 요청을 보냄
🛡️ 대응 방법
Gitea를 최신 보안 패치가 적용된 버전으로 업데이트하고 API 권한 검증 로직을 강화함
🔧 검증 코드
공개 전용 토큰으로 비공개 저장소 생성이 성공(201 Created)하면 취약한 상태이며, 거부(403 Forbidden)되면 안전한 상태입니다.
curl -X POST -H "Authorization: Bearer <PUBLIC_TOKEN>" https://<gitea-instance>/api/v1/repos/migrate -d '{"private": true, ...}'