Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 3 min read

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:

  1. Audit all projects for the Gradle version specified in gradle/wrapper/gradle-wrapper.properties.
  2. 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.
  3. Review build.gradle, build.gradle.kts, settings.gradle, and init.gradle files for multi-repository declarations.
  4. Add repository content filtering blocks to isolate proprietary group IDs to internal repositories.
  5. Run './gradlew --write-verification-metadata sha256' and commit gradle/verification-metadata.xml to enforce artifact integrity verification.

References

Read the full report for CVE-2026-22865 on our website for more details including interactive diagrams and full exploit analysis.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.