Critical Gitea Vulnerability Exposes Configuration Files, Tokens and Server Secrets

A critical vulnerability in Gitea, tracked as CVE-2026-59774, allows unauthenticated remote attackers to read arbitrary files on vulnerable servers and potentially escalate to remote code execution (RCE).

The flaw, disclosed in GHSA-6v53-hr58-556r, affects Gitea versions 1.22.1 through 1.27.0 and has been fixed in version 1.27.1.

The vulnerability carries a CVSS v3.1 score of Critical, with the vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. It requires no authentication, user interaction, or elevated privileges, making internet-exposed Gitea instances especially concerning.

Critical Gitea Vulnerability

The issue stems from Gitea’s repository markup rendering endpoint, POST /{owner}/{repo}/markup. Although the route includes repository assignment and reader checks, anonymous users can satisfy those checks when targeting a public repository with a readable code unit enabled.

An attacker can submit markup data to the endpoint and select the generic renderer’s file mode while specifying an .org filename. This causes Gitea to invoke its Org-mode renderer, which relies on the go-org library.

In Gitea 1.27.0, the application initializes go-org through org.New() without replacing the library’s default file-reading callback. In affected go-org versions, that callback maps to ioutil.ReadFile.

The Org-mode #+INCLUDE directive accepts absolute filesystem paths and forwards them to the default reader without restricting access to an intended directory.

Xbow Security stated that an unauthenticated attacker can use a public repository’s markup endpoint to retrieve files readable by the Gitea service account. The attack does not require a repository commit, repository write permissions, or an existing user account.

The arbitrary file-read primitive can expose highly sensitive material, including Gitea’s app.ini configuration file, internal bearer tokens, OAuth or JWT signing material, deployment details, and other server-side secrets.

The advisory warns that extracting Gitea’s INTERNAL_TOKEN from app.ini may enable a more severe attack chain. An attacker could use the token to interact with internal Gitea functionality and inject a malicious Git hook through the internal logger mechanism.

The hook could then execute commands as the Gitea operating-system user when an anonymous Git clone is performed.

This turns what initially appears to be a path traversal and information-disclosure flaw into a potential full server compromise. The issue is categorized as CWE-22, Improper Limitation of a Pathname to a Restricted Directory.

Affected and Mitigation

Organizations are vulnerable if they run an affected Gitea release and host at least one publicly readable repository with a code unit accepted by the markup route.

Standard Gitea storage permissions may also allow the service account to modify Gitea-managed global Git configuration, increasing the RCE risk.

Administrators should upgrade to Gitea 1.27.1 or later immediately. Teams should also rotate internal tokens, OAuth credentials, JWT keys, and other secrets that may have been accessible to the Gitea service user.

Security teams should review web and application logs for unusual anonymous requests to repository markup endpoints, particularly requests involving Org-mode rendering.

Cut SOC investigation blind spots and contain threats earlier to reduce response costs and business disruption with ANY.RUN. 

Tamilselvan
Tamilselvanhttps://cyberpress.org/
Tamilselvan is an Investigative cybersecurity journalist dedicated to breaking stories on ransomware cartels, data breaches, and state-sponsored espionage.

Trending News

Related Stories