Skip to main content

CVE-2022-39205: CWE-287: Improper Authentication in theonedev onedev

Medium
Published: Tue Sep 13 2022 (09/13/2022, 18:30:13 UTC)
Source: CVE
Vendor/Project: theonedev
Product: onedev

Description

Onedev is an open source, self-hosted Git Server with CI/CD and Kanban. In versions of Onedev prior to 7.3.0 unauthenticated users can take over a OneDev instance if there is no properly configured reverse proxy. The /git-prereceive-callback endpoint is used by the pre-receive git hook on the server to check for branch protections during a push event. It is only intended to be accessed from localhost, but the check relies on the X-Forwarded-For header. Invoking this endpoint leads to the execution of one of various git commands. The environment variables of this command execution can be controlled via query parameters. This allows attackers to write to arbitrary files, which can in turn lead to the execution of arbitrary code. Such an attack would be very hard to detect, which increases the potential impact even more. Users are advised to upgrade. There are no known workarounds for this issue.

AI-Powered Analysis

AILast updated: 06/21/2025, 23:35:17 UTC

Technical Analysis

CVE-2022-39205 is a vulnerability classified under CWE-287 (Improper Authentication) affecting Onedev, an open-source, self-hosted Git server with integrated CI/CD and Kanban features. The vulnerability exists in Onedev versions prior to 7.3.0 and revolves around the /git-prereceive-callback endpoint, which is intended to be accessed only from localhost. This endpoint is used by the pre-receive Git hook to enforce branch protection policies during push events. However, the authentication mechanism improperly relies on the X-Forwarded-For HTTP header to determine the origin of the request. This header can be spoofed by unauthenticated remote attackers if the reverse proxy is not correctly configured, allowing them to bypass the intended localhost restriction. Once accessed, the endpoint executes various Git commands, and critically, the environment variables for these commands can be manipulated via query parameters. This manipulation enables attackers to write arbitrary files on the server, which can lead to arbitrary code execution. The attack vector is particularly dangerous because it does not require authentication and can be performed remotely if the reverse proxy is misconfigured or absent. Additionally, the attack is stealthy and difficult to detect, increasing its potential impact. There are no known workarounds, and the only effective remediation is upgrading Onedev to version 7.3.0 or later, where this issue has been addressed.

Potential Impact

For European organizations using Onedev versions prior to 7.3.0, this vulnerability poses a significant risk. Successful exploitation can lead to complete compromise of the Onedev server, including unauthorized code execution and potential lateral movement within the network. Given Onedev's role in managing source code repositories and CI/CD pipelines, attackers could inject malicious code into software builds, disrupt development workflows, or exfiltrate sensitive intellectual property. The stealthy nature of the attack increases the risk of prolonged undetected compromise, which can exacerbate damage and complicate incident response. Organizations relying on Onedev for critical software development, especially those in regulated industries such as finance, healthcare, or critical infrastructure, may face compliance violations and operational disruptions. Moreover, the lack of authentication and the ability to exploit the vulnerability remotely make it accessible to a wide range of threat actors, increasing the likelihood of exploitation if the environment is not properly secured.

Mitigation Recommendations

1. Immediate upgrade of Onedev instances to version 7.3.0 or later is the primary and only reliable mitigation. 2. Until upgrade is possible, ensure that the Onedev server is protected behind a properly configured reverse proxy that strictly restricts access to the /git-prereceive-callback endpoint to localhost or trusted internal IP addresses. This includes validating and sanitizing the X-Forwarded-For header to prevent spoofing. 3. Implement network-level access controls such as firewall rules or VPNs to limit external access to the Onedev server. 4. Monitor server logs for unusual access patterns to the /git-prereceive-callback endpoint, especially requests originating from non-localhost IPs or with suspicious query parameters. 5. Conduct regular integrity checks on critical files and repositories hosted on Onedev to detect unauthorized modifications. 6. Employ runtime application self-protection (RASP) or endpoint detection and response (EDR) solutions to detect anomalous process executions indicative of exploitation attempts. 7. Educate DevOps and security teams about this vulnerability to ensure timely patching and secure configuration of reverse proxies.

Need more detailed analysis?Get Pro

Technical Details

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

Threat ID: 682d9849c4522896dcbf6953

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

Last enriched: 6/21/2025, 11:35:17 PM

Last updated: 8/11/2025, 8:30:44 PM

Views: 12

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