CVE-2023-46657: Jenkins Gogs Plugin Non-Constant Time Webhook Token Comparison Vulnerability

Summary

25/10/2023
No i
Low
3.7

CVE-2023-46657: Jenkins Gogs Plugin uses non-constant time webhook token comparison. Affects org.jenkins-ci.plugins:gogs-webhook versions < 1.0.15. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The Jenkins Gogs Plugin is a Maven package (org.jenkins-ci.plugins:gogs-webhook) that integrates Jenkins with the Gogs Git service. It allows Jenkins to receive webhook notifications from Gogs repositories, triggering build jobs in response to events such as code pushes. The plugin facilitates seamless integration between Jenkins and Gogs, enhancing the automation and CI/CD capabilities of software development workflows.

Vulnerability Detail

The Jenkins Gogs Plugin versions 1.0.15 and earlier suffer from a non-constant time webhook token comparison vulnerability. The plugin uses a comparison function that does not take a constant amount of time when checking if the provided and expected webhook tokens are equal. This can potentially enable attackers to employ statistical methods to obtain a valid webhook token. By exploiting this vulnerability, an attacker could gain unauthorized access to the Jenkins instance or manipulate the build process, leading to various security risks and potential compromise of the CI/CD pipeline.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, users can manually modify the affected plugin's source code to implement a constant time comparison function for webhook token validation. Below is an example of the modified code:

// Original code
if (providedToken.equals(expectedToken)) {
    // Token is valid
}

// Modified code
boolean tokensMatch = true;
byte[] providedBytes = providedToken.getBytes();
byte[] expectedBytes = expectedToken.getBytes();
if (providedBytes.length != expectedBytes.length) {
    tokensMatch = false;
}
for (int i = 0; i < providedBytes.length; i++) {
    if (providedBytes[i] != expectedBytes[i]) {
        tokensMatch = false;
    }
}
if (tokensMatch) {
    // Token is valid
}

Please note that applying manual code modifications is not recommended as it can introduce additional risks and complications. It is strongly advised to update to a fixed version of the plugin instead.

Conclusion

The Jenkins Gogs Plugin versions 1.0.15 and earlier are vulnerable to a non-constant time webhook token comparison issue. This vulnerability can potentially enable attackers to obtain a valid webhook token, compromising the security and integrity of the Jenkins instance and the CI/CD pipeline. It is crucial to update the plugin to a fixed version beyond 1.0.15 or apply the provided workaround until the update can be performed. For further assistance and support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for org.jenkins-ci.plugins:gogs-webhook →

Share this vulnerability

FAQ

This vulnerability can potentially allow attackers to obtain a valid webhook token, which may lead to unauthorized access to the Jenkins instance or manipulation of the build process. It poses a risk to the security and integrity of the CI/CD pipeline.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your Jenkins instance is affected by this vulnerability. Simply provide the pom.xml file of your Jenkins project, and Vulert will analyze it in real-time to identify any open-source vulnerabilities, including this specific issue.

At the time of this advisory, there are no known public exploits specifically targeting this vulnerability. However, it is crucial to promptly address and fix the vulnerability to prevent potential exploitation.

Yes, a patch for this vulnerability is available. Users should update the Jenkins Gogs Plugin to a version beyond 1.0.15, which includes the fix for the non-constant time webhook token comparison issue.

As a temporary workaround, you can manually modify the affected plugin's source code to implement a constant time comparison function for webhook token validation. However, it is strongly recommended to update to a fixed version of the plugin as soon as possible to ensure comprehensive security.

Related vulnerabilities

Recent vulnerabilities recorded for org.jenkins-ci.plugins:gogs-webhook.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback