/

CVE-2026-32948

Severity:

HIGH RISK

(7.8)

OS Command Injection in sbt VCS Command Invocation on

CVE-2026-32948

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution on Build Host

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 sbt on Windows allows user-controlled VCS fragment values (branches, tags, revisions) to be passed into cmd /c without validation.

When a build definition includes malicious characters like &, |, or ; in these fragments, Windows cmd can interpret them as command separators, enabling arbitrary command execution during VCS operations.

Affected context

This issue affects sbt projects running on Windows that:

  • Use sbt versions from 0.9.5 up to, but not including, 1.12.7
  • Rely on VCS-based dependencies or project sources (e.g., git, hg, svn URIs)
  • Allow developers or automation to define or influence branch, tag, or revision fragments in build definitions

The vulnerability is exposed when sbt spawns VCS commands via Process("cmd", "/c", ...) and incorporates the fragment value directly into the command line.

Exploit preconditions

  • Attack surface: Local build environment on Windows, including CI agents, developer workstations, or shared build servers.
  • Required access: Ability to modify or influence sbt build definitions, dependency URIs, or any configuration that controls VCS branch/tag/revision fragments (e.g., via pull requests, compromised repositories, or internal developer accounts).
  • Trigger point: Execution of sbt tasks that cause VCS operations, such as resolving dependencies from VCS, updating sources, or checking out specific revisions.
  • Why exploitation is possible: The URI fragment is treated as trusted input and embedded into a command string executed through cmd /c, which interprets characters like &, |, and ; as command separators, allowing additional commands to be appended and executed.

Why this happens

The root cause is an OS command injection pattern in how sbt invokes VCS commands on Windows.

Rather than passing arguments as a structured, escaped parameter list to the underlying process, sbt builds command lines that include user-controlled fragments and then executes them via cmd /c.

On Windows, cmd parses special metacharacters (such as &, |, and ;) to chain or control command execution.

By not validating or escaping these characters in branch/tag/revision fragments, the implementation falls under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), because untrusted input can alter the structure of the executed command.

Potential impact

  • Arbitrary command execution under the privileges of the user or CI service account running sbt
  • Exposure or exfiltration of sensitive data present on the build host or workspace
  • Tampering with build outputs, including insertion of malicious code into compiled artifacts
  • Compromise of CI pipelines or developer machines, potentially enabling credential theft or lateral movement
  • Disruption or sabotage of builds, tests, and deployment processes

General mitigation guidance

Mitigation generally focuses on command construction, input handling, and execution environment hardening:

  • Use process execution APIs that pass arguments as structured lists rather than constructing full shell command strings, avoiding cmd /c where possible.
  • Apply strict validation and canonicalization to all user-controlled fragments used in VCS commands (e.g., allow-listed patterns for branch/tag/revision names, rejecting metacharacters like &, |, ;, <, >).
  • Where shell invocation is unavoidable, ensure proper escaping/quoting of user-controlled values according to Windows command-line rules.
  • Reduce the privileges of accounts used to run sbt and CI builds, limiting what malicious commands can access or modify.
  • Separate high-trust build configuration from lower-trust sources (e.g., untrusted pull requests) and treat any configuration that controls VCS fragments as high-risk input.

How teams detect issues like this

Effective detection can combine code-level, pipeline-level, and host-level observations:

  • Static analysis and code review:
  • Flag uses of shell or command interpreters (e.g., cmd /c) where user-controlled data is concatenated into command strings.
  • Identify patterns where VCS URIs, branch/tag/revision names, or other configuration values flow into process invocation APIs without validation or escaping.
  • Use automated review tools to enforce policies that ban or restrict shell-based invocation from build tools.
  • Configuration and pipeline checks:
  • Scan build definitions and dependency declarations for suspicious branch/tag/revision names containing shell metacharacters.
  • Apply CI policies that block or quarantine builds using non-conforming VCS fragment patterns, especially on untrusted branches or forks.
  • Runtime and host monitoring:
  • Monitor build hosts and CI agents for unusual child processes spawned during sbt runs (e.g., unexpected scripting interpreters, network utilities, or administrative tools).
  • Use command-line auditing to detect commands containing suspicious injected fragments.

Sources

SourceLink
github.comgithub.com/sbt/sbt/commit/1ce945b6b79cbe3cef6c0fe9efbbd2904e0f479e
github.comgithub.com/sbt/sbt/commit/3a474ab060df4dbfa825a7e7bc97e00056519800
github.comgithub.com/sbt/sbt/releases/tag/v1.12.7
github.comgithub.com/sbt/sbt/security/advisories/GHSA-x4ff-q6h8-v7gw

Frequently asked

questions

It can be remotely influenced when attackers can modify build definitions or dependency references, such as through pull requests, compromised repositories, or tampered configuration in a source control system.

Exploitation occurs when a vulnerable sbt instance on a Windows machine executes the affected build, so the impact is local to the build host even if the trigger originates remotely.

An attacker must be able to define or modify the VCS URI fragment used by sbt, typically through access to the repository containing the sbt build definition, or through any mechanism that lets them influence branch/tag/revision values consumed by sbt.

Avoid passing user-controlled values through cmd /c or any shell interpreter.

Instead, construct process invocations using APIs that accept argument lists and apply strict validation or allow-listing for VCS fragment values so that only syntactically valid branch or tag names are permitted.

Design build and tooling code so that untrusted input is never concatenated into shell command strings, enforce rigorous input validation on configuration parameters, and incorporate security-focused code review and automated checks that flag shell invocations and potential injection sites in build logic.

Find out what's already
exploitable in your codebase.