{"id":"GRADLE-2022-0002","summary":"Gradle dependency verification skips checksum verification when signature verification cannot be performed","details":"### Impact\n\nDependency 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.\n\nIn some cases, Gradle may skip that verification and accept a dependency that would otherwise fail the build as an untrusted external artifact.\n\nThis can occur in two ways:\n* When signature verification is disabled but your verification metadata contains entries for dependencies that only have a `gpg` element but no `checksum` element.\n* When signature verification is enabled, your verification metadata contains entries for dependencies with a `gpg` element but there is no signature file on the remote repository.\n\nIn both cases, the verification will accept the dependency, skipping signature verification and not complaining that the dependency has no checksum entry.\n\nFor builds that are vulnerable, there are two risks:\n* Dependency poisoning/Dependency confusion: Gradle could download a malicious binary from a repository outside your organization due to name squatting.\n* 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.\n\n### Patches\n\nGradle 7.5 patches this issue by making sure to run checksum verification if signature verification cannot be completed, whatever the reason.\n\n### Workarounds\n\n* Remove all `gpg` elements from dependency verification metadata if you disable signature validation.\n* Do not add `gpg` entries for dependencies that do not have signature files.\n\n### References\n- [CWE-829: Inclusion of Functionality from Untrusted Control Sphere](https://cwe.mitre.org/data/definitions/829.html)\n- [A Confusing Dependency](https://blog.autsoft.hu/a-confusing-dependency/)\n- [Dependency Confusion](https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610)\n\n### Questions?\n* For security related issues, please email us at security@gradle.com.\n* For non-security related issues, please open an issue on [GitHub](https://github.com/gradle/gradle/issues/new/choose).","aliases":["BIT-gradle-2022-31156","CVE-2022-31156","GHSA-j6wc-xfg8-jx2j"],"modified":"2026-12-03T17:25:59.952491640Z","published":"2022-07-14T19:54:12Z","database_specific":{"cwe_ids":["CWE-829"],"severity":"MEDIUM"},"references":[{"type":"ADVISORY","url":"https://github.com/gradle/gradle/security/advisories/GHSA-j6wc-xfg8-jx2j"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31156"}],"affected":[{"package":{"name":"org.gradle:gradle-core","ecosystem":"Maven","purl":"pkg:maven/org.gradle/gradle-core"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"6.2"},{"fixed":"7.5"}]}],"versions":["6.2","6.2.1","6.2.2","6.3","6.4","6.4.1","6.5","6.5.1","6.6","6.6.1","6.7","6.7.1","6.8","6.8.1","6.8.2","6.8.3","6.9","6.9.1","6.9.2","6.9.3","6.9.4","7.0","7.0.1","7.0.2","7.1","7.1.1","7.2","7.3","7.3.1","7.3.2","7.3.3","7.4","7.4.1","7.4.2"],"database_specific":{"source":"https://github.com/gradle/advisory-database/blob/main/advisories/2022/GRADLE-2022-0002.json"}}],"schema_version":"1.9.3","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H"}]}