← Back to Pull requests

Add Kopia server SFTP ProxyCommand argument injection exploit (CVE-2026-45695) #21587

Closed
unknown closed this pull request without merging on Oct 08, 2026 16:11 UTC
View on GitHub
unknown unknown commented on Jun 19, 2026 15:38 UTC
Author

Summary

Adds exploit/linux/http/kopia_sftp_proxycommand_rce for CVE-2026-45695 (GHSA-2q4c-3mrw-63c3) — an unauthenticated command-execution flaw in the Kopia backup server.

POST /api/v1/repo/exists instantiates the storage backend before any repository is opened. For sftp with externalSSH enabled, Kopia builds the ssh argument vector by strings.Split(sshArguments, " ") with no tokenizer, so an -oProxyCommand=<cmd> token reaches ssh and OpenSSH runs it through /bin/sh before connecting. The endpoint is unauthenticated when the server is started with --without-password, giving command execution as the server process (root in the official container).

The value can't contain literal spaces (they'd be split into separate args), so the module encodes the payload and uses ${IFS} for the spaces (-oProxyCommand=echo${IFS}<b64>|base64${IFS}-d|sh), which is dash-compatible.

Affected: <= 0.22.3. Fixed in 0.23.0, which refuses to bind an unauthenticated server to a non-loopback address.

Verification

Lab:

docker run -d --name kopia-vuln -p 51515:51515 kopia/kopia:0.22.3 \
  server start --without-password --insecure --address 0.0.0.0:51515 --disable-csrf-token-checks

  • check reports vulnerable — a sleep ProxyCommand delays the response (time-based, no artifacts); verified ~5.0s delay.

  • run with cmd/unix/reverse_bash → Command shell session opened as root from the container.

  • Against kopia/kopia:0.23.0 the server refuses the unauthenticated non-loopback bind ("refusing to expose unauthenticated server on non-loopback network bind"), so the endpoint is unreachable — check returns safe.
  • The command runs blind (the request returns HTTP 500 after execution), so a callback payload is required; documented in the module.

    Diff: 230 lines (+172 / -58) across 2 files Reviewer: kenlacroix Review duration: 159872m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 230 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.326
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #21587"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37% (MEDIUM) · Higher = larger blast radius
    37%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.6% · Safe to merge
    14.6%