CVE-2023-5512: CWE-94: Improper Control of Generation of Code ('Code Injection') in GitLab GitLab
An issue has been discovered in GitLab CE/EE affecting all versions from 16.3 before 16.4.4, all versions starting from 16.5 before 16.5.4, all versions starting from 16.6 before 16.6.2. File integrity may be compromised when specific HTML encoding is used for file names leading for incorrect representation in the UI.
AI Analysis
Technical Summary
CVE-2023-5512 is a medium-severity vulnerability affecting GitLab Community Edition (CE) and Enterprise Edition (EE) versions 16.3 before 16.4.4, 16.5 before 16.5.4, and 16.6 before 16.6.2. The vulnerability is categorized under CWE-94, which relates to improper control of code generation, commonly known as code injection. Specifically, the issue arises from improper handling of file names containing specific HTML encoding sequences. This improper encoding leads to incorrect representation of file names in the GitLab user interface (UI), which can compromise file integrity. Although the vulnerability does not directly impact confidentiality or availability, it allows an attacker with low privileges and requiring user interaction to inject code that affects the integrity of files displayed or managed within GitLab. The CVSS 3.1 base score is 4.8 (medium), with attack vector being network-based (AV:N), requiring high attack complexity (AC:H), low privileges (PR:L), and user interaction (UI:R). The scope remains unchanged (S:U), and the impact is limited to integrity (I:H) without affecting confidentiality or availability. No known exploits are currently reported in the wild, and no official patches are linked in the provided data, though GitLab typically releases fixes promptly. The vulnerability could be exploited by an attacker who can submit or manipulate file names with crafted HTML encoding sequences, potentially leading to code injection in the UI context, which might mislead users or corrupt file representations.
Potential Impact
For European organizations using GitLab CE or EE in the affected versions, this vulnerability poses a risk primarily to the integrity of files managed within their Git repositories. An attacker exploiting this flaw could manipulate file names to inject code that alters how files are displayed or handled in the GitLab UI, potentially leading to confusion, misrepresentation of critical code or documentation, or indirect compromise of development workflows. While confidentiality and availability are not directly impacted, the integrity breach could undermine trust in the software development lifecycle, especially in regulated industries such as finance, healthcare, and critical infrastructure prevalent in Europe. Additionally, since GitLab is widely used for DevOps and CI/CD pipelines, any integrity compromise could cascade into faulty builds or deployments if malicious code is injected or misrepresented. The requirement for user interaction and low privileges reduces the likelihood of widespread exploitation but does not eliminate risk in environments with many users or public-facing GitLab instances. European organizations with strict compliance requirements (e.g., GDPR, NIS Directive) must consider the implications of integrity violations in their software supply chain.
Mitigation Recommendations
1. Immediate upgrade to the latest patched GitLab versions beyond 16.4.4, 16.5.4, or 16.6.2 as applicable. 2. Implement strict input validation and sanitization for file names and metadata within GitLab repositories, ensuring that HTML encoding sequences are properly handled and escaped before rendering in the UI. 3. Restrict permissions to limit who can upload or rename files, especially in public or shared projects, to reduce the attack surface. 4. Monitor GitLab logs and UI behavior for anomalies related to file name rendering or unexpected code execution in the UI context. 5. Educate users about the risk of interacting with suspicious file names or repository content that could trigger code injection. 6. Employ web application firewalls (WAFs) or security proxies that can detect and block malicious payloads targeting UI rendering vulnerabilities. 7. Regularly audit and review repository contents and GitLab configurations to detect and remediate any suspicious artifacts. 8. Coordinate with GitLab support or security advisories for updates and patches, as well as guidance on secure configuration.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Italy, Spain, Poland, Belgium, Finland
CVE-2023-5512: CWE-94: Improper Control of Generation of Code ('Code Injection') in GitLab GitLab
Description
An issue has been discovered in GitLab CE/EE affecting all versions from 16.3 before 16.4.4, all versions starting from 16.5 before 16.5.4, all versions starting from 16.6 before 16.6.2. File integrity may be compromised when specific HTML encoding is used for file names leading for incorrect representation in the UI.
AI-Powered Analysis
Technical Analysis
CVE-2023-5512 is a medium-severity vulnerability affecting GitLab Community Edition (CE) and Enterprise Edition (EE) versions 16.3 before 16.4.4, 16.5 before 16.5.4, and 16.6 before 16.6.2. The vulnerability is categorized under CWE-94, which relates to improper control of code generation, commonly known as code injection. Specifically, the issue arises from improper handling of file names containing specific HTML encoding sequences. This improper encoding leads to incorrect representation of file names in the GitLab user interface (UI), which can compromise file integrity. Although the vulnerability does not directly impact confidentiality or availability, it allows an attacker with low privileges and requiring user interaction to inject code that affects the integrity of files displayed or managed within GitLab. The CVSS 3.1 base score is 4.8 (medium), with attack vector being network-based (AV:N), requiring high attack complexity (AC:H), low privileges (PR:L), and user interaction (UI:R). The scope remains unchanged (S:U), and the impact is limited to integrity (I:H) without affecting confidentiality or availability. No known exploits are currently reported in the wild, and no official patches are linked in the provided data, though GitLab typically releases fixes promptly. The vulnerability could be exploited by an attacker who can submit or manipulate file names with crafted HTML encoding sequences, potentially leading to code injection in the UI context, which might mislead users or corrupt file representations.
Potential Impact
For European organizations using GitLab CE or EE in the affected versions, this vulnerability poses a risk primarily to the integrity of files managed within their Git repositories. An attacker exploiting this flaw could manipulate file names to inject code that alters how files are displayed or handled in the GitLab UI, potentially leading to confusion, misrepresentation of critical code or documentation, or indirect compromise of development workflows. While confidentiality and availability are not directly impacted, the integrity breach could undermine trust in the software development lifecycle, especially in regulated industries such as finance, healthcare, and critical infrastructure prevalent in Europe. Additionally, since GitLab is widely used for DevOps and CI/CD pipelines, any integrity compromise could cascade into faulty builds or deployments if malicious code is injected or misrepresented. The requirement for user interaction and low privileges reduces the likelihood of widespread exploitation but does not eliminate risk in environments with many users or public-facing GitLab instances. European organizations with strict compliance requirements (e.g., GDPR, NIS Directive) must consider the implications of integrity violations in their software supply chain.
Mitigation Recommendations
1. Immediate upgrade to the latest patched GitLab versions beyond 16.4.4, 16.5.4, or 16.6.2 as applicable. 2. Implement strict input validation and sanitization for file names and metadata within GitLab repositories, ensuring that HTML encoding sequences are properly handled and escaped before rendering in the UI. 3. Restrict permissions to limit who can upload or rename files, especially in public or shared projects, to reduce the attack surface. 4. Monitor GitLab logs and UI behavior for anomalies related to file name rendering or unexpected code execution in the UI context. 5. Educate users about the risk of interacting with suspicious file names or repository content that could trigger code injection. 6. Employ web application firewalls (WAFs) or security proxies that can detect and block malicious payloads targeting UI rendering vulnerabilities. 7. Regularly audit and review repository contents and GitLab configurations to detect and remediate any suspicious artifacts. 8. Coordinate with GitLab support or security advisories for updates and patches, as well as guidance on secure configuration.
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitLab
- Date Reserved
- 2023-10-11T00:30:29.337Z
- Cisa Enriched
- false
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 682ea68a0acd01a249253fb0
Added to database: 5/22/2025, 4:22:34 AM
Last enriched: 7/7/2025, 11:56:45 AM
Last updated: 8/7/2025, 7:01:23 AM
Views: 12
Related Threats
CVE-2025-7679: CWE-306 Missing Authentication for Critical Function in ABB Aspect
HighCVE-2025-7677: CWE-306 Missing Authentication for Critical Function in ABB Aspect
MediumCVE-2025-53191: CWE-306 Missing Authentication for Critical Function in ABB Aspect
HighCVE-2025-53190: CWE-286 in ABB Aspect
HighCVE-2025-53189: CWE-639 Authorization Bypass Through User-Controlled Key in ABB Aspect
HighActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.