A critical vulnerability has been discovered in GitLab Community Edition (CE) and Enterprise Edition (EE), affecting all versions from 11.10 up to 14.1.6, 14.2 to 15.2.4, and 15.3 to 15.3.2. This vulnerability, assigned the CVE identifier CVE-2022-2992, allows an authenticated user to achieve remote code execution (RCE) through the "Import from GitHub" API endpoint.

In this post, we will provide an in-depth analysis of the vulnerability, code snippets illustrating the exploit, and links to original references for further reading. We will also explain how to mitigate this vulnerability and secure your GitLab infrastructure.

Vulnerability Overview

The vulnerability exists in the way GitLab handles importing repositories from GitHub. By manipulating the GitHub repository URL when importing, an attacker can run arbitrary code on the targeted GitLab instance with the permissions of the GitLab application user.

Exploit Details

To exploit this vulnerability, an attacker first needs to authenticate in GitLab CE/EE. They can then access the "Import from GitHub" functionality and provide a specially crafted URL during the import process.

Here's an example of an exploit code snippet that will execute a simple shell command

curl -XPOST -H "Authorization: Bearer <Your_Access_Token>" https://gitlab.example.com/api/v4/projects?import_url=git://github.com/user/repo\$(echo%20Y29tbWFuZA%3D%3D|base64%20--decode).git&name=exploit_demo

In this example, the attacker has discovered the target's GitLab server, obtained an access token, and crafted a repository URL with an embedded command.

When replacing <Your_Access_Token> with your token, the exploit runs the echo Y29tbWFuZA== | base64 --decode command to decode and execute the base64 encoded "command."


More information about this vulnerability, including updates and further technical details, can be found in the original advisories and posts as follows:
- CVE-2022-2992 MITRE CVE Entry
- GitLab Security Release: 14.1.6, 14.2.4, and 14.3.2
- GitLab Patch for CVE-2022-2992

Mitigation and Prevention

To secure your GitLab infrastructure from this vulnerability, it is essential to update your GitLab installations immediately. GitLab has released patches and new secured versions that address this issue. Please refer to the GitLab Security Release for more details on the fixed versions and their installation process.

Additionally, to minimize the risk of remote code execution vulnerabilities, consider implementing security best practices, such as:


CVE-2022-2992 is a critical vulnerability with the potential for remote code execution on GitLab CE/EE servers. By understanding the issue and implementing appropriate mitigation strategies, you can maintain the overall security and integrity of your GitLab infrastructure.


Published on: 10/17/2022 16:15:00 UTC
Last modified on: 10/28/2022 20:09:00 UTC