Vulnerabilities in pkg:nuget/SSH.NET

PACKAGE
Advisory Identifier: GHSA-mggc-4xg6-vcxf
Advisory Summary

CVE-2026-85756 is a HIGH (CVSS 7.5) remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting SSH.NET libraries in the NuGet ecosystem. The issue involves scpclient allows server-side rce via default scp path handling. Remediation is available by upgrading affected packages to version 2026.0.0.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:nuget/SSH.NET

3 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:nuget/SSH.NET. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-mggc-4xg6-vcxf CVE-2026-85756 HIGH SSH.NET: ScpClient allows server-side RCE via default SCP path handling
GHSA-q939-rpr3-3284 CVE-2026-48798 HIGH SSH.NET: ScpClient Recursive Download Allows Arbitrary File Write via Server-Controlled SCP Filenames
GHSA-72p8-v4hg-v45p CVE-2022-29245 MODERATE Weak private key generation in SSH.NET

CVE-2026-85756 at a Glance

CVE Identifier CVE-2026-85756
GHSA Identifier GHSA-mggc-4xg6-vcxf
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product SSH.NET
Package Ecosystem NuGet
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
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-85756

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

SSH.NET fixed: 2026.0.0
Upgrade SSH.NET to 2026.0.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 SSH.NET

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-85756, inspect your project dependencies for SSH.NET:

inspect dependencies for SSH.NET

Analyze the terminal output to locate any version of SSH.NET in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2026.0.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 SSH.NET, 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 Default SCP remote-path handling places caller-supplied paths into the command that runs scp on the server. On a shell-based server that command is interpreted by a shell, so an attacker-influenced path that is not quoted to suit that shell can execute as a command as the authenticated SSH user. SSH.NET provides `ScpClient.RemotePathTransformation` to control escaping behaviour (defaulting to `RemotePathTransformation.DoubleQuote`) but cannot guarantee safety for arbitrary remote command interpreters. This is inherent to running scp over a remote shell (cf. CVE-2020-15778). ## Impact Command execution on the SSH server as the authenticated SSH user, when an application passes an attacker-influenced remote path to ScpClient against a shell-based server. Exploitation depends on conditions beyond the attacker's control: the remote server must be shell-based, and the attacker-influenced path must be crafted to defeat the quoting applied by the transformation in effect — that is, to use metacharacters that it does not neutralise (for example $(...) or backticks, which survive the default double-quoting on a POSIX shell). A path that does not meet these escaping rules, or a non-shell-based server, does not result in command execution. ## Remediation The fixed release obsoletes the constructors that silently defaulted the path transformation and adds constructors that require an explicit `IRemotePathTransformation`, so callers are required to choose one that suits their server and trust environment. For POSIX shells, the library provides `RemotePathTransformation.ShellQuote`. The legacy default (`RemotePathTransformation.DoubleQuote`) is unchanged for backwards compatibility. SCP is considered legacy and SFTP, which does not involve a remote shell, is recommended where possible (via `SftpClient`).

CVE-2026-85756 Affected SSH.NET Versions

1 component(s)
Fixed Versions:
2026.0.0
Product / Package Ecosystem Affected Versions Fixed Version
SSH.NET
NuGet
< 2026.0.0
2026.0.0

References

Frequently Asked Questions

What is CVE-2026-85756?
CVE-2026-85756 is a security vulnerability in SSH.NET involving ScpClient allows server-side RCE via default SCP path handling under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which SSH.NET versions are affected?
Affected versions include releases prior to 2026.0.0 across affected packages: SSH.NET.
What version fixes CVE-2026-85756?
Upgrading to 2026.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is SSH.NET affected?
Yes, SSH.NET is affected in releases prior to 2026.0.0. Upgrade your dependency to 2026.0.0 or later.
What is the CVSS score of CVE-2026-85756?
CVE-2026-85756 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-85756?
CVE-2026-85756 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 NuGet dependencies for CVE-2026-85756?
Run the dependency tree command: 'inspect dependencies for SSH.NET'. 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-mggc-4xg6-vcxf",
  "modified" : "2026-09-17T17:18:01Z",
  "published" : "2026-09-17T17:18:01Z",
  "aliases" : [ "CVE-2026-85756" ],
  "summary" : "SSH.NET: ScpClient allows server-side RCE via default SCP path handling",
  "details" : "## Summary\n\nDefault SCP remote-path handling places caller-supplied paths into the command that runs scp on the server. On a shell-based server that command is interpreted by a shell, so an attacker-influenced path that is not quoted to suit that shell can execute as a command as the authenticated SSH user. SSH.NET provides `ScpClient.RemotePathTransformation` to control escaping behaviour (defaulting to `RemotePathTransformation.DoubleQuote`) but cannot guarantee safety for arbitrary remote command interpreters. This is inherent to running scp over a remote shell (cf. CVE-2020-15778).\n\n## Impact\n\nCommand execution on the SSH server as the authenticated SSH user, when an application passes an attacker-influenced remote path to ScpClient against a shell-based server.\n\nExploitation depends on conditions beyond the attacker's control: the remote server must be shell-based, and the attacker-influenced path must be crafted to defeat the quoting applied by the transformation in effect — that is, to use metacharacters that it does not neutralise (for example $(...) or backticks, which survive the default double-quoting on a POSIX shell). A path that does not meet these escaping rules, or a non-shell-based server, does not result in command execution.\n\n## Remediation\n\nThe fixed release obsoletes the constructors that silently defaulted the path transformation and adds constructors that require an explicit `IRemotePathTransformation`, so callers are required to choose one that suits their server and trust environment. For POSIX shells, the library provides `RemotePathTransformation.ShellQuote`. The legacy default (`RemotePathTransformation.DoubleQuote`) is unchanged for backwards compatibility. SCP is considered legacy and SFTP, which does not involve a remote shell, is recommended where possible (via `SftpClient`).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "SSH.NET"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2026.0.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sshnet/SSH.NET/security/advisories/GHSA-mggc-4xg6-vcxf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-85756"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sshnet/SSH.NET/commit/c66b9f8fb06c12e71761e58a577b1e796026310f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sshnet/SSH.NET"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sshnet/SSH.NET/releases/tag/2026.0.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-17T17:18:01Z",
    "nvd_published_at" : "2026-09-16T17:18:16Z"
  }
}