Nov 23, 2026·11 min read·3 visits
Gradle versions prior to 8.14.4 and 9.0.0 through 9.2.1 fail to disable repositories or halt dependency resolution after exhausting retries on transient network and connection failures. This causes Gradle to silently fall back to secondary or public repositories (such as Maven Central), allowing attackers to execute dependency confusion and supply chain attacks by publishing packages matching internal dependency coordinates.
CVE-2026-22816 (GHSA-w78c-w6vf-rw82) is a high-severity flaw in Gradle's dependency resolution engine affecting versions prior to 8.14.4 and versions 9.0.0 through 9.2.1. Due to improper error handling when transient network errors or connection failures exhaust their retry limits, Gradle fails to mark unreachable repositories as disabled and does not abort the resolution queue. Instead, it silently falls through to subsequent repositories configured in the build script. This behavior enables dependency confusion and supply chain attacks when an internal or primary repository experiences connectivity issues, unresolvable DNS, or domain registration lapses.
Gradle is a build automation system used primarily for JVM ecosystems, Android applications, and multi-project enterprise repositories. A core responsibility of Gradle's dependency management engine is resolving external libraries and plugins from declared remote repositories (such as Maven or Ivy registries) in a deterministic and secure sequence. In enterprise environments, build configurations typically declare private, internal artifact repositories ahead of public registries like Maven Central or the Gradle Plugin Portal.
CVE-2026-22816 (also tracked as GHSA-w78c-w6vf-rw82 and BIT-gradle-2026-22816) is a flaw in Gradle's repository failure handling logic within the dependency-management subsystem. Specifically, the vulnerability resides in how ConnectionFailureRepositoryDisabler, ErrorHandlingModuleComponentRepository, DynamicVersionResolver, and RepositoryChainComponentMetaDataResolver interact when a remote repository encounters network or HTTP errors during artifact resolution. The weakness is classified under CWE-829 (Inclusion of Functionality from Untrusted Control Sphere) and CWE-494 (Download of Code Without Integrity Check).
In a secure resolution workflow, Gradle evaluates repositories sequentially in their declaration order. It should only proceed from a primary repository to a secondary repository if the primary repository responds authoritatively that the requested module does not exist (such as returning an HTTP 404 Not Found status). If a repository experiences a fatal connectivity problem or exhausts its retry budget due to transient network errors, the build tool must mark the repository as disabled and halt resolution to prevent falling back to untrusted downstream sources.
In affected versions of Gradle (all versions prior to 8.14.4, and 9.0.0 through 9.2.1), transient networking errors and specific connection failures that exhausted their retry limit did not trigger repository disablement. Furthermore, the resolution queue was not cleared upon encountering these failures. As a result, Gradle silently skipped the unreachable primary repository and resolved matching dependency coordinates from downstream public repositories, exposing developer workstations and CI/CD pipelines to arbitrary code execution via dependency confusion.
The root cause of CVE-2026-22816 stems from an architectural mismatch between how Gradle categorizes transient versus critical network exceptions during retry loops, and how the repository resolution chain manages its candidate evaluation queue upon encountering those exceptions. When Gradle attempts to resolve module metadata or artifacts via ErrorHandlingModuleComponentRepository, network operations are wrapped inside a retry loop controlled by maxTentativesCount.
During each attempt in tryResolveAndMaybeRetry, if an exception is thrown, Gradle consults NetworkingIssueVerifier to classify the failure. Exceptions are evaluated using isLikelyPermanentNetworkIssue(failure) and isLikelyTransientNetworkingIssue(failure). Transient networking issues include socket timeouts, connection resets, temporary DNS resolution failures, HTTP 408 Request Timeout, and HTTP 429 Too Many Requests. When a transient error occurs, Gradle retries the request until retries == maxTentativesCount is reached.
Once the maximum number of retries is reached, ErrorHandlingModuleComponentRepository invokes repositoryDisabler.tryDisableRepository(repositoryId, failure) and marks the result as failed. However, prior to the patch, ConnectionFailureRepositoryDisabler.tryDisableRepository only added a repository to the disabledRepositories map if ResolveExceptionAnalyzer.isCriticalFailure(reason) returned true. Because transient networking failures were explicitly excluded from isCriticalFailure(reason), exhausting the retry counter on a transient failure never disabled the repository. tryDisableRepository returned false, leaving the repository in an active state despite being unreachable.
This failure to disable the repository directly impacted upstream resolvers, specifically DynamicVersionResolver and RepositoryChainComponentMetaDataResolver. Both classes maintain a List<RepositoryResolveState> queue representing the ordered list of repositories to query. When iterating through this queue in methods such as findLatestModule and findBestMatch, a failed resolution step did not abort the queue traversal if the repository was not marked as disabled. Even when a repository was disabled, the queue processing loop continued to evaluate remaining repositories in the list rather than clearing the queue and registering a fatal build error.
The vulnerability was remediated across commits 4f2e3bbee4d0cee307dd97b684f11cfbe711b6f3 and e5707d0d8fce3d768c9c489004700d78eab1773a. The patch modifies three primary layers of the dependency resolution architecture: the repository disabler interface, the retry loop within the error-handling repository wrapper, and the queue processing logic in the metadata and dynamic version resolvers.
First, the method signature of tryDisableRepository in RepositoryDisabler and its implementation in ConnectionFailureRepositoryDisabler.java were updated to accept a boolean parameter maxRetriesExceeded. When maxRetriesExceeded is true, the repository is unconditionally disabled for the remainder of the build, regardless of whether isCriticalFailure(reason) evaluates to true.
--- a/platforms/software/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/ConnectionFailureRepositoryDisabler.java
+++ b/platforms/software/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/ConnectionFailureRepositoryDisabler.java
@@ -46,14 +46,14 @@ public Optional<Throwable> getDisabledReason(String repositoryId) {
}
@Override
- public boolean tryDisableRepository(String repositoryId, Throwable reason) {
+ public boolean tryDisableRepository(String repositoryId, Throwable reason, boolean maxRetriesExceeded) {
boolean disabled = isDisabled(repositoryId);
if (disabled) {
return true;
}
- if (isCriticalFailure(reason)) {
+ if (isCriticalFailure(reason) || maxRetriesExceeded) {
LOGGER.debug("Repository {} has been disabled for this build due to connectivity issues", repositoryId);
disabledRepositories.put(repositoryId, reason);
return true;Second, ErrorHandlingModuleComponentRepository.java was modified to track whether a failure was classified as a transient networking issue and whether the retry limit (retries == maxTentativesCount) had been reached. When both conditions hold, it passes true for the maxRetriesExceeded argument to tryDisableRepository.
--- a/platforms/software/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/ErrorHandlingModuleComponentRepository.java
+++ b/platforms/software/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/ErrorHandlingModuleComponentRepository.java
@@ -252,10 +259,13 @@ private <E extends Throwable, R extends ErroringResolveResult<E>> void tryResolv
unexpectedFailure = throwable;
failure = onError.transform(throwable);
}
- boolean doNotRetry = NetworkingIssueVerifier.isLikelyPermanentNetworkIssue(failure) || !NetworkingIssueVerifier.isLikelyTransientNetworkingIssue(failure);
+ boolean transientNetworkingIssue = NetworkingIssueVerifier.isLikelyTransientNetworkingIssue(failure);
+ boolean doNotRetry = NetworkingIssueVerifier.isLikelyPermanentNetworkIssue(failure) || !transientNetworkingIssue;
if (doNotRetry || retries == maxTentativesCount) {
if (unexpectedFailure != null) {
- repositoryDisabler.tryDisableRepository(repositoryId, failure);
+ repositoryDisabler.tryDisableRepository(repositoryId, failure, transientNetworkingIssue && retries == maxTentativesCount);
}
result.failed(failure);
break;Third, the resolution queue handlers in DynamicVersionResolver.java and RepositoryChainComponentMetaDataResolver.java were updated to introduce a centralized handleFailure helper method. Previously, when a resolution request returned an error or exception during queue iteration, the failure was added to failures, and execution continued to the next repository in queue. The patched implementation explicitly checks request.isRepositoryDisabled() and !request.isContinueOnConnectionFailure(). If the repository has been disabled and continuation on connection failure is not explicitly permitted, Gradle clears the remaining repository queue (queue.clear()) and invokes failures.markFatalError().
private static void handleFailure(List<RepositoryResolveState> queue, RepositoryResolveState request, RepositoryFailureCollector failures, Exception t) {
failures.addFailure(t);
if (request.isRepositoryDisabled() && !request.isContinueOnConnectionFailure()) {
// Clear the queue only if repo is now disabled, and we can't continue with it disabled
queue.clear();
failures.markFatalError();
}
}This two-part enforcement ensures fix completeness across both static version metadata resolution and dynamic version range resolution. By combining forced repository disablement after retry exhaustion with immediate queue termination, the patch eliminates the possibility of falling through to secondary repositories after any unhandled network or connection failure.
Exploiting CVE-2026-22816 requires a target Gradle project configured with multiple repositories where a primary private or custom repository precedes a public repository (such as mavenCentral(), google(), or gradlePluginPortal()). Typical enterprise configurations define their repository blocks in build.gradle or settings.gradle as follows:
repositories {
maven {
url = uri("https://artifacts.internal-corp-domain.net/repository/maven-public/")
}
mavenCentral()
}
dependencies {
implementation("com.internalcorp.security:auth-client:2.4.1")
implementation("com.internalcorp.common:logging-utils:1.1.+ ")
}To trigger the vulnerability, the primary repository (artifacts.internal-corp-domain.net) must fail in a manner that triggers Gradle's fall-through behavior rather than returning a valid HTTP 200 OK or 404 Not Found. This condition occurs under several practical operational scenarios:
429 / 408 responses across all retry attempts.An external attacker conducting a dependency confusion attack first identifies internal package coordinates (groupId:artifactId:version) used by the target organization. These coordinates are frequently disclosed in public GitHub repositories, leaked build logs, stack traces, or client-side JavaScript/Android APK metadata. If the target uses a public namespace that they do not exclusively control on Maven Central—or if the attacker compromises or registers the namespace—the attacker publishes a malicious artifact matching the target's coordinates (or a higher version matching a dynamic selector like 1.1.+) to the downstream public repository.
Alternatively, if the primary repository URL points to an expired domain, the attacker registers the lapsed domain directly and hosts a rogue Maven repository serving malicious JARs. Even before the domain is registered—while DNS queries or socket connections fail—the vulnerable Gradle client fails to abort the build and falls through to the secondary public repository.
When a developer or CI/CD runner executes ./gradlew build or ./gradlew assemble on an affected Gradle version, Gradle attempts to contact the primary repository, exhausts its retry attempts, fails to mark the repository as fatal, and advances the resolution queue to mavenCentral(). Gradle downloads the attacker's JAR and places it on the compilation or buildscript classpath. Arbitrary code execution occurs immediately when the build executes annotation processors (kapt / annotationProcessor), Gradle plugins, custom tasks, or unit tests.
The primary impact of CVE-2026-22816 is remote code execution within the context of the build environment via software supply chain compromise. In modern software development lifecycles, Gradle builds execute automatically on high-privilege CI/CD runners (such as GitHub Actions, GitLab CI, Jenkins, or TeamCity) that hold sensitive deployment secrets, cloud provider IAM tokens, signing keys, and write credentials to production container registries.
When a malicious dependency is resolved from an untrusted fallback repository, any code packaged inside a Gradle plugin, annotation processor, test suite, or runtime initializer executes with the full privileges of the user or service account running the Gradle daemon. Furthermore, the compromised dependency is compiled and packaged into the final production application binary, propagating the compromise downstream to end users or production servers.
GitHub (acting as the CNA) assigned CVE-2026-22816 a CVSS v4.0 base score of 8.6 (HIGH) with the vector string 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 high attack complexity (AC:H) and present attack requirements (AT:P) reflect that exploitation depends on the primary repository experiencing a connection or resolution failure while a matching package is available on a downstream repository. The subsequent system integrity impact is rated High (SI:H) because injected dependencies compromise downstream artifacts produced by the build.
The National Vulnerability Database (NVD) assigned a CVSS v3.1 base score of 7.4 (HIGH) with the vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N. While no active exploitation campaigns are currently listed in the CISA Known Exploited Vulnerabilities (KEV) catalog and the EPSS score sits at 0.00174 (6.84th percentile), dependency confusion remains a widely utilized initial access technique against enterprise build pipelines.
The definitive remediation for CVE-2026-22816 is upgrading Gradle to version 8.14.4 (for the 8.x release line) or 9.3.0 (for the 9.x release line). Projects utilizing the Gradle Wrapper (gradlew) should update their wrapper configuration by running the wrapper task with the patched version and committing the updated gradle/wrapper/gradle-wrapper.properties file to version control:
# For Gradle 8.x projects
./gradlew wrapper --gradle-version 8.14.4
# For Gradle 9.x projects
./gradlew wrapper --gradle-version 9.3.0> [!NOTE]
> After upgrading to 8.14.4 or 9.3.0, builds that previously succeeded despite having broken, unreachable, or misconfigured repositories in their repositories block will now fail deterministically. Audit all build.gradle, build.gradle.kts, and settings.gradle files to remove dead or deprecated repository URLs before or during the upgrade.
In addition to upgrading the Gradle runtime, engineering teams should implement Repository Content Filtering as a defense-in-depth control against dependency confusion. Content filtering explicitly binds internal group IDs to private repositories and excludes them from public registries, ensuring Gradle never queries external sources for internal namespaces under any circumstance:
repositories {
maven {
url = uri("https://internal-repo.company.com/maven2")
content {
includeGroup("com.company.internal")
includeGroupByRegex("com\\.company\\..*")
}
}
mavenCentral {
content {
excludeGroup("com.company.internal")
excludeGroupByRegex("com\\.company\\..*")
}
}
}Finally, organizations should enforce Gradle Dependency Verification. By maintaining a gradle/verification-metadata.xml file containing cryptographic SHA-256 checksums and trusted PGP keys for all dependencies, Gradle will verify the integrity of every downloaded artifact and abort the build if an unexpected or tampered binary is returned by any repository:
./gradlew --write-verification-metadata sha256,pgp helpCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
Gradle Gradle | < 8.14.4 | 8.14.4 |
Gradle Gradle | >= 9.0.0, < 9.3.0 | 9.3.0 |
| Attribute | Detail |
|---|---|
| CVE ID | CVE-2026-22816 (GHSA-w78c-w6vf-rw82) |
| Weakness Class | CWE-829 / CWE-494 (Dependency Confusion via Repository Fall-Through) |
| CVSS v3.1 / v4.0 | 7.4 HIGH (v3.1) / 8.6 HIGH (v4.0) |
| Attack Vector | Network (AV:N) via Unreachable Primary Repository & Public Fallback |
| Affected Versions | Gradle < 8.14.4 and 9.0.0 - 9.2.1 |
| Patched Versions | Gradle 8.14.4 and 9.3.0 |
| EPSS Score | 0.17% (6.84th Percentile) |
| CISA KEV Status | Not Listed |
The software imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.
CVE-2026-133469 is an improper authentication and input type validation vulnerability in the xo-server component of Vates Xen Orchestra and Xen Orchestra Appliance (XOA). Due to Express cookie-parser JSON deserialization combined with loose truthiness validation and unvalidated Redis query construction, an unauthenticated attacker can supply an empty JSON object cookie (authenticationToken=j:{}) to bypass authentication and hijack the first valid active session token stored in the database. This flaw is actively exploited in the wild to gain administrative control over Xen Orchestra deployments and execute root-level commands on underlying XCP-ng and XenServer hypervisors.
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.
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.
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.
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.
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.