Skip to main content

CVE-2022-31038: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in gogs gogs

Medium
Published: Wed Jun 08 2022 (06/08/2022, 17:40:11 UTC)
Source: CVE
Vendor/Project: gogs
Product: gogs

Description

Gogs is an open source self-hosted Git service. In versions of gogs prior to 0.12.9 `DisplayName` does not filter characters input from users, which leads to an XSS vulnerability when directly displayed in the issue list. This issue has been resolved in commit 155cae1d which sanitizes `DisplayName` prior to display to the user. All users of gogs are advised to upgrade. Users unable to upgrade should check their users' display names for malicious characters.

AI-Powered Analysis

AILast updated: 06/23/2025, 05:21:18 UTC

Technical Analysis

CVE-2022-31038 is a Cross-Site Scripting (XSS) vulnerability identified in the open-source, self-hosted Git service called Gogs. Specifically, versions of Gogs prior to 0.12.9 do not properly sanitize the 'DisplayName' field input by users. This improper neutralization of input (classified under CWE-79) allows malicious actors to inject arbitrary scripts that are executed when the DisplayName is rendered in the issue list interface. The vulnerability arises because user-supplied characters in DisplayName are directly embedded into web pages without adequate filtering or encoding, enabling the execution of malicious JavaScript code in the context of other users viewing the issue list. This can lead to session hijacking, credential theft, or unauthorized actions performed on behalf of the victim user. The issue was resolved in version 0.12.9 by sanitizing the DisplayName prior to display, effectively neutralizing potentially harmful input. While no known exploits have been reported in the wild, the vulnerability poses a risk to any Gogs instance running an affected version, especially those publicly accessible or used by multiple users. Users unable to upgrade are advised to audit and sanitize existing DisplayName values to prevent exploitation.

Potential Impact

For European organizations using Gogs versions prior to 0.12.9, this vulnerability could lead to unauthorized script execution within the context of authenticated users. This compromises confidentiality by potentially exposing session tokens or sensitive data, integrity by enabling unauthorized actions such as issue manipulation or code repository interference, and availability if malicious scripts disrupt normal operations. Organizations relying on Gogs for internal or external code management may face risks of lateral movement or privilege escalation if attackers leverage XSS to implant further payloads. The impact is heightened for organizations with public-facing Gogs instances or those with large user bases, increasing the attack surface. Additionally, compliance with European data protection regulations (e.g., GDPR) could be jeopardized if personal data is exposed or manipulated via this vulnerability. Although no active exploitation is reported, the ease of injection and the common use of Gogs in development environments make this a credible threat vector.

Mitigation Recommendations

The primary mitigation is to upgrade all Gogs installations to version 0.12.9 or later, where the vulnerability is patched. For organizations unable to upgrade immediately, it is critical to audit all user DisplayName fields for malicious or suspicious characters and sanitize or restrict input to safe character sets. Implementing Web Application Firewalls (WAFs) with rules to detect and block XSS payloads targeting the DisplayName field can provide an additional layer of defense. Restricting access to the Gogs instance to trusted networks or VPNs reduces exposure. Enforcing Content Security Policy (CSP) headers can mitigate the impact of injected scripts by restricting script execution sources. Regularly monitoring logs for unusual activity related to issue list views or user profile changes can help detect exploitation attempts. Finally, educating users about the risks of XSS and encouraging cautious behavior when interacting with user-generated content will reduce the likelihood of successful attacks.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2022-05-18T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9844c4522896dcbf3401

Added to database: 5/21/2025, 9:09:24 AM

Last enriched: 6/23/2025, 5:21:18 AM

Last updated: 8/14/2025, 6:17:18 PM

Views: 13

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats