T09 · Insecure Skill Coding Practices
- Location
references/03-gradle.md:73- Finding
Execution of Untrusted Project-Controlled Build Logic During Dependency Analysis
- Content
View full analysis
Vulnerability Details
File Location:
references/03-gradle.md:73-98
Additional Locations:references/05-commands.md:56-83,references/02-maven.md:73-102,references/05-commands.md:9-49
Vulnerability Type: Execution of untrusted Gradle wrapper scripts and build configuration
Risk Level: HighVulnerable Code
bash # View the complete dependency tree for all configurations ./gradlew dependencies # View the dependency tree for a specific module ./gradlew :module:dependencies # View a specific configuration, such as runtimeClasspath ./gradlew dependencies --configuration runtimeClasspath # View the dependency tree for a specific configuration ./gradlew dependencies --configuration implementation # Generate an HTML report ./gradlew htmlDependencyReport # Locate a specific dependency ./gradlew dependencies --configuration runtimeClasspath | grep commons-lang3 # Check available dependency updates ./gradlew dependencyUpdates # View the compile classpath ./gradlew dependencies --configuration compileClasspathThe Maven guidance similarly recommends executing project-context commands such as:
bash mvn dependency:tree mvn dependency:analyze mvn versions:display-dependency-updates mvn org.owasp:dependency-check-maven:checkTechnical Analysis
The Skill recommends executing the target repository's Gradle wrapper and Maven build operations without first requiring a trust review, isolation, or explicit authorization.
./gradlewis a repository-controlled executable script. Gradle also evaluates project-controlled settings files, initialization logic, build scripts, plugins, and configuration code before or while running dependency-reporting tasks. Consequently, a nominally read-only command such as./gradlew dependenciescan execute arbitrary code supplied by the audited repository.Maven commands can likewise process project-controlled extension ...[truncated 1812 chars]
- Remediation
View remediation
Remediation Suggestions
- Prefer static analysis of
pom.xml, lockfiles, version catalogs, and dependency metadata before executing any project-controlled build operation. - Clearly warn that Gradle and Maven commands may execute arbitrary project code, even when the selected task appears read-only.
- Require explicit user approval before executing build commands in an untrusted repository.
- Inspect Gradle wrapper scripts,
gradle-wrapper.properties, wrapper JAR integrity, settings files, initialization logic, build scripts, and declared plugins before execution. - Inspect
.mvn/extensions.xml,.mvn/maven.config, parent POMs, plugin declarations, settings, mirrors, profiles, and repository configuration before running Maven. - Execute unavoidable build commands in a disposable sandbox or container with:
- No mounted SSH keys, cloud credentials, package-manager tokens, or unrelated user files.
- A read-only source mount where practical.
- A dedicated temporary home directory and isolated build cache.
- Restricted outbound networking.
- No privileged container mode or host socket access.
- CPU, memory, process, and execution-time limits.
- Verify Gradle wrapper distributions and wrapper JARs against trusted checksums.
- Treat output generated by the project build as untrusted data and prevent it from altering audit instructions or trusted reports.
- Prefer static analysis of
