CVE-2026-22816
Gradle causes Failure to disable repositories can expose builds to malicious artifacts
Description
Impact
When resolving dependencies, Gradle searches repositories in declaration order. If it encounters connection errors, Gradle will disable the repository and fail dependency resolution. This is necessary for both reproducibility and security reasons to prevent dependencies from being resolved from other repositories without warning.
In previous versions of Gradle, some exceptions were not treated as fatal errors and would not cause a repository to be disabled. If a build encountered one of these exceptions, Gradle would continue to the next repository in the list and potentially resolve dependencies from a different repository.
Vulnerability caused by unresolvable host names
UnknownHostException are caused when a host name cannot be resolved to an IP address. This can be caused by DNS misconfiguration, host name typos or any problem that prevents host name resolution.
If a Gradle build used an unresolvable host name, Gradle would continue to work as long as all dependencies could be resolved from another repository. An unresolvable host name could be caused by allowing a repository's domain name registration to lapse or typo-ing the real domain name.
This behavior could allow an attacker to register a service under the host name used by the build and serve malicious artifacts. The attack requires the repository to be listed before others in the build configuration.
Patches
Gradle has introduced a change in behavior in Gradle 9.3.0 and 8.14.4 to stop searching other repositories when encountering these errors.
Upgrading to either version will protect you against the vulnerabilities described here.
Workarounds
If you are using strict repository content filtering and / or dependency verification, your build is safe from the potential vulnerabilities described above.
If you cannot update to a newer Gradle version, configuring dependency verification is the best way to make sure your build resolves the dependencies you expect and nothing else.
You should also review which repositories your builds use to check for unused or outdated repository declarations.
Related
Affected Maven artifacts (1)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| org.gradle » gradle-core | < 8.14.4>= 9.0.0, < 9.3.0 | 8.14.4, 9.3.0 |
Blast radius
57% of the dependent artifacts (24) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 479 |
| 2 hops | 232 |
| 3 hops | 15 |
Most used dependents
- org.gradle » gradle-tooling-api295 usages
- org.jfrog.buildinfo » build-info-extractor-gradle53 usages
- net.sf.proguard » proguard-gradle32 usages
- org.fortasoft » gradle-maven-plugin25 usages
- com.citytechinc.cq.cq-component-plugin » cq-component-maven-plugin7 usages
- org.octopusden.octopus.infrastructure » component-resolver-core3 usages
- cz.habarta.typescript-generator » typescript-generator-gradle-plugin3 usages
- io.github.yamsergey » tools-android1 usages
- com.icfolson.aem.harbor » harbor-core1 usages
- gradle.plugin.com.github.nikit.cpp » wildflyPlugin1 usages
- org.eclipse.jkube.kubernetes » org.eclipse.jkube.kubernetes.gradle.plugin1 usages
- org.eclipse.jkube.openshift » org.eclipse.jkube.openshift.gradle.plugin1 usages
- gradle.plugin.org.avdiel.gitcloner » GitCloner1 usages
- gradle.plugin.com.github.nikit.cpp » wildflyDeployPlugin1 usages
- io.fabric8.java-generator » io.fabric8.java-generator.gradle.plugin1 usages
Computed from the dependency graph of build 20261125.0317 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
References
| Advisory | NVD CVE-2026-22816 | nvd.nist.gov |
| Package | gradle/gradle | github.com |
| Web | gradle/gradle advisory GHSA-w78c-w6vf-rw82 | github.com |
| Web | gradle/gradle commit 4f2e3bb | github.com |
| Web | gradle/gradle commit e5707d0 | github.com |
| Web | 8.14.4/release-notes.html | docs.gradle.org |
| Web | 9.3.0/release-notes.html | docs.gradle.org |
| Web | gradle/gradle release v8.14.4 | github.com |
| Web | gradle/gradle release v9.3.0 | github.com |
