Executive brief
Gogs, a self-hosted Git service, is vulnerable to an open redirect flaw. Attackers can create malicious links that appear to belong to a trusted Gogs instance but actually redirect users to external, potentially harmful websites. This can be used in phishing campaigns to steal user credentials or distribute malware by exploiting the user's trust in the original domain.
Technical details
An open redirect vulnerability exists in Gogs prior to version 0.14.3 due to a flaw in the 'IsSameSite' validation function. The function only inspects the first two characters of a URL to ensure it is a relative path (starting with '/' but not '//' or '/\'). However, it fails to account for directory traversal sequences followed by backslashes (e.g., '/a/../\example.com'). Because modern web browsers normalize backslashes to forward slashes, the resulting path is interpreted as a cross-origin redirect (e.g., '//example.com'). Attackers can exploit this by crafting 'redirect_to' parameters in login or post-action flows to facilitate phishing or credential theft. The issue is fixed in version 0.14.3 by hardening the URL parsing and normalization logic.
Affected products
- Gogs Gogs < 0.14.3
Timeline
- 2026-06-05: patched: Fix merged into main branch
- 2026-06-07: advisory: Release v0.14.3 published
- 2026-06-24: disclosed: CVE-2026-52802 published