CVE-2026-52803 — Gogs (< 0.15.0) — CWE-384
Gogs is an open source self-hosted Git service. Prior to 0.15.0, Gogs does not regenerate the session ID after successful authentication. An attacker who forces a victim to use a known session ID can hijack the session after the victim logs in and take over the account. This issue is fixed in version 0.15.0.
Gogs is an open source self-hosted Git service. Prior to 0.15.0, Gogs does not regenerate the session ID after successful authentication. An attacker who forces a victim to use a known session ID can hijack the session after the victim logs in and take over the account. This issue is fixed in version 0.15.0.
🎯 What is this vulnerability?
This vulnerability is a classic Session Fixation flaw (CWE-384) in the Gogs web application. The core technical deficiency lies in the session management logic during the authentication handshake.
When a user successfully authenticates (logs in), the application fails to regenerate the session identifier (Session ID). In a secure implementation, upon successful credential verification, the server should:
1. Invalidate the pre-authentication session.
2. Generate a new, cryptographically random Session ID.
3. Associate the new Session ID with the authenticated user's state.
In Gogs < 0.15.0, the Session ID remains constant before and after login. This allows an attacker who has previously established a session (and thus knows the Session ID) to hijack that session once the victim logs in using the same browser context or forced session ID. The attacker does not need to know the victim's password; they only need to force the victim to use a session ID that the attacker already controls.
The CVSS vector CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N confirms:
- AV:N: Exploitable over the network.
- AC:L: Low complexity (no race conditions or specific timing required).
- AT:P: Attack requires User Interaction (the victim must log in).
- PR:N: No prior privileges required (unauthenticated attacker).
- UI:P: User interaction is required (victim must click a link and log in).
- VC:H / VI:H: High impact on Confidentiality and Integrity (full account takeover).
- Banner Grabbing: Checking the
Serverheader or the footer of the login page, which often displays the Gogs version. - Fingerprinting: Using tools like
whatwebornmapwith Gogs-specific scripts. - Manual Inspection: Visiting
/or/loginand checking for version strings in the HTML source or API responses (e.g.,/api/v1/version).
⚡ Attack Chain
1. Discovery & Reconnaissance
The attacker identifies a Gogs instance running a version prior to 0.15.0. This can be done via:2. Exploitation
The attacker performs the following steps to hijack a victim's session:Step 1: Generate a Known Session ID
The attacker initiates a request to the Gogs login page or any public endpoint to establish a session. The server responds with a Set-Cookie header containing a session ID (e.g., gogs_session_id=abc123...). The attacker records this ID.
# Attacker initiates a session and captures the session ID
curl -c /tmp/attacker_cookies.txt -s http://target-gogs.example.com/login
# Output: Set-Cookie: gogs_session_id=abc123def456...; Path=/; HttpOnlyStep 2: Force the Victim to Use the Known Session ID
The attacker crafts a malicious link that sets the victim's browser cookie to the known session ID. This is typically done via a URL that triggers a session initialization or by embedding a JavaScript snippet in a phishing page that sets the cookie.
Illustrative Example (Phishing Link):
The attacker sends a link to the victim:http://target-gogs.example.com/login?session_id=abc123def456...
Note: The exact parameter name for session fixation may vary. In many web frameworks, simply visiting a page with a pre-set cookie is sufficient. The attacker ensures the victim's browser has the cookie gogs_session_id=abc123def456... before the victim logs in.
Step 3: Victim Logs In
The victim clicks the link, is redirected to the login page, and enters their valid credentials. The server validates the credentials but does not regenerate the session ID. The session abc123def456... is now associated with the victim's authenticated account.
Step 4: Attacker Hijacks the Session
The attacker uses the known session ID to make authenticated requests to the Gogs API or web interface.
# Attacker uses the known session ID to access the victim's account
curl -b "gogs_session_id=abc123def456..." -s http://target-gogs.example.com/api/v1/user
# Response: JSON object containing the victim's user details, proving session hijack3. Post-Exploitation
Once the session is hijacked, the attacker has full access to the victim's account. Depending on the victim's role (e.g., admin, developer), the attacker can:🌍 Real World Impact
🛡️ Remediation & Mitigation
1. Upgrade
2. Workarounds (If Immediate Upgrade is Not Possible)
3. Detection
Example Log Pattern (Apache/Nginx):
192.168.1.100 - - [26/Nov/2026:10:00:00 +0000] "GET /login HTTP/1.1" 200 - "http://target-gogs.example.com/" "Mozilla/5.0"
192.168.1.100 - - [26/Nov/2026:10:00:05 +0000] "POST /login HTTP/1.1" 302 - "http://target-gogs.example.com/login" "Mozilla/5.0"
192.168.1.100 - - [26/Nov/2026:10:00:10 +0000] "GET /api/v1/user HTTP/1.1" 200 - "http://target-gogs.example.com/login" "Mozilla/5.0"
# Note: The session ID in the cookie should change after POST /login. If it remains the same, it's a potential session fixation.ModSecurity Rule (Illustrative):
SecRule REQUEST_COOKIES:gogs_session_id "@rx ^[a-f0-9]{32}$" \
"id:100001,phase:2,log,auditLog,msg:'Potential Session Fixation: Session ID not regenerated after login',severity:2"Note: This rule is illustrative and requires correlation with login events to be effective.
⚠️ Urgency
[🤖 CVE Professor AI Security Engine]
FOFA Query