CVE-2026-58511: Gitea Webhook Authorization Header Returned Vulnerability

LOW
Advisory Identifier: GHSA-3r5c-2xxx-h872
CVSS 2.7
CWE-200
Published
Advisory Summary

CVE-2026-58511 is a LOW (CVSS 2.7) webhook authorization header returned vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Gitea libraries in the Go ecosystem. The issue involves webhook authorization header returned in plaintext via api. Remediation is available by upgrading affected packages to version 1.27.0.

CVE-2026-58511 at a Glance

CVE Identifier CVE-2026-58511
GHSA Identifier GHSA-3r5c-2xxx-h872
Severity LOW
CVSS v3.1 Base Score 2.7
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Gitea
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 2.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-58511

To remediate this vulnerability, upgrade all affected Gitea dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

code.gitea.io/gitea fixed: 1.27.0
Upgrade code.gitea.io/gitea to 1.27.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for code.gitea.io/gitea

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-58511, inspect your project dependencies for Gitea:

inspect dependencies for code.gitea.io/gitea

Analyze the terminal output to locate any version of Gitea in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.27.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Gitea, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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` ```go 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` ```go 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 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

CVE-2026-58511 Affected Gitea Versions

1 component(s)
Fixed Versions:
1.27.0
Product / Package Ecosystem Affected Versions Fixed Version
code.gitea.io/gitea
Go
< 1.27.0
1.27.0

References

Frequently Asked Questions

What is CVE-2026-58511?
CVE-2026-58511 is a security vulnerability in Gitea involving Webhook Authorization Header Returned in Plaintext via API under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Gitea versions are affected?
Affected versions include releases prior to 1.27.0 across affected packages: code.gitea.io/gitea.
What version fixes CVE-2026-58511?
Upgrading to 1.27.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is code.gitea.io/gitea affected?
Yes, code.gitea.io/gitea is affected in releases prior to 1.27.0. Upgrade your dependency to 1.27.0 or later.
What is the CVSS score of CVE-2026-58511?
CVE-2026-58511 has a CVSS v3.1 base score of 2.7 (LOW) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2026-58511?
CVE-2026-58511 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check Go dependencies for CVE-2026-58511?
Run the dependency tree command: 'inspect dependencies for code.gitea.io/gitea'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3r5c-2xxx-h872",
  "modified" : "2026-07-21T21:52:49Z",
  "published" : "2026-07-21T21:52:49Z",
  "aliases" : [ "CVE-2026-58511" ],
  "summary" : "Gitea: Webhook Authorization Header Returned in Plaintext via API",
  "details" : "## Summary\n\nThe `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.\n\nThe 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.\n\n## Vulnerable Code\n\n**File:** `services/webhook/general.go:407-420`\n\n```go\nfunc ToHook(repoLink string, w *webhook_model.Webhook) (*api.Hook, error) {\n    // ...\n    authorizationHeader, err := w.HeaderAuthorization()  // DECRYPTS from DB\n    if err != nil {\n        return nil, err\n    }\n    return &api.Hook{\n        // ...\n        AuthorizationHeader: authorizationHeader,  // PLAINTEXT in response\n        // ...\n    }, nil\n}\n```\n\n**Decryption function:** `models/webhook/webhook.go:209-216`\n\n```go\nfunc (w Webhook) HeaderAuthorization() (string, error) {\n    if w.HeaderAuthorizationEncrypted == \"\" {\n        return \"\", nil\n    }\n    return secret.DecryptSecret(setting.SecretKey, w.HeaderAuthorizationEncrypted)\n}\n```\n\n## Affected Endpoints\n\nAll call `ToHook()`:\n- `GET /api/v1/repos/{owner}/{repo}/hooks` (requires repo admin)\n- `GET /api/v1/repos/{owner}/{repo}/hooks/{id}` (requires repo admin)\n- `GET /api/v1/admin/hooks` (requires site admin)\n- `GET /api/v1/orgs/{org}/hooks` (requires org admin)\n- `GET /api/v1/user/hooks` (requires authenticated user)\n\n## Steps to Reproduce\n\n1. Admin A creates a webhook with a sensitive authorization header.\n2. Admin B (different repo admin) lists webhooks via `GET /api/v1/repos/{owner}/{repo}/hooks`.\n3. The API response includes the full plaintext authorization header set by Admin A.\n\n## Impact\n\n- Cross-admin secret exposure on shared repositories\n- Credential harvesting if a repo admin's Gitea token is stolen\n- External service compromise via leaked Bearer tokens and API keys\n- Undermines the intentional encryption-at-rest protection\n\n## Suggested Fix\n\nThe authorization header should be write-only. Return a masked/redacted version or a boolean `has_authorization_header` flag instead.\n\n## References\n\n- Vulnerable function: `services/webhook/general.go:392-425`\n- Decryption function: `models/webhook/webhook.go:209-216`\n- Verified against commit 19f0169",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "code.gitea.io/gitea"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.27.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/security/advisories/GHSA-3r5c-2xxx-h872"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-gitea/gitea"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/releases/tag/v1.27.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-21T21:52:49Z",
    "nvd_published_at" : null
  }
}