/

CVE-2026-45695

Severity:

CRITICAL RISK

(9.8)

Command Injection (CWE-78) in Kopia HTTP SFTP Backend

CVE-2026-45695

Deferred

Vulnerability type

Category:

Command Injection

CWE:

CWE-78, CWE-306

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.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 flaw in Kopia's HTTP server allows unauthenticated attackers to supply crafted SFTP storage configurations when the server is started with --without-password.

By abusing SSH options such as -oProxyCommand, an attacker can cause the server to execute arbitrary system commands via OpenSSH, leading to remote code execution on the host.

Affected context

This vulnerability appears in Kopia deployments where the embedded HTTP server is started with passwordless access using the --without-password flag.

In this mode, specific repository-related endpoints such as /api/v1/repo/exists can process untrusted storage configurations supplied over HTTP.

Installations that allow network access to this HTTP interface, especially from untrusted networks or shared environments, are more exposed to risk.

Exploit preconditions

  • Attack surface: Kopia HTTP server endpoint /api/v1/repo/exists
  • Required access: Network reachability to the HTTP server while it is running with --without-password
  • Trigger point: Submission of a malicious SFTP storage configuration that is forwarded to blob.NewStorage
  • Why exploitation is possible: Attacker-supplied fields such as externalSSH: true and sshArguments (including -oProxyCommand=<cmd>) are passed to exec.CommandContext("ssh") without sufficient validation or restriction, allowing arbitrary command execution via OpenSSH.

Why this happens

The underlying bug is a command injection pattern where user-controlled configuration values are incorporated into a system-level command invocation.

Specifically, the Kopia HTTP server forwards attacker-supplied SFTP storage parameters to an SSH client invocation (exec.CommandContext("ssh")) and permits options like -oProxyCommand, which delegate execution to the system shell or external commands.

Combined with the lack of authentication when --without-password is used, this aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command (Command Injection) and CWE-306: Missing Authentication for Critical Function, since a critical configuration endpoint is accessible without enforcing identity checks.

Potential impact

  • Remote execution of arbitrary OS commands under the Kopia server's user account
  • Full compromise of the host running the Kopia HTTP server
  • Unauthorized access to backup repositories and sensitive data
  • Use of the compromised system as a pivot for lateral movement within the network
  • Disruption or destruction of backup data, impacting recovery and business continuity

General mitigation guidance

Effective mitigation focuses on limiting both who can reach sensitive endpoints and what configurations are accepted:

  • Avoid exposing passwordless (--without-password) HTTP servers to untrusted networks, and enforce authentication on all repository and storage configuration endpoints.
  • Treat all remote storage configuration parameters as untrusted input and constrain them to a safe, allow-listed subset of options.
  • Disallow or ignore SSH options that can trigger command execution, such as ProxyCommand, Match exec, or similar advanced directives.
  • Prefer high-level, well-audited libraries for storage backends that do not require shelling out to external SSH binaries, or run such helpers with reduced privileges and strict sandboxing.
  • Apply least-privilege principles to the Kopia process, including restricted OS accounts and hardened execution environments, to reduce impact if exploitation occurs.

How teams detect issues like this

Detection typically combines code-centric and operational approaches:

  • Static analysis and code review: Flag any use of exec.Command, exec.CommandContext, or equivalent process-spawning APIs where arguments are influenced by HTTP request data or other untrusted configurations, especially for SSH or shell utilities.
  • Configuration and policy checks: Enforce policies that disallow passwordless admin endpoints; scan deployment manifests and startup scripts for use of --without-password or similar insecure flags.
  • Runtime monitoring: Collect and review logs for unusual invocations of ssh with unexpected options such as -oProxyCommand, or anomalous outbound connections from the backup server host.
  • Automated tooling: Integrate SAST/DAST tools and CI checks to detect command construction patterns, unprotected admin endpoints, and missing authentication around configuration APIs.

Sources

SourceLink
github.comgithub.com/kopia/kopia/commit/c26c6a1b9734c5089217986ffa5cd19f8a6b8900
github.comgithub.com/kopia/kopia/pull/5354
github.comgithub.com/kopia/kopia/releases/tag/v0.23.0
github.comgithub.com/kopia/kopia/security/advisories/GHSA-2q4c-3mrw-63c3

Frequently asked

questions

Yes, it can be exploited remotely as long as an attacker can reach the Kopia HTTP server that is running with --without-password and can send requests to the affected endpoint.

The attacker primarily needs network access to the HTTP interface; no prior authentication is required when the server is configured without a password, making anonymous exploitation possible in exposed environments.

Enforce authentication for all HTTP endpoints that influence storage or repository configuration, and ensure that user-supplied parameters are never passed directly into system command invocations—particularly SSH-related options capable of launching arbitrary commands.

Design configuration and admin APIs under the assumption that all incoming data is untrusted, apply strict validation and allow-listing of options, avoid shelling out to external tools with user-controlled arguments, and include security reviews for any feature that bypasses authentication or relaxes access controls.

Find out what's already
exploitable in your codebase.