Skip to content

Dependency verification can be bypassed when using `ResolutionStrategy.disableDependencyVerification()`

Moderate
ljacomet published GHSA-9pf5-88jw-3qgr Feb 10, 2022

Package

Gradle (Java)

Affected versions

6.2 to 7.3.3

Patched versions

7.4

Description

Impact

Dependency verification is a security feature in Gradle Build Tool that was introduced to allow validation of external dependencies either through their checksum or cryptographic signatures.

In some cases, Gradle may skip that verification and accept a dependency that would otherwise fail the build as an untrusted external artifact.

This occurs when dependency verification is disabled on one or more configurations and those configurations have common dependencies with other configurations that have dependency verification enabled. If the configuration that has dependency verification disabled is resolved first, Gradle does not verify the common dependencies for the configuration that has dependency verification enabled.

For builds that are vulnerable, there are two risks:

  • Dependency poisoning/Dependency confusion: Gradle could download a malicious binary from a repository outside your organization due to name squatting.
  • Man In The Middle: If you are still using HTTP only and not HTTPS for downloading dependencies, your build could download a malicious library instead of the expected one.

Patches

Gradle 7.4 fixes that issue by validating artifacts at least once if they are present in a resolved configuration that has dependency verification active.

Workarounds

  • Do not use ResolutionStrategy.disableDependencyVerification() and do not use plugins that use that method to disable dependency verification for a single configuration.
  • Make sure resolution of configuration that disable that feature do not happen in builds that resolve configuration where the feature is enabled.

References

Questions?

  • For security related issues, please email us at security@gradle.com.
  • For non-security related issues, please open an issue on GitHub.

Severity

Moderate
6.6
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
High
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H

CVE ID

CVE-2022-23630

Weaknesses

Credits