CVE-2026-22865: CVE-2026-22865: Dependency Resolution Fallback to Untrusted Repositories in Gradle
CVE-2026-22865: Dependency Resolution Fallback to Untrusted Repositories in Gradle Vulnerability ID: CVE-2026-22865 CVSS Score: 7.4 Published: 2026-11-23 Gradle versions prior to 8.14.4 and 9.3.0 fail to classify ce
CVE-2026-22865: Dependency Resolution Fallback to Untrusted Repositories in Gradle
Vulnerability ID: CVE-2026-22865
CVSS Score: 7.4
Published: 2026-11-23
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.
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.
Technical Details
- Vulnerability ID: CVE-2026-22865 / GHSA-mqwm-5m85-gmcv
- Weakness Class: CWE-829 (Untrusted Control Sphere) / CWE-494
- CVSS v3.1 / v4.0: 7.4 HIGH (v3.1) / 8.6 HIGH (v4.0)
- Attack Vector: Network (AV:N) with High Complexity (AC:H)
- EPSS Score: 0.16% (4.89th Percentile)
- Affected Component: org.gradle.internal.resolve.ResolveExceptionAnalyzer
- Patched Versions: Gradle 8.14.4 and Gradle 9.3.0
- CISA KEV Status: Not Listed
Affected Systems
- Gradle Build Tool (org.gradle:gradle-core) < 8.14.4
- Gradle Build Tool (org.gradle:gradle-core) >= 9.0.0, < 9.3.0
-
Gradle: < 8.14.4 (Fixed in:
8.14.4) -
Gradle: >= 9.0.0, < 9.3.0 (Fixed in:
9.3.0)
Code Analysis
Commit: d38bfc0
Disable repositories on unknown host exception. Also adjust test to clarify when Gradle disables and when it does not.
@@ -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);
+ return isTimeoutException(rootCause) || isUnrecoverable5xxStatusCode(rootCause) || isUnknownHostException(rootCause);
+ }
+
+ private static boolean isUnknownHostException(Throwable rootCause) {
+ return rootCause instanceof UnknownHostException;
}
Commit: fa96c8b
Disable repositories on unknown host exception (Backport/Mirror commit)
Mitigation Strategies
- Upgrade Gradle build tools and project wrappers to version 8.14.4 or 9.3.0+ to ensure fatal network exceptions disable unresponsive repositories.
- Enforce Repository Content Filtering in build scripts using includeGroup, includeGroupByRegex, and excludeGroup directives to bind namespaces to specific repositories.
- Enable Gradle Dependency Verification (SHA-256 checksums and PGP signatures) to detect and block unauthorized artifact substitution.
- Route all external dependency requests through a single authenticated internal repository manager (e.g., Artifactory or Nexus virtual repository) rather than listing multiple repositories in project build scripts.
Remediation Steps:
- Audit all projects for the Gradle version specified in gradle/wrapper/gradle-wrapper.properties.
- Run './gradlew wrapper --gradle-version=8.14.4' (for 8.x users) or './gradlew wrapper --gradle-version=9.3.0' (for 9.x users) to update the wrapper configuration.
- Review build.gradle, build.gradle.kts, settings.gradle, and init.gradle files for multi-repository declarations.
- Add repository content filtering blocks to isolate proprietary group IDs to internal repositories.
- Run './gradlew --write-verification-metadata sha256' and commit gradle/verification-metadata.xml to enforce artifact integrity verification.
References
- GitHub Security Advisory GHSA-mqwm-5m85-gmcv
- NIST National Vulnerability Database (NVD) - CVE-2026-22865
- Official CVE Record - CVE-2026-22865
- Gradle Fix Commit d38bfc0f1d4dabd38b305a67489bb8a6645138a1
- Gradle Fix Commit fa96c8bc7f7741e5dfa1da002c559afca3fa1fc1
- Gradle Issue Discussion #35927
- Gradle 8.14.4 Release Notes
- Gradle 9.3.0 Release Notes
- Gradle User Guide: Dependency Verification
- Gradle User Guide: Filtering Repository Content
Read the full report for CVE-2026-22865 on our website for more details including interactive diagrams and full exploit analysis.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.