Skip to content

Unauthenticated Arbitrary File Read can lead to RCE

Critical
TheFox0x7 published GHSA-6v53-hr58-556r Aug 2, 2026

Package

gomod gitea.dev (Go)

Affected versions

1.22 < 1.27.1

Patched versions

1.27.1

Description

Summary

An unauthenticated remote attacker can submit Org-mode markup containing
a #+INCLUDE directive to POST /{owner}/{repo}/markup for any suitable public
repository to read arbitrary server files. By extracting INTERNAL_TOKEN from
app.ini, they can inject a Git hook through the internal logger and achieve
command execution as the Gitea OS user during an anonymous clone.

Details

Gitea registers POST /{username}/{reponame}/markup with optional sign-in,
repository assignment, and a repository-unit reader check. An anonymous user
passes that check for a public repository with a normal readable code unit.
The handler passes the supplied Mode, Text, and FilePath into Gitea's
generic markup renderer. Selecting Mode: file and a .org filename chooses
the Org-mode renderer.

Gitea 1.27.0 initializes go-org using org.New() and does not replace its
default ReadFile callback. In go-org 1.9.1, that callback is ioutil.ReadFile;
#+INCLUDE accepts absolute paths and passes them directly to that callback.

Preconditions

  • At least one repository is publicly readable and exposes a unit accepted by
    the repository markup route. A normal public repository with its code unit
    enabled satisfies this condition.
  • Standard Gitea storage permissions allow the service user to update Gitea's
    managed global Git configuration.

Impact

  • Read arbitrary files accessible to the Gitea service user without an account.
  • Submit the file-read payload directly through a public repository's web markup
    route without committing a file or obtaining repository write access.
  • Expose Gitea configuration, internal bearer tokens, OAuth/JWT material, and deployment metadata

Affected

  • The vulnerable version seem v1.22.1 ~ v1.27.0

Credit

Found by @xbow-security. Triaged by Guido Leo guido.leo@xbow.com.

Independently reported by https://github.com/NightRang3r

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

CVE ID

CVE-2026-59774

Weaknesses

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. Learn more on MITRE.

Credits