GHSA-mggc-4xg6-vcxf: OS Command Injection

Published Sep 17, 2026
·
Updated

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).

Affected Software

1 affected componentFixes available
nuget/SSH.NET<2026.0.0
2026.0.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade nuget/SSH.NET to a version that resolves this vulnerability.

    Fixed in 2026.0.0

Event History

Sep 17, 2026
Advisory Published
via GitHub·05:18 PM
Data Sourced
via GitHub·05:18 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed?

Applications using SSH.NET's ScpClient are exposed when they pass an attacker-influenced remote path to an SCP server that runs the requested command through a shell. The resulting command executes with the privileges of the authenticated SSH user.

2

Is the default configuration affected?

Potentially. RemotePathTransformation defaults to DoubleQuote, but POSIX-shell command substitutions such as $(...) and backticks can survive double-quoting and may be used to achieve command execution.

3

What must an attacker control to exploit this?

The attacker needs influence over the remote path supplied by the application and must craft it for the escaping transformation in use. Exploitation also requires a shell-based remote server; paths that are correctly neutralized by the active transformation, or a non-shell-based server, do not meet the described conditions.

4

Can changing RemotePathTransformation fully mitigate the issue?

No. SSH.NET provides RemotePathTransformation to control escaping behavior, but it cannot guarantee safety for arbitrary remote command interpreters. Avoid passing untrusted input as an SCP remote path where possible.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203