CVE-2022-31156 Gradle's dependency verification can ignore checksum verification when signature verification cannot be performed

Medium 6.6 Published Updated

Gradle may skip dependency verification if signature checks fail, allowing attackers to inject malicious artifacts via name squatting or HTTP interception.

Exploited in the wild
Not known
Login needed
An administrator
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-31156?

CVE-2022-31156 is a medium-severity vulnerability in gradle, published on 14 Jul 2022. An attacker needs administrator access to exploit it, with no action from the victim.

Official description

Gradle is a build tool. 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 versions 6.2 through 7.4.2, there are some cases in which Gradle may skip that verification and accept a dependency that would otherwise fail the build as an untrusted external artifact. This can occur in two ways. When signature verification is disabled but the verification metadata contains entries for dependencies that only have a `gpg` element but no `checksum` element. When signature verification is enabled, the verification metadata contains entries for dependencies with a `gpg` element but there is no signature file on the remote repository. In both cases, the verification will accept the dependency, skipping signature verification and not complaining that the dependency has no checksum entry. For builds that are vulnerable, there are two risks. Gradle could download a malicious binary from a repository outside your organization due to name squatting. For those still using HTTP only and not HTTPS for downloading dependencies, the build could download a malicious library instead of the expected one. Gradle 7.5 patches this issue by making sure to run checksum verification if signature verification cannot be completed, whatever the reason. Two workarounds are available: Remove all `gpg` elements from dependency verification metadata if you disable signature validation and/or avoid adding `gpg` entries for dependencies that do not have signature files.

Weakness: CWE-347, CWE-829

Which versions are affected by CVE-2022-31156?

1 open source package ship an affected version, including gradle. It affects 1 product.

PackageAffectedFixed in
gradle BitnamiFrom 6.2.07.5.0

Products include Gradle Gradle.

How do I fix CVE-2022-31156?

Upgrade gradle to 7.5.0 or later.

Is CVE-2022-31156 being exploited?

There is no known exploitation of CVE-2022-31156 in the wild and no public exploit code.

Sources

Also known as BIT-gradle-2022-31156, GHSA-j6wc-xfg8-jx2j, UBUNTU-CVE-2022-31156.

Is CVE-2022-31156 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free