/

CVE-2026-48798

Severity:

HIGH RISK

(7.1)

Path Traversal (CWE-22) in SSH.NET ScpClient Download

CVE-2026-48798

Awaiting Analysis

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-73

Impact:

Arbitrary local file creation or overwrite

Severity:

HIGH RISK

(7.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

SSH.NET's SCP download routine trusts file and directory names supplied by a remote server when constructing local paths. A malicious, compromised, or intercepted SSH/SCP endpoint may use traversal sequences or absolute paths to create or overwrite files in locations writable by the client process.

Affected context

The vulnerability occurs when an application uses SSH.NET's ScpClient.Download method to retrieve files from an SCP server and the client process has write access to local filesystem locations outside the intended download directory. Risk depends on whether the remote endpoint, its traffic, or the names it returns can be controlled or altered.

Exploit preconditions

  • Attack surface: SCP file and directory download handling in the .NET client
  • Required access: Ability to operate, compromise, or influence the remote SCP server or the connection path
  • Trigger point: Processing remote file or directory names during ScpClient.Download
  • Why exploitation is possible: Returned names are combined with the requested local directory without verifying that the resulting path remains within the intended destination

Why this happens

The underlying bug is insufficient containment validation when converting attacker-influenced remote names into local filesystem paths. Path-combination logic may interpret ../ components or absolute paths as locations outside the requested directory, allowing remote input to control the final write destination. This maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with CWE-73: External Control of File Name or Path also relevant because external data influences local path selection.

Potential impact

  • An attacker may create or overwrite files in directories writable by the client process
  • Application configuration, credentials, or operational data could be modified
  • The client process could be disrupted through destructive file replacement
  • Subsequent execution of overwritten files could enable broader compromise, depending on host permissions and application behavior

General mitigation guidance

Mitigation generally focuses on treating all remote filenames as untrusted and enforcing destination containment before any filesystem operation.

Common defensive patterns include:

  • Resolve the candidate destination to a canonical path and verify it remains beneath the intended download directory
  • Reject absolute paths, parent-directory traversal components, and other ambiguous path forms
  • Prefer secure-by-default APIs that accept a fixed destination root and do not expose unrestricted path composition
  • Use allowlists for expected filename and directory formats where practical
  • Run the client with only the filesystem privileges required for its task
  • Store downloaded content in isolated, non-sensitive directories and avoid executing downloaded files
  • Protect the SSH connection and server trust configuration to reduce exposure to malicious or intercepted endpoints

How teams detect issues like this

Detection can combine static analysis, code review, runtime monitoring, and policy enforcement.

  • Search for filesystem writes whose paths include remote protocol fields or other externally controlled strings
  • Review uses of path-combination APIs for canonicalization and containment checks
  • Flag acceptance of absolute paths, parent-directory segments, or unusual separator encodings
  • Add tests that exercise traversal, rooted, mixed-separator, and normalization edge cases
  • Monitor client processes for writes outside approved download roots
  • Enforce repository policies requiring path validation before externally influenced file operations
  • Automated code-review and security-analysis tools may help identify uncontrolled path construction

Sources

SourceLink
github.comgithub.com/sshnet/SSH.NET/commit/600be0de543765995a189b5d7cd4efac5007f3ce
github.comgithub.com/sshnet/SSH.NET/releases/tag/2026.0.0
github.comgithub.com/sshnet/SSH.NET/security/advisories/GHSA-q939-rpr3-3284

Frequently asked

questions

It can be exploitable through a remote SCP interaction when an attacker controls, compromises, or can influence the server or connection handling the download. It is not typically exploitable solely by sending an ordinary request to an unrelated application endpoint.

The attacker generally needs the client to connect to an attacker-controlled or compromised SCP server, or must be able to alter the SCP exchange. The client process must also have write permission to the targeted local path.

Treat remote names as untrusted, reject rooted and traversal-style paths, and verify after canonicalization that every destination remains within a dedicated download directory before writing.

Use secure path-handling abstractions, apply least-privilege filesystem permissions, test normalization edge cases, and enforce code-review or CI policies for externally controlled file paths.

Find out what's already
exploitable in your codebase.