/

CVE-2026-25063

Severity:

HIGH RISK

(7.8)

Command Injection in Bash Completion for gradle-completion

CVE-2026-25063

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78, CWE-157

Impact:

Arbitrary Command Execution on Developer Workstations

Severity:

HIGH RISK

(7.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A command injection vulnerability in the Bash completion script of gradle-completion (up to and including 9.3.0) allows arbitrary command execution when Bash tab completion is used in a project with a malicious Gradle build file.

Because task names and descriptions are not safely sanitized, attacker-controlled content in the Gradle build can be executed on the developer's machine during tab completion, without the user explicitly running any Gradle task.

Affected context

This vulnerability appears when developers use Bash with the gradle-completion integration enabled and work inside a Gradle project whose build scripts can be influenced by untrusted or partially trusted parties (for example, cloned example projects, training repositories, or shared internal templates).

The issue is specific to the Bash completion script: Zsh completion is not affected.

It manifests during interactive shell usage, particularly when users rely on tab completion for Gradle tasks or arguments.

Exploit preconditions

  • Attack surface: Local developer shell environment (Bash) using gradle-completion.
  • Required access: Ability to introduce or modify a Gradle build file in a project directory that a developer will open and use with Bash completion (e.g., via a repository, template, or shared project).
  • Trigger point: The user presses tab in Bash to auto-complete a Gradle command in the affected project, causing the completion script to process task names and descriptions.
  • Why exploitation is possible: The Bash completion script interpolates Gradle task names and descriptions directly into shell command contexts without proper escaping or sanitization, allowing shell metacharacters (such as backticks) to be interpreted as commands rather than plain text.

Why this happens

The core issue is unsanitized insertion of external, script-controlled data into a shell command line within the Bash completion logic.

Gradle task names and descriptions, derived from project build files, are treated as trusted text and embedded into shell command substitutions or echoed strings that the shell then evaluates.

Under CWE-78 (Improper Neutralization of Special Elements used in an OS Command), this pattern occurs when shell metacharacters (such as backticks, $(), or other control characters) are not neutralized before being processed by the interpreter.

CWE-157 is related in that completion and interactive features expose additional attack surface when they assume project metadata is benign, effectively extending the trust boundary of the developer's shell to untrusted build configuration.

Potential impact

  • Execution of arbitrary shell commands on the developer's machine during tab completion.
  • Installation of malware or backdoors under the developer's OS account.
  • Exfiltration of local files, credentials, SSH keys, or access tokens.
  • Modification of local source code or build artifacts.
  • Pivoting into other internal services accessible from the developer's environment.

General mitigation guidance

Safer patterns focus on eliminating evaluation of untrusted text within shell contexts and minimizing the trust placed in build metadata:

  • Ensure completion scripts treat task names and descriptions as plain data, not executable fragments, by using robust escaping and avoiding command substitution when rendering suggestions.
  • Prefer APIs or helper functions that build argument lists without passing through a shell, or that avoid invoking the shell altogether where possible.
  • Constrain what data from build files is surfaced into completion (for example, restrict to simple, validated identifiers rather than free-form descriptions).
  • Where interactive integrations must parse project content, apply strict validation and encoding rules to neutralize shell metacharacters before use.
  • Encourage developers to disable Gradle Bash completion when working with untrusted projects or repositories, especially those obtained from the internet or unknown contributors.

How teams detect issues like this

Detection generally involves reviewing shell integration code paths and how they handle external project data:

  • Use static analysis or code search to identify shell scripts and completion functions that interpolate project-derived strings into eval, command substitutions, or unquoted variable expansions.
  • During code review, flag any use of backticks, $(), or eval on data that might originate from build files, environment variables, or repository contents.
  • Establish policies for shell integration and completion scripts that require explicit escaping functions (e.g., routines that safely quote arguments for the shell) when handling external metadata.
  • Consider running automated security linters or shell script analyzers (for example, tools that warn on unsafe expansions or command injection patterns) across completion scripts and helper utilities.
  • In CI for tooling repositories, include tests that simulate untrusted project metadata and confirm that completion output is safely rendered as text without being executed.

Sources

SourceLink
github.comgithub.com/gradle/gradle-completion/commit/ecacc32bb882210e5d37cd79a74de1af0d0ccad7
github.comgithub.com/gradle/gradle-completion/security/advisories/GHSA-qggc-44r3-cjgv
vicarius.iovicarius.io/vsociety/posts/cve-2026-25063-detection-script-command-injection-vulnerability-in-bash-completion-component
vicarius.iovicarius.io/vsociety/posts/cve-2026-25063-mitigation-script-command-injection-vulnerability-in-bash-completion-component

Frequently asked

questions

It is not directly exploitable over the network, but it becomes exploitable when a developer opens and uses Bash completion in a project whose Gradle build files have been crafted by an attacker, such as a cloned repository or shared template.

An attacker needs the ability to influence the Gradle build files in a project that a developer will work with while Bash completion is enabled.

This can happen through supplying a malicious repository, example project, or patch that introduces dangerous task names or descriptions.

The safest pattern is to ensure that any data coming from build files (task names, descriptions, or other metadata) is treated as untrusted and is properly escaped before being used in shell contexts, and to avoid command substitutions or eval on such data in completion scripts.

When designing developer tooling and shell integrations, define clear trust boundaries for project metadata, apply strict neutralization of special characters before passing data to the shell, avoid dynamic evaluation constructs where possible, and subject completion scripts and helper utilities to the same security review and automated checks as production application code.

Find out what's already
exploitable in your codebase.