
PoC for Gitea versions before 1.27.1 is vulnerable to Path Traversal (CWE-22), which leads to unauthenticated arbitrary file read / information disclosure leading to RCE CVSS 9.8
(RCE NOT YET IMPLEMENTED, only file read)
A Python-based baseline and regression-testing project for investigating CVE-2026-59774, an unauthenticated file-disclosure vulnerability in Gitea's Org-mode markup renderer.
Scope: Authorized local testing only. This project is intended for controlled security research and patch validation.
Gitea's Org-mode renderer processed user-supplied #+INCLUDE directives without adequately restricting filesystem access. Under affected configurations, an unauthenticated request to a suitable public repository's markup endpoint could expose files readable by the Gitea service account.
Gitea’s Org-mode renderer processed user-controlled #+INCLUDE directives in the public markup endpoint without adequately restricting the filesystem path being read. In affected versions, an unauthenticated request could send a crafted payload to the repository markup handler with a repository context and a file path such as /etc/hosts or another local file. Because the server resolved and returned the included content without enforcing a safe path boundary, the request enabled arbitrary local file disclosure (CWE-22 / path traversal). The flaw exists in the public rendering flow, which is why it can be reached without authentication in vulnerable configurations.
This vulnerability allows an attacker to read arbitrary files from the host running Gitea, including sensitive configuration, credentials, environment data, and other local content. In containerized or shared deployments, this may expose mounted secrets, SSH keys, service configuration, and application data. While the disclosed information is primarily a file-read primitive, the leaked data can be used to pivot further into the environment and may enable privilege escalation or remote code execution depending on the deployment. Affected Gitea versions are 1.22 through versions earlier than 1.27.1; the upstream fix was included in Gitea 1.27.1.
I will include the RCE functionality later on.
requests Python packageInstall the dependency:
python -m pip install requests
127.0.0.1.Use Gitea 1.27.0 for the affected-version comparison and 1.27.1 or a later patched release for regression testing.
Save the script as poc.py.
python3 poc.py -u http://localhost:3000 -r pwn/pwn -f file/to/read
The script checks local instance connectivity and reports the HTTP status and reponds with the file contents.
This project is for educational security research, authorized testing, and defensive regression validation. The author assumes no responsibility for unauthorized use. In testing, several WAFs seem to block this PoC.
This project is for educational security research, authorized testing, and defensive regression validation. The author assumes no responsibility for unauthorized use.