Gitea: Webhook Authorization Header Returned in Plaintext via API
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
계획된 패치 주기 내 조치(60일 이내)
CVSS 벡터 · 메트릭
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N상세 설명
Summary
The ToHook() function in services/webhook/general.go decrypts the webhook's HeaderAuthorizationEncrypted field and returns the plaintext authorization header in the API response. Any repository admin can read the full plaintext value of webhook authorization headers (Bearer tokens, Basic auth credentials, API keys) set by other admins.
The authorization header is stored encrypted in the database using the server's SecretKey, but ToHook() decrypts it before serializing it into the API response — converting a write-only secret into a readable credential.
Vulnerable Code
File: services/webhook/general.go:407-420
1func ToHook(repoLink string, w *webhook_model.Webhook) (*api.Hook, error) { 2 // ... 3 authorizationHeader, err := w.HeaderAuthorization() // DECRYPTS from DB 4 if err != nil { 5 return nil, err 6 } 7 return &api.Hook{ 8 // ... 9 AuthorizationHeader: authorizationHeader, // PLAINTEXT in response10 // ...11 }, nil12}Decryption function: models/webhook/webhook.go:209-216
1func (w Webhook) HeaderAuthorization() (string, error) { 2 if w.HeaderAuthorizationEncrypted == "" { 3 return "", nil 4 } 5 return secret.DecryptSecret(setting.SecretKey, w.HeaderAuthorizationEncrypted) 6}Affected Endpoints
All call ToHook():
GET /api/v1/repos/{owner}/{repo}/hooks(requires repo admin)GET /api/v1/repos/{owner}/{repo}/hooks/{id}(requires repo admin)GET /api/v1/admin/hooks(requires site admin)GET /api/v1/orgs/{org}/hooks(requires org admin)GET /api/v1/user/hooks(requires authenticated user)
Steps to Reproduce
- Admin A creates a webhook with a sensitive authorization header.
- Admin B (different repo admin) lists webhooks via
GET /api/v1/repos/{owner}/{repo}/hooks. - The API response includes the full plaintext authorization header set by Admin A.
Impact
- Cross-admin secret exposure on shared repositories
- Credential harvesting if a repo admin's Gitea token is stolen
- External service compromise via leaked Bearer tokens and API keys
- Undermines the intentional encryption-at-rest protection
Suggested Fix
The authorization header should be write-only. Return a masked/redacted version or a boolean has_authorization_header flag instead.
References
- Vulnerable function:
services/webhook/general.go:392-425 - Decryption function:
models/webhook/webhook.go:209-216 - Verified against commit 19f0169
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.