CVE-2026-45695: Kopia Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-2q4c-3mrw-63c3
CVSS 9.8
CWE-78 CWE-306
Published
Advisory Summary

CVE-2026-45695 is a CRITICAL (CVSS 9.8) remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Kopia libraries in the Go ecosystem. The issue involves rce via ssh proxycommand injection. Remediation is available by upgrading affected packages to version 0.23.0.

CVE-2026-45695 at a Glance

CVE Identifier CVE-2026-45695
GHSA Identifier GHSA-2q4c-3mrw-63c3
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Kopia
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-45695

To remediate this vulnerability, upgrade all affected Kopia dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/kopia/kopia fixed: 0.23.0
Upgrade github.com/kopia/kopia to 0.23.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/kopia/kopia

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-45695, inspect your project dependencies for Kopia:

inspect dependencies for github.com/kopia/kopia

Analyze the terminal output to locate any version of Kopia in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.23.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Kopia, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary Kopia's HTTP server, when started with `--without-password `, accepts unauthenticated requests to `/api/v1/repo/exists`. The handler forwards an attacker-supplied storage configuration to `blob.NewStorage`. For SFTP backends with `externalSSH: true`, that path constructs a process command line by splitting `sshArguments` on spaces and passes the result directly to `exec.CommandContext("ssh")`. An `-oProxyCommand=<cmd>` token in `sshArguments` causes OpenSSH to invoke `<cmd>` via `$SHELL -c` before any TCP connection is attempted, giving the requester arbitrary command execution as the Kopia process user. ## Analysis [`internal/server/server_authz_checks.go` lines 61–73](https://github.com/kopia/kopia/blob/v0.22.3/internal/server/server_authz_checks.go#L61-L73): when the server is started without `--server-username` or `--server-password`, `getAuthenticator()` returns `nil` and `requireUIUser` unconditionally authorizes the request. Every endpoint registered through `handleUIPossiblyNotConnected` becomes accessible without credentials. [`repo/blob/sftp/sftp_storage.go` lines 448–468](https://github.com/kopia/kopia/blob/v0.22.3/repo/blob/sftp/sftp_storage.go#L448-L468): `opt.SSHArguments` is populated from the JSON request body (`storage.config.sshArguments`). The string is split only on the literal ASCII space character, there is no shell style tokenizer, no quote handling, and no allowlist. Whatever tokens the caller supplies are appended to the `ssh` argv. OpenSSH treats `-oProxyCommand=<value>` as a directive to execute `<value>` via the user's shell (`$SHELL -c <value>`) and pipe the SSH transport over its stdio. The shell invocation happens before SSH attempts a TCP connection, so the command runs even when the target host is unreachable. ## Impact No user interaction is required. No valid credentials are required. The exploit is a single HTTP request. ## Credits This vulnerability was discovered and responsibly disclosed by Daniele Berardinelli. ## Mitigation https://github.com/kopia/kopia/pull/5354 disallows starting of a server without a password which also listens on a non-loopback interface.

CVE-2026-45695 Affected Kopia Versions

1 component(s)
Fixed Versions:
0.23.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/kopia/kopia
Go
< 0.23.0
0.23.0

References

Frequently Asked Questions

What is CVE-2026-45695?
CVE-2026-45695 is a security vulnerability in Kopia involving RCE via SSH ProxyCommand Injection under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Kopia versions are affected?
Affected versions include releases prior to 0.23.0 across affected packages: github.com/kopia/kopia.
What version fixes CVE-2026-45695?
Upgrading to 0.23.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/kopia/kopia affected?
Yes, github.com/kopia/kopia is affected in releases prior to 0.23.0. Upgrade your dependency to 0.23.0 or later.
What is the CVSS score of CVE-2026-45695?
CVE-2026-45695 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-45695?
CVE-2026-45695 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Go dependencies for CVE-2026-45695?
Run the dependency tree command: 'inspect dependencies for github.com/kopia/kopia'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2q4c-3mrw-63c3",
  "modified" : "2026-05-19T19:18:32Z",
  "published" : "2026-05-19T19:18:32Z",
  "aliases" : [ "CVE-2026-45695" ],
  "summary" : "Kopia: RCE via SSH ProxyCommand Injection",
  "details" : "## Summary\n\nKopia's HTTP server, when started with `--without-password `, accepts unauthenticated requests to `/api/v1/repo/exists`. The handler forwards an attacker-supplied storage configuration to `blob.NewStorage`. For SFTP backends with `externalSSH: true`, that path constructs a process command line by splitting `sshArguments` on spaces and passes the result directly to `exec.CommandContext(\"ssh\")`. An `-oProxyCommand=<cmd>` token in `sshArguments` causes OpenSSH to invoke `<cmd>` via `$SHELL -c` before any TCP connection is attempted, giving the requester arbitrary command execution as the Kopia process user.\n\n## Analysis\n\n[`internal/server/server_authz_checks.go` lines 61–73](https://github.com/kopia/kopia/blob/v0.22.3/internal/server/server_authz_checks.go#L61-L73):\n\nwhen the server is started without `--server-username` or `--server-password`, `getAuthenticator()` returns `nil` and `requireUIUser` unconditionally authorizes the request. Every endpoint registered through `handleUIPossiblyNotConnected` becomes accessible without credentials.\n\n[`repo/blob/sftp/sftp_storage.go` lines 448–468](https://github.com/kopia/kopia/blob/v0.22.3/repo/blob/sftp/sftp_storage.go#L448-L468):\n\n`opt.SSHArguments` is populated from the JSON request body (`storage.config.sshArguments`). The string is split only on the literal ASCII space character, there is no shell style tokenizer, no quote handling, and no allowlist. Whatever tokens the caller supplies are appended to the `ssh` argv. \n\nOpenSSH treats `-oProxyCommand=<value>` as a directive to execute `<value>` via the user's shell (`$SHELL -c <value>`) and pipe the SSH transport over its stdio. The shell invocation happens before SSH attempts a TCP connection, so the command runs even when the target host is unreachable.\n\n## Impact\n\nNo user interaction is required. No valid credentials are required. The exploit is a single HTTP request.\n\n## Credits \n\nThis vulnerability was discovered and responsibly disclosed by Daniele Berardinelli.\n\n## Mitigation\nhttps://github.com/kopia/kopia/pull/5354 disallows starting of a server without a password which also listens on a non-loopback interface.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/kopia/kopia"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.23.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.22.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/kopia/kopia/security/advisories/GHSA-2q4c-3mrw-63c3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/kopia/kopia/pull/5354"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/kopia/kopia"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-306", "CWE-78" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-19T19:18:32Z",
    "nvd_published_at" : null
  }
}