Someone sets a version string in your CI config. The build script pastes it into a plugin coordinate, then downloads and runs that plugin. Whoever sets the string owns the build.
What goes wrong
A version string comes from outside the build script: a property, an environment override, a value in the root project's config. The script drops it straight into the coordinate that tells the build which plugin to fetch. Plugins are not data. They are code that runs with the full authority of your build.
So whoever can set that property picks which plugin release the build downloads and executes. Point it at a malicious version available through the configured repositories and the build pulls it and runs it. That is arbitrary code execution on your build machine, which usually holds signing keys and the deploy credentials that ship your releases.
The mistake is treating a version like a harmless knob. For a dependency you merely link against, a floating version is a supply-chain risk. For a plugin you execute, it is a direct path to code execution. Pin plugin versions to known-good values and control who can override them.
The pattern
// version comes from external, overridable config
def pluginVersion = project.props['pluginVersion']
buildscript {
dependencies {
classpath 'com.example:build-plugin:' + pluginVersion // fetched and run
}
}// pin the version, do not read it from overridable input
buildscript {
dependencies {
classpath 'com.example:build-plugin:2.4.1' // known-good, reviewed
}
}
// bump it through a reviewed commit, verify checksumsEvery gate held. The exploit path was reproduced against a negative control, the impact was calibrated, and the finding was signed report-ready.
Why it matters to you
Your build server is one of the highest-value targets you own. It signs releases and holds the credentials that ship them. A knob that lets external config choose executable plugin code turns a settings change into remote code execution, and the output is trusted artifacts carrying your signature. Pin what your build executes, and lock down who can change build properties.
Check your own code
- Find version strings for build plugins that come from overridable properties or env vars.
- Pin executable plugin versions to specific reviewed releases.
- Enable dependency checksum or signature verification for the build.
- Restrict who can edit CI variables and root-project build config.