CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-22865

CVE-2026-22865: Dependency Resolution Fallback to Untrusted Repositories in Gradle

Alon Barad
Alon Barad
Software Engineer

Nov 23, 2026·10 min read·0 visits

Executive Summary (TL;DR)

An incomplete exception classification in Gradle's ResolveExceptionAnalyzer allows network disruptions on primary artifact repositories to trigger a fallback to secondary repositories. This enables dependency confusion and supply chain injection attacks against builds with multiple configured repositories.

Gradle versions prior to 8.14.4 and 9.3.0 fail to classify certain fatal network transport exceptions, such as UnknownHostException and NoHttpResponseException, as critical failures during dependency resolution. When these exceptions occur and retry thresholds are exhausted, Gradle fails to disable the unreachable primary repository and instead falls through to subsequent repositories configured in the build script. An attacker capable of disrupting connectivity to an upstream repository can force the build tool to fetch malicious artifacts with matching coordinates from a downstream, untrusted repository.

Vulnerability Overview

Gradle is an open-source build automation system widely used across Java, Kotlin, and Android ecosystems. A core responsibility of org.gradle:gradle-core is resolving external project dependencies from configured remote repositories such as Maven Central, Google Maven, or private enterprise artifact managers (e.g., JFrog Artifactory, Sonatype Nexus). Build scripts define these repositories in a sequential block, and Gradle evaluates them strictly in their order of declaration.

To protect builds against supply chain substitution and dependency confusion, Gradle implements a fail-fast repository disabling mechanism. Under standard operating rules, if a repository returns an HTTP 404 (Not Found) status, Gradle proceeds to query the next repository in the list. However, if a repository experiences an unrecoverable connection error or fatal server failure, Gradle is designed to mark that repository as disabled for the remainder of the build and abort dependency resolution for any artifact that attempts to query it.

In Gradle versions prior to 8.14.4 and 9.3.0, this fail-fast mechanism contained an exception handling flaw tracked as CVE-2026-22865 (GHSA-mqwm-5m85-gmcv). The vulnerability is classified under CWE-829 (Inclusion of Functionality from Untrusted Control Sphere) and CWE-494 (Download of Code Without Integrity Check). Specifically, the dependency resolution engine failed to recognize certain network-layer and transport-layer exceptions—most notably java.net.UnknownHostException and Apache HttpClient's org.apache.http.NoHttpResponseException—as fatal repository errors.

Because these exceptions were not flagged as critical failures, Gradle did not disable the affected repository after exhausting its configured retry attempts. Instead, the resolution engine treated the failure as a non-fatal miss and fell through to subsequent repositories in the configuration chain. If an organization configured a private internal repository ahead of a public repository without strict content filtering or checksum verification, an attacker capable of disrupting access to the private server could force Gradle to download and execute malicious packages with identical coordinates from the public repository.

Root Cause Analysis

The root cause of CVE-2026-22865 resides in how Gradle's dependency management subsystem categorizes network exceptions during external resource resolution. When Gradle queries an HTTP/HTTPS repository, network operations are wrapped by retry handlers and evaluated by org.gradle.internal.resolve.ResolveExceptionAnalyzer. This analyzer determines whether a thrown exception represents a critical infrastructure failure that mandates disabling the repository via the internal RepositoryDisabler mechanism.

Prior to the patch, ResolveExceptionAnalyzer.isCriticalFailure(Throwable) inspected the root cause of resolution exceptions using two predicate checks: isTimeoutException(rootCause) and isUnrecoverable5xxStatusCode(rootCause). The isTimeoutException check verified whether the root cause was an instance of java.io.InterruptedIOException (such as SocketTimeoutException), while isUnrecoverable5xxStatusCode checked for fatal server-side HTTP status codes encapsulated in HttpErrorStatusCodeException.

This narrow check omitted other common fatal transport exceptions. First, if DNS resolution failed due to a DNS outage, spoofing, or sinkholing, the Java networking stack threw java.net.UnknownHostException (a subclass of java.io.IOException, not InterruptedIOException). Second, if a remote server or an inline network device abruptly dropped the TCP connection or failed to send an HTTP status line, the underlying Apache HttpClient threw NoHttpResponseException (also a direct subclass of java.io.IOException).

When either of these exceptions occurred, Gradle's transport layer attempted to retry the request up to the configured threshold. Once all retries failed, the exception was passed up to the repository resolution coordinator. Because ResolveExceptionAnalyzer.isCriticalFailure() evaluated to false for both UnknownHostException and NoHttpResponseException, the repository remained enabled. The resolution loop caught the failure, logged it at a lower severity, and advanced the iterator to the next declared repository.

Code Analysis

The vulnerability was addressed across multiple commits, including d38bfc0f1d4dabd38b305a67489bb8a6645138a1 and fa96c8bc7f7741e5dfa1da002c559afca3fa1fc1, authored by Louis Jacomet. The primary logic modification took place in platforms/software/dependency-management/src/main/java/org/gradle/internal/resolve/ResolveExceptionAnalyzer.java.

In the unpatched version of ResolveExceptionAnalyzer.java, the critical failure check was implemented as follows:

package org.gradle.internal.resolve;
 
import com.google.common.base.Throwables;
import org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException;
 
import java.io.InterruptedIOException;
import java.util.Collection;
 
public class ResolveExceptionAnalyzer {
    // ... [omitted helper methods] ...
 
    public static boolean isCriticalFailure(Throwable throwable) {
        Throwable rootCause = Throwables.getRootCause(throwable);
        // VULNERABLE: Only InterruptedIOException (timeouts) and unrecoverable 5xx codes
        // are treated as critical failures that disable the repository.
        return isTimeoutException(rootCause) || isUnrecoverable5xxStatusCode(rootCause);
    }
}

Commit d38bfc0f1d4dabd38b305a67489bb8a6645138a1 updated ResolveExceptionAnalyzer to explicitly import java.net.UnknownHostException and verify whether the root cause of a failure is an instance of it:

@@ -19,6 +19,7 @@
 import org.gradle.internal.resource.transport.http.HttpErrorStatusCodeException;
 
 import java.io.InterruptedIOException;
+import java.net.UnknownHostException;
 import java.util.Collection;
 
 public class ResolveExceptionAnalyzer {
@@ -34,7 +35,11 @@ public static boolean hasCriticalFailure(Collection<? extends Throwable> failure
 
     public static boolean isCriticalFailure(Throwable throwable) {
         Throwable rootCause = Throwables.getRootCause(throwable);
-        return isTimeoutException(rootCause) || isUnrecoverable5xxStatusCode(rootCause);
+        // PATCHED: UnknownHostException is now classified as a critical failure
+        return isTimeoutException(rootCause) || isUnrecoverable5xxStatusCode(rootCause) || isUnknownHostException(rootCause);
+    }
+
+    private static boolean isUnknownHostException(Throwable rootCause) {
+        return rootCause instanceof UnknownHostException;
     }

In addition to the UnknownHostException check in ResolveExceptionAnalyzer, the patch series updated Gradle's HTTP transport and retry handling logic so that exhausted retries on transient transport errors (specifically NoHttpResponseException) are escalated as critical failures. By ensuring these exceptions trigger the repository disabler, Gradle halts resolution for the affected repository and prevents the dependency resolver from falling through to downstream repositories.

> [!NOTE] > Assessing fix completeness: While explicitly adding UnknownHostException and handling exhausted NoHttpResponseException retries closes the primary avenues for silent network fallback, the design of ResolveExceptionAnalyzer relies on an allowlist of fatal exception types (InterruptedIOException, UnknownHostException, and specific HttpErrorStatusCodeException statuses). If other IOException subclasses—such as java.net.ConnectException (e.g., Connection Refused via TCP RST) or javax.net.ssl.SSLException—are not caught by upstream transport wrappers or converted into critical exceptions upon retry exhaustion, similar fallback behavior must be guarded against by the transport layer.

Exploitation Methodology

Exploiting CVE-2026-22865 requires a specific build configuration and a network or infrastructure position that allows the attacker to disrupt connectivity to a primary repository. There are no known public proof-of-concept exploits or active exploitation campaigns in the wild, and the vulnerability has a low EPSS score of 0.00158 (4.89th percentile). However, the attack mechanics are straightforward in enterprise environments that mix internal and public repositories.

First, the target project must declare multiple repositories in its build.gradle, build.gradle.kts, or settings.gradle file without repository content filtering or cryptographic dependency verification. A standard vulnerable configuration places an internal corporate repository before a public repository:

repositories {
    maven {
        url "https://artifacts.internal.corp.example.com/maven2"
    }
    mavenCentral()
}
 
dependencies {
    implementation "com.example.corp:auth-service-client:1.4.2"
}

Second, the attacker must publish a trojanized artifact matching the target internal coordinates (com.example.corp:auth-service-client:1.4.2) to the downstream repository (or control a secondary custom repository listed in the build script). While Maven Central enforces domain ownership validation for group IDs, many organizations use legacy group IDs, unregistered internal domains, or secondary community repositories (such as JitPack or third-party vendor repositories) where namespace registration is less restrictive.

Third, when a developer or a CI/CD build agent runs ./gradlew build, the attacker must induce either an UnknownHostException or a NoHttpResponseException against artifacts.internal.corp.example.com. An attacker on the local network segment or ISP path can achieve this by dropping DNS responses to trigger UnknownHostException, or by injecting TCP FIN/RST packets immediately after the TLS handshake completes to cause Apache HttpClient to throw NoHttpResponseException. Alternatively, an unauthenticated remote attacker could launch a denial-of-service attack against the primary artifact server or wait for a scheduled maintenance window where the server drops incoming HTTP requests.

Once Gradle exhausts its HTTP retry attempts against the primary repository, the vulnerable exception analyzer fails to disable the internal repository. Gradle silently falls back to the secondary repository, downloads the attacker's com.example.corp:auth-service-client:1.4.2 JAR file, and links it into the build. Any static initializers, annotation processors, unit tests, or build tasks that invoke code from the dependency will execute the attacker's payload within the context of the developer workstation or CI/CD runner.

Impact Assessment

Successful exploitation of CVE-2026-22865 results in arbitrary code execution within the build environment and potential downstream software supply chain compromise. When a malicious artifact is ingested during a Gradle build, its code can execute immediately during compilation (via Java annotation processors), during the test task execution, or when the packaged application is deployed to production environments.

In a CI/CD environment, code execution within the build runner provides the attacker with access to sensitive environment variables, cloud provider IAM roles, signing keys, and deployment tokens. Furthermore, because the malicious dependency is compiled directly into the resulting application binary or container image, the integrity of the downstream software artifact is compromised without generating build errors.

The severity of this vulnerability is assessed under both CVSS v3.1 and CVSS v4.0 standards:

  • CVSS v3.1 (NVD): Scored at 7.4 (HIGH) with vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N. The Attack Complexity is rated High (AC:H) because the attacker cannot trigger the flaw at will without both a multi-repository target configuration and the ability to cause specific network failures on the upstream repository. Confidentiality and Integrity impacts are both High (C:H/I:H) due to arbitrary code inclusion, while Availability is None (A:N).
  • CVSS v4.0 (GitHub CNA): Scored at 8.6 (HIGH) with vector CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:N/SC:N/SI:H/SA:N. The v4.0 vector explicitly captures the Attack Requirements (AT:P) regarding network failure conditions and notes the High Integrity impact on Subsequent Systems (SI:H), reflecting the supply chain risk to consumers of the built software.

Remediation and Mitigation

The definitive remediation for CVE-2026-22865 is to upgrade Gradle to a patched release. The Gradle team resolved this issue in Gradle 8.14.4 (for the 8.x release line) and Gradle 9.3.0 (for the 9.x release line). All projects using the Gradle Wrapper should update their gradle/wrapper/gradle-wrapper.properties file to reference a fixed distribution:

# For Gradle 9.x projects:
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
 
# For Gradle 8.x projects:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip

Developers can also apply this update via the command line by running ./gradlew wrapper --gradle-version=9.3.0 or ./gradlew wrapper --gradle-version=8.14.4 and committing the updated wrapper files to version control.

For environments where upgrading the Gradle version is not immediately possible, two architectural mitigations completely neutralize this attack vector and represent defense-in-depth best practices against dependency confusion:

  1. Repository Content Filtering: Configure strict content blocks on repository declarations in build.gradle or settings.gradle. By binding internal group namespaces exclusively to the internal repository and excluding them from public repositories, Gradle will never query public servers for internal artifacts regardless of network state:
repositories {
    maven {
        url "https://artifacts.internal.corp.example.com/maven2"
        content {
            includeGroupByRegex "com\\.example\\.corp.*"
        }
    }
    mavenCentral {
        content {
            excludeGroupByRegex "com\\.example\\.corp.*"
        }
    }
}
  1. Gradle Dependency Verification: Enable cryptographic checksum and PGP signature verification by generating a gradle/verification-metadata.xml file using ./gradlew --write-verification-metadata sha256. When dependency verification is active, Gradle compares the SHA-256 hash of every downloaded artifact against the committed metadata file and aborts the build if a substitute binary is received from a fallback repository.

Official Patches

GradleOfficial GitHub Security Advisory for CVE-2026-22865
GradleGradle 8.14.4 Release Notes
GradleGradle 9.3.0 Release Notes

Fix Analysis (2)

Technical Appendix

CVSS Score
7.4/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N
EPSS Probability
0.16%
Top 95% most exploited

Affected Systems

Gradle Build Tool (org.gradle:gradle-core) < 8.14.4Gradle Build Tool (org.gradle:gradle-core) >= 9.0.0, < 9.3.0

Affected Versions Detail

Product
Affected Versions
Fixed Version
Gradle
Gradle
< 8.14.48.14.4
Gradle
Gradle
>= 9.0.0, < 9.3.09.3.0
AttributeDetail
Vulnerability IDCVE-2026-22865 / GHSA-mqwm-5m85-gmcv
Weakness ClassCWE-829 (Untrusted Control Sphere) / CWE-494
CVSS v3.1 / v4.07.4 HIGH (v3.1) / 8.6 HIGH (v4.0)
Attack VectorNetwork (AV:N) with High Complexity (AC:H)
EPSS Score0.16% (4.89th Percentile)
Affected Componentorg.gradle.internal.resolve.ResolveExceptionAnalyzer
Patched VersionsGradle 8.14.4 and Gradle 9.3.0
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1195.001Supply Chain Compromise: Compromise Software Dependencies and Development Tools
Initial Access
T1565.002Data Manipulation: Transmitted Data Manipulation
Impact
T1071Application Layer Protocol
Command and Control
CWE-829
Inclusion of Functionality from Untrusted Control Sphere

The software imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.

Vulnerability Timeline

Fix commit d38bfc0f1d4dabd38b305a67489bb8a6645138a1 authored in Gradle repository
2025-12-12
CVE-2026-22865 reserved by GitHub CNA
2026-01-12
Security advisory GHSA-mqwm-5m85-gmcv and CVE-2026-22865 officially published; Gradle 8.14.4 and 9.3.0 released
2026-01-16
NVD CVE record last modified and enriched
2026-06-17

References & Sources

  • [1]GitHub Security Advisory GHSA-mqwm-5m85-gmcv
  • [2]NIST National Vulnerability Database (NVD) - CVE-2026-22865
  • [3]Official CVE Record - CVE-2026-22865
  • [4]Gradle Fix Commit d38bfc0f1d4dabd38b305a67489bb8a6645138a1
  • [5]Gradle Fix Commit fa96c8bc7f7741e5dfa1da002c559afca3fa1fc1
  • [6]Gradle Issue Discussion #35927
  • [7]Gradle 8.14.4 Release Notes
  • [8]Gradle 9.3.0 Release Notes
  • [9]Gradle User Guide: Dependency Verification
  • [10]Gradle User Guide: Filtering Repository Content

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 days ago•CVE-2026-58254
6.5

CVE-2026-58254: Authorization Bypass in NATS Server Message Tracing for Leaf Node Connections

NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.

Alon Barad
Alon Barad
11 views•10 min read
•2 days ago•CVE-2026-63341
7.5

CVE-2026-63341: Unauthenticated Denial of Service via Unbounded Topic Depth in Aedes MQTT Broker

CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.

Alon Barad
Alon Barad
16 views•12 min read
•2 days ago•CVE-2026-61725
6.1

CVE-2026-61725: Path Traversal and Arbitrary File Overwrite in sevenz-rust2

CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.

Alon Barad
Alon Barad
6 views•12 min read
•2 days ago•CVE-2026-77309
8.8

CVE-2026-77309: Unauthenticated Remote Code Execution in NASA-AMMOS AIT-GUI via Incomplete File Cleanup and Path Traversal

CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.

Amit Schendel
Amit Schendel
16 views•10 min read
•2 days ago•CVE-2026-77332
2.3

CVE-2026-77332: Surfaced-Memory Envelope Injection and Stored Prompt Injection in memtomem-stm

A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.

Alon Barad
Alon Barad
19 views•10 min read
•2 days ago•CVE-2026-77331
2.0

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.

Amit Schendel
Amit Schendel
8 views•9 min read