CVE-2022-31156: CWE-829: Inclusion of Functionality from Untrusted Control Sphere in gradle gradle
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.
AI Analysis
Technical Summary
CVE-2022-31156 is a medium-severity vulnerability affecting Gradle, a widely used build automation tool primarily for Java projects. The vulnerability arises from improper handling of dependency verification metadata in Gradle versions 6.2 through 7.4.2. Gradle's dependency verification feature is designed to ensure the integrity and authenticity of external dependencies by validating them against checksums or cryptographic signatures (GPG signatures). However, in certain scenarios, Gradle may skip verification checks and accept untrusted dependencies, potentially allowing malicious artifacts to be incorporated into the build process. Specifically, the vulnerability manifests in two cases: (1) when signature verification is disabled but the verification metadata contains entries with a GPG element but no checksum element, and (2) when signature verification is enabled but the verification metadata includes entries with a GPG element while the remote repository lacks the corresponding signature file. In both cases, Gradle erroneously bypasses signature verification and does not enforce checksum validation, thereby accepting dependencies that should otherwise be rejected. This flaw can be exploited via name squatting attacks, where an attacker publishes a malicious artifact with the same name as a legitimate dependency in an external repository. If the build system downloads dependencies over insecure HTTP rather than HTTPS, an attacker could also perform man-in-the-middle attacks to substitute malicious libraries. The consequence is the potential inclusion of malicious code in the build, which can compromise the confidentiality, integrity, and availability of the resulting software. Gradle 7.5 addresses this vulnerability by enforcing checksum verification whenever signature verification cannot be completed, regardless of the reason. Workarounds include removing all GPG elements from dependency verification metadata if signature validation is disabled and avoiding adding GPG entries for dependencies without signature files. No known exploits have been reported in the wild, but the vulnerability poses a significant risk to software supply chain security, especially in environments relying on external dependencies without strict verification.
Potential Impact
For European organizations, this vulnerability poses a risk to the software supply chain integrity, particularly for enterprises and developers relying on Gradle for building Java-based applications. Compromised dependencies could lead to the introduction of malicious code, potentially resulting in data breaches, unauthorized access, or disruption of services. Organizations in sectors with stringent regulatory requirements—such as finance, healthcare, and critical infrastructure—may face compliance violations if compromised builds lead to data leakage or service outages. The risk is heightened for organizations that use HTTP repositories or have disabled signature verification, increasing the likelihood of man-in-the-middle or supply chain attacks. Since Gradle is widely adopted in software development across Europe, the vulnerability could impact a broad range of industries, from technology firms to manufacturing companies relying on embedded software. Furthermore, the inclusion of malicious dependencies could facilitate lateral movement within networks or enable attackers to implant persistent backdoors. This undermines trust in software integrity and could have cascading effects on downstream consumers of compromised software products.
Mitigation Recommendations
1. Upgrade to Gradle version 7.5 or later, where the vulnerability is patched by enforcing checksum verification if signature verification fails. 2. Audit and sanitize dependency verification metadata by removing all GPG elements if signature verification is disabled. 3. Avoid adding GPG entries for dependencies that do not have corresponding signature files in remote repositories. 4. Enforce the use of HTTPS for all dependency repositories to prevent man-in-the-middle attacks. 5. Implement strict dependency management policies, including locking dependency versions and verifying checksums independently. 6. Integrate automated scanning tools in CI/CD pipelines to detect unverified or suspicious dependencies. 7. Educate development teams about the risks of disabling signature verification and the importance of supply chain security. 8. Monitor build logs for warnings or errors related to dependency verification and investigate anomalies promptly. 9. Consider using repository managers (e.g., Nexus, Artifactory) to proxy and cache dependencies, adding an additional layer of control and verification. 10. Regularly review and update security policies related to software supply chain and dependency management.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Italy, Spain, Poland, Belgium
CVE-2022-31156: CWE-829: Inclusion of Functionality from Untrusted Control Sphere in gradle gradle
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.
AI-Powered Analysis
Technical Analysis
CVE-2022-31156 is a medium-severity vulnerability affecting Gradle, a widely used build automation tool primarily for Java projects. The vulnerability arises from improper handling of dependency verification metadata in Gradle versions 6.2 through 7.4.2. Gradle's dependency verification feature is designed to ensure the integrity and authenticity of external dependencies by validating them against checksums or cryptographic signatures (GPG signatures). However, in certain scenarios, Gradle may skip verification checks and accept untrusted dependencies, potentially allowing malicious artifacts to be incorporated into the build process. Specifically, the vulnerability manifests in two cases: (1) when signature verification is disabled but the verification metadata contains entries with a GPG element but no checksum element, and (2) when signature verification is enabled but the verification metadata includes entries with a GPG element while the remote repository lacks the corresponding signature file. In both cases, Gradle erroneously bypasses signature verification and does not enforce checksum validation, thereby accepting dependencies that should otherwise be rejected. This flaw can be exploited via name squatting attacks, where an attacker publishes a malicious artifact with the same name as a legitimate dependency in an external repository. If the build system downloads dependencies over insecure HTTP rather than HTTPS, an attacker could also perform man-in-the-middle attacks to substitute malicious libraries. The consequence is the potential inclusion of malicious code in the build, which can compromise the confidentiality, integrity, and availability of the resulting software. Gradle 7.5 addresses this vulnerability by enforcing checksum verification whenever signature verification cannot be completed, regardless of the reason. Workarounds include removing all GPG elements from dependency verification metadata if signature validation is disabled and avoiding adding GPG entries for dependencies without signature files. No known exploits have been reported in the wild, but the vulnerability poses a significant risk to software supply chain security, especially in environments relying on external dependencies without strict verification.
Potential Impact
For European organizations, this vulnerability poses a risk to the software supply chain integrity, particularly for enterprises and developers relying on Gradle for building Java-based applications. Compromised dependencies could lead to the introduction of malicious code, potentially resulting in data breaches, unauthorized access, or disruption of services. Organizations in sectors with stringent regulatory requirements—such as finance, healthcare, and critical infrastructure—may face compliance violations if compromised builds lead to data leakage or service outages. The risk is heightened for organizations that use HTTP repositories or have disabled signature verification, increasing the likelihood of man-in-the-middle or supply chain attacks. Since Gradle is widely adopted in software development across Europe, the vulnerability could impact a broad range of industries, from technology firms to manufacturing companies relying on embedded software. Furthermore, the inclusion of malicious dependencies could facilitate lateral movement within networks or enable attackers to implant persistent backdoors. This undermines trust in software integrity and could have cascading effects on downstream consumers of compromised software products.
Mitigation Recommendations
1. Upgrade to Gradle version 7.5 or later, where the vulnerability is patched by enforcing checksum verification if signature verification fails. 2. Audit and sanitize dependency verification metadata by removing all GPG elements if signature verification is disabled. 3. Avoid adding GPG entries for dependencies that do not have corresponding signature files in remote repositories. 4. Enforce the use of HTTPS for all dependency repositories to prevent man-in-the-middle attacks. 5. Implement strict dependency management policies, including locking dependency versions and verifying checksums independently. 6. Integrate automated scanning tools in CI/CD pipelines to detect unverified or suspicious dependencies. 7. Educate development teams about the risks of disabling signature verification and the importance of supply chain security. 8. Monitor build logs for warnings or errors related to dependency verification and investigate anomalies promptly. 9. Consider using repository managers (e.g., Nexus, Artifactory) to proxy and cache dependencies, adding an additional layer of control and verification. 10. Regularly review and update security policies related to software supply chain and dependency management.
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2022-05-18T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9844c4522896dcbf372a
Added to database: 5/21/2025, 9:09:24 AM
Last enriched: 6/23/2025, 2:36:25 AM
Last updated: 8/14/2025, 3:14:53 AM
Views: 15
Related Threats
CVE-2025-53948: CWE-415 Double Free in Santesoft Sante PACS Server
HighCVE-2025-52584: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-46269: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-54862: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumCVE-2025-54759: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.