GHSA-3r5c-2xxx-h872: Gitea: Webhook Authorization Header Returned in Plaintext via API
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
func ToHook(repoLink string, w *webhook_model.Webhook) (*api.Hook, error) {
// ...
authorizationHeader, err := w.HeaderAuthorization() // DECRYPTS from DB
if err != nil {
return nil, err
}
return &api.Hook{
// ...
AuthorizationHeader: authorizationHeader, // PLAINTEXT in response
// ...
}, nil
}
Decryption function: models/webhook/webhook.go:209-216
func (w Webhook) HeaderAuthorization() (string, error) {
if w.HeaderAuthorizationEncrypted == "" {
return "", nil
}
return secret.DecryptSecret(setting.SecretKey, w.HeaderAuthorizationEncrypted)
}
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
1. Admin A creates a webhook with a sensitive authorization header.
2. Admin B (different repo admin) lists webhooks via GET /api/v1/repos/{owner}/{repo}/hooks.
3. 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 enc
Details
Original advisory: https://github.com/advisories/GHSA-3r5c-2xxx-h872
Referenced CVEs
| CVE | CSIRTS overview | External |
|---|---|---|
| CVE-2026-58511 | coverage & exploitation status | NVD · CVE.org |
Same CVEs, other sources
How other CERTs, PSIRTs and databases cover the vulnerabilities in this advisory.
- high[NEW] [high] Gitea: Multiple vulnerabilitiescert-bund
More from GitHub Security Advisories
- mediumGHSA-jr6p-8pjj-mfx6: Capsule has an incomplete fix of CVE-2026-22872: TenantResource RawItems and Generators s…2026-07-31
- mediumGHSA-68cj-mvg9-rgm2: Capsule: CapsuleConfiguration NodeMetadata regex fields lack webhook validation, allowing…2026-07-31
- mediumGHSA-ff84-5f28-78qj: re2: Out-of-bounds heap read in `exec`/`test`/`match` via attacker-influenced `lastIndex`…2026-07-31
- mediumGHSA-6hxr-mr5r-9836: re2: Global `String.prototype.match` with an empty-matchable pattern never advances → inf…2026-07-31
- mediumGHSA-x83g-979r-f5fh: Sylius Mollie Plugin has unauthenticated IDOR that leaks order token and customer PII2026-07-31