The vulnerability, CVE-2025-67640, is an OS command injection flaw in the Jenkins Git client Plugin. The root cause was the unsafe creation of temporary wrapper scripts for SSH authentication. The functions createWindowsGitSSH and createUnixGitSSH in CliGitAPIImpl.java would generate a .bat or .sh script, respectively, by directly embedding the file path to the SSH private key into the script's command line arguments.
The key's path is derived from the Jenkins workspace path, which can be controlled by an attacker with sufficient permissions. By creating a workspace with a name containing shell metacharacters, an attacker could inject commands into the generated script. For example, a workspace named my-job-touch /tmp/pwned`` on a Unix system would cause the touch command to be executed when the SSH wrapper script is run.
The patch mitigates this by fundamentally changing how the key path is passed to the script. Instead of insecure string concatenation, the path is now passed securely through an environment variable (JENKINS_GIT_SSH_KEYFILE). The wrapper scripts are modified to read this variable, preventing the shell from interpreting any special characters within the path. The createTempFile logic was also changed to always use a safe system temporary directory for these scripts, further hardening the fix.