How to fix: Gradle dependency lockfile exposed
The response is a Gradle dependency lockfile, served directly over HTTP. It is identified by Gradle's generated banner, or by lines in the group:artifact:version=configurations form.
Why it matters
Each line names a resolved JVM coordinate and the configurations it belongs to, so the file separates runtime dependencies from compile-only and test ones. That tells an attacker exactly which libraries are loaded in the running process, which is the set worth checking for a deserialization or expression-language vulnerability.
Dependency locking is a Gradle feature you have to opt into, so a project that has one is usually one that cares about reproducible builds. The lockfile still has no business being served: it is a build input, and the only thing publishing it changes is how quickly someone else can enumerate your JVM stack.
How to fix it
- 1Exclude gradle.lockfile, gradle/ and build files from the deployed artifact; ship the built JAR or WAR, not the project directory.
- 2Block lockfile paths at the reverse proxy.
- 3Run a dependency check against the locked coordinates, since the list is now known.
Code examples
Check the coordinates for known issues
./gradlew dependencyCheckAnalyze
# or, with OSV
osv-scanner --lockfile gradle.lockfileApache: deny build files
<FilesMatch "^(gradle\.lockfile|build\.gradle(\.kts)?|settings\.gradle(\.kts)?)$">
Require all denied
</FilesMatch>References
Detected automatically by VulnRadar. The check id is supply-chain-gradle-lockfile-exposed, stable across every scan so you can filter or diff on it.
More supply chain checks
- Mediumnpm/yarn Lock File Exposed
- MediumPython Requirements File Exposed
- MediumRuby Gemfile or Gemfile.lock Exposed
- MediumExternal CDN Script Without SRI Hash
- HighHTTP Script Loaded on HTTPS Page
- MediumPHP composer.json or composer.lock Exposed
- HighDockerfile or docker-compose.yml Exposed
- Critical.env File Exposed at Public URL
Questions
- How severe is Gradle dependency lockfile exposed?
- VulnRadar rates this low severity in the supply chain category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id supply-chain-gradle-lockfile-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Gradle dependency lockfile exposed map to?
- It maps to CWE-540. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.