CVE-2026-48798
C# vulnerability analysis and mitigation

Overview

CVE-2026-48798 is a path traversal vulnerability in the SSH.NET library's ScpClient.Download(string directoryName, DirectoryInfo directoryInfo) method that allows a malicious or man-in-the-middle SCP server to write files outside the intended local download directory. All versions of the NuGet package SSH.NET up to and including 2025.1.0 are affected; the issue is fixed in version 2026.0.0. The vulnerability was reported by Nadav0077 and igorpyan, published by Rob-Hague on August 9, 2026, and added to the GitHub Advisory Database on August 12, 2026. It carries a CVSS v3.1 base score of 7.1 (High) (GitHub Advisory, SSH.NET Advisory).

Technical details

The root cause is the absence of input validation on server-supplied file and directory names during recursive SCP downloads, classified as CWE-22 (Path Traversal) and CWE-73 (External Control of File Name or Path). During a recursive download, the SCP protocol transmits C (file) and D (directory) records containing names that the client combines with the local destination path using Path.Combine(); without sanitization, names containing ../, absolute paths, drive qualifiers (e.g., C:\), or other path separators cause writes outside the intended directory. The fix introduces an EnsureValidLocalName() method that rejects any server-supplied name that is empty, equals . or .., or contains characters invalid in a local filename (using Path.GetInvalidFileNameChars(), which is platform-aware), throwing a ScpException on detection. This is analogous to OpenSSH CVE-2019-6111 but extends to directory traversal (GitHub Advisory, Fix Commit).

Impact

A successful exploit allows a malicious, compromised, or MITM SCP server to create directories and write or overwrite arbitrary files anywhere the client process has filesystem access. High-value targets include ~/.ssh/authorized_keys (enabling persistent unauthorized SSH access), shell RC files, cron entries, and application binaries or configuration files, any of which can lead to persistence, privilege escalation, or remote code execution on the client host. Confidentiality impact is rated None (the attacker writes files, not reads them), while integrity impact is High and availability impact is Low (SSH.NET Advisory).

Exploitability

Exploitation requires user interaction — specifically, a victim must initiate a directory download (ScpClient.Download) from an attacker-controlled or MITM'd SCP server — but requires no privileges on the attacker's side. No public proof-of-concept exploit code has been identified, and there is no evidence of in-the-wild exploitation at the time of disclosure. The CVE status is listed as Reserved, and it does not appear in the CISA Known Exploited Vulnerabilities catalog. No EPSS score is currently available (GitHub Advisory).

Exploitation steps

  1. Set up a malicious SCP server: Configure a server (or perform a MITM attack on an existing SCP connection) that responds to SCP recursive download requests with crafted protocol messages.
  2. Craft malicious SCP records: Prepare C (file) or D (directory) SCP protocol records whose name fields contain path traversal sequences such as ../, absolute paths like /tmp/evil, or on Windows, backslash sequences like ..\escaped\owned.txt.
  3. Lure the victim: Social-engineer or otherwise cause a victim application using SSH.NET's ScpClient.Download(string directoryName, DirectoryInfo directoryInfo) to connect to the malicious server and initiate a recursive directory download.
  4. Deliver traversal payload: When the client sends the SCP download request, respond with the crafted records. For example, send C0644 0 ../../../home/user/.ssh/authorized_keys\n followed by the attacker's public key as file content.
  5. Achieve arbitrary file write: The unpatched SSH.NET client combines the server-supplied name with the local destination path without validation, writing the attacker's content to the traversed path (e.g., overwriting ~/.ssh/authorized_keys to enable passwordless SSH login) (GitHub Advisory, Fix Commit).

Indicators of compromise

  • File System: Unexpected files appearing outside the intended SCP download directory, particularly in sensitive locations such as ~/.ssh/authorized_keys, ~/.bashrc, ~/.profile, /etc/cron.d/, or application binary/config directories; newly created directories with names matching traversal patterns.
  • Logs: SCP client-side logs or application logs showing ScpException with the message "not a valid local name" (on patched versions, indicating an attempted exploit); SSH connection logs showing connections to unfamiliar or unexpected SCP server addresses.
  • Network: Outbound SCP (TCP port 22) connections from client hosts to unexpected or newly registered server IP addresses; MITM indicators such as SSH host key warnings or changes in known_hosts entries.
  • Process: Unexpected modification timestamps on sensitive files (e.g., ~/.ssh/authorized_keys) coinciding with SCP download activity from the affected application (SSH.NET Advisory).

Mitigation and workarounds

Upgrade the SSH.NET NuGet package to version 2026.0.0, which introduces the EnsureValidLocalName() validation guard that rejects any server-supplied name containing path traversal sequences before any local filesystem operation is performed. No configuration-based workaround is available for unpatched versions; the only safe mitigation is upgrading. As an interim measure, restrict use of ScpClient.Download with directory arguments to connections with fully trusted, verified SCP servers, and avoid connecting to untrusted or third-party SCP endpoints (GitHub Advisory, Fix Commit).

Additional resources


SourceThis report was generated using AI

Related C# vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-pfvm-w89x-94jwHIGH7.5
  • C# logoC#
  • SIPSorcery
NoYesAug 12, 2026
CVE-2026-48798HIGH7.1
  • C# logoC#
  • SSH.NET
NoYesAug 18, 2026
CVE-2026-54570MEDIUM6.9
  • C# logoC#
  • AngleSharp
NoYesAug 18, 2026
CVE-2026-73851MEDIUM6.1
  • C# logoC#
  • Microsoft.OpenApi.Kiota
NoYesAug 17, 2026
CVE-2026-48796MEDIUM5.3
  • C# logoC#
  • CefSharp.Common
NoYesAug 18, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management