Critical Gitea Flaw Let Unauthenticated Attackers Read Server Files via Org-Mode Markup
Critical unauthenticated file-read vulnerability (CVE-2026-59774, CVSS 9.8) in Gitea versions 1.22.1 through 1.27.0 allows attackers to read any file accessible to the service account via crafted Org-mode markup The flaw exists in Gitea's Org-mode renderer, which failed to override the default `ReadFile` callback in the `go-org` library, allowing `#+INCLUDE` directives with absolute paths to leak server files The file-read primitive can potentially escalate to remote code execution by reading `a
Analysis
TL;DR
- Critical unauthenticated file-read vulnerability (CVE-2026-59774, CVSS 9.8) in Gitea versions 1.22.1 through 1.27.0 allows attackers to read any file accessible to the service account via crafted Org-mode markup
- The flaw exists in Gitea's Org-mode renderer, which failed to override the default
ReadFilecallback in thego-orglibrary, allowing#+INCLUDEdirectives with absolute paths to leak server files - The file-read primitive can potentially escalate to remote code execution by reading
app.ini, extracting theINTERNAL_TOKEN, injecting a Git hook through the internal logger, and triggering it during an anonymous clone - The vulnerability was discovered by XBOW Security (an autonomous offensive security system) and independently reported by Shai Rod (NightRang3r), with the fix landing in PR #38642 and backported in PR #38645
- No exploitation in the wild was reported as of August 5, 2026, and the vulnerability had not yet appeared on CISA's Known Exploited Vulnerabilities catalog
Why It Matters
This vulnerability is significant for AI practitioners and DevOps teams because Gitea is a widely adopted self-hosted Git platform, and the unauthenticated nature of the exploit means any instance with public repositories is immediately vulnerable without requiring credentials. The potential escalation chain from file read to remote code execution demonstrates how seemingly isolated rendering flaws can become full system compromises, which is particularly relevant for organizations running AI/ML pipelines on self-hosted infrastructure where sensitive credentials and model artifacts are stored.
Technical Details
- Vulnerability Vector: The markup rendering endpoint
POST /{owner}/{repo}/markupallows anonymous access to public repositories with the code unit enabled. An attacker submits Org-mode markup withMode: fileand absolute filesystem paths via the#+INCLUDEdirective. - Root Cause: Gitea 1.27.0 initialized
go-orgwithorg.New()without overriding the library's defaultReadFilecallback, which ingo-org1.9.1 isioutil.ReadFile. This allowed arbitrary file reads from the server filesystem. - Escalation Chain: File read → extract
INTERNAL_TOKENfromapp.ini→ inject Git hook via internal logger → trigger hook during anonymous clone → remote code execution. This chain remains single-sourced to Gitea's advisory with no independently published exploit. - Fix: PR #38642 (main) and PR #38645 (backport) override
ReadFileso Org-mode include paths are returned as plain rendered content instead of being resolved from the server filesystem. A regression test was added for include-path rendering. - Scope: Versions 1.22.1 through 1.27.0 are affected. Instances with no public repositories are not exposed to the anonymous attack path. Gitea Cloud instances were upgraded automatically; self-hosted administrators must manually upgrade to 1.27.1.
Industry Insight
- Patch Urgency: Self-hosted Gitea administrators should upgrade to 1.27.1 immediately and treat any instance with exposed public repositories as potentially compromised, rotating all credentials (internal tokens, OAuth material, JWT signing keys, database credentials) even if no exploitation is confirmed.
- Supply Chain Security: The discovery by an autonomous offensive security system (XBOW Security) highlights the growing role of AI-driven vulnerability research in identifying flaws in widely-deployed open-source infrastructure, suggesting organizations should monitor such tools for proactive security assessments.
- Pattern Recognition: This vulnerability follows a dense stretch of Gitea security issues (CVE-2026-20896 in June, CVE-2026-27771 in May), indicating a pattern of critical flaws in self-hosted Git platforms that organizations should address through automated patch management, regular security audits, and minimizing public repository exposure where possible.
Disclaimer: The above content is generated by AI and is for reference only.