CVE-2026-85756: SSH.NET: ScpClient allows server-side RCE via default SCP path handling
SSH.NET is a Secure Shell (SSH) library for .NET. Prior to 2026.0.0, ScpClient places caller-supplied remote paths into the command used to run scp on the server, and the default RemotePathTransformation.DoubleQuote transformation cannot safely quote every remote command interpreter. When an application passes an attacker-controlled path to a shell-based server, shell metacharacters not neutralized by the active IRemotePathTransformation can execute commands as the authenticated SSH user. Exploitation requires a shell-based server and a path crafted for that shell's parsing rules; non-shell servers and paths fully neutralized by the selected transformation are not affected. RemotePathTransformation.ShellQuote is available for POSIX shells, while SftpClient avoids a remote shell entirely. This issue is fixed in version 2026.0.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
SSH.NET (ScpClient)to a version that resolves this vulnerability.Fixed in 2026.0.0 - Configuration
Use RemotePathTransformation.ShellQuote (for POSIX shells) so caller-supplied remote paths are quoted according to the remote shell parsing rules.
SSH.NET ScpClient RemotePathTransformation = ShellQuote
Event History
Frequently Asked Questions
Which deployments are exposed to command execution?
Applications using ScpClient before version 2026.0.0 are exposed when they pass attacker-controlled remote paths to a shell-based SSH server. The injected commands run as the SSH user authenticated by the application.
Are all SCP servers and remote paths affected?
No. Non-shell servers are not affected, and paths that are fully neutralized by the active IRemotePathTransformation are not affected. Exploitation also depends on crafting a path for the specific shell's parsing rules.
Is the default path transformation sufficient protection?
No. The default RemotePathTransformation.DoubleQuote cannot safely quote paths for every remote command interpreter, so it does not provide reliable protection across shell-based servers.
What can be done before upgrading?
For POSIX-shell servers, use RemotePathTransformation.ShellQuote. Alternatively, use SftpClient, which does not invoke a remote shell.
How can teams identify potentially affected usage?
Review uses of ScpClient that construct or accept remote paths from untrusted input, and determine whether the destination SSH server executes SCP through a shell. Check whether the application uses the default DoubleQuote transformation rather than a transformation that fully neutralizes the target shell's syntax.