Skip to content

Require SSH.NET 2026.0.0 for CVE-2026-48798 - #64

Merged
darinkes merged 3 commits into
mainfrom
fix/sshnet-2026-advisory
Aug 14, 2026
Merged

Require SSH.NET 2026.0.0 for CVE-2026-48798#64
darinkes merged 3 commits into
mainfrom
fix/sshnet-2026-advisory

Conversation

@darinkes

Copy link
Copy Markdown
Owner

Ports darinkes/SshNet.Agent#57 to SshNet.Keygen.

Summary

SSH.NET <= 2025.1.0 lets a malicious/MITM SCP server write files outside the target directory during a recursive ScpClient.Download (GHSA-q939-rpr3-3284, CVE-2026-48798, high).

SshNet.Keygen never calls ScpClient, so the library itself is not exploitable — but NuGet resolves the floor of a version range, so consumers who do not pin SSH.NET themselves pulled the vulnerable 2024.2.0 transitively and got an NU1903 warning for it.

SSH.NET range goes from [2024.2.0,2026.0) to [2026.0.0,2027.0).

Fallout from SSH.NET 2026.0.0

  • Renci.SshNet.Security.Cryptography.Ciphers.Paddings no longer exists; the using was unused, removed.
  • SshNet.Keygen.Sample pinned SSH.NET 2024.2.0 and now hit NU1605. Pin dropped — the sample gets SSH.NET transitively through the project reference, so there is nothing left to keep in sync.
  • The CI leg testing the newest SSH.NET pinned 2025.1.0, now below the floor. Bumped to 2026.0.0.

Breaking

Support for SSH.NET 2024.x and 2025.x is dropped; consumers stuck on those cannot take this release. Version bumped to 2026.0.0.0 to match the SSH.NET line it now requires.

Builds clean on net48/netstandard2.0/net8.0; 87 tests pass locally (interop tests skipped, no ssh-keygen/puttygen on the box).

Formats with no comment field (PKCS#1, SEC1) leave Key.Comment null, which
the OpenSSH and PuTTY private-key writers passed straight to
Encoding.UTF8.GetBytes. Fixes #62.
SSH.NET <= 2025.1.0 lets a malicious SCP server write outside the
download directory during a recursive ScpClient.Download
(GHSA-q939-rpr3-3284). Keygen never calls ScpClient, but NuGet resolves
the floor of the range, so consumers who do not pin SSH.NET themselves
got the vulnerable 2024.2.0 transitively.

Raise the range to [2026.0.0,2027.0). 2026.0.0 dropped the
Ciphers.Paddings namespace, so the unused using goes with it, and the
sample loses its own SSH.NET pin in favour of the transitive one.

This drops support for SSH.NET 2024.x and 2025.x, hence 2026.0.0.0.
Raising the floor to 2026.0.0 also made the PuTTY round-trips run on the
default CI leg for the first time. SSH.NET's PuTTY reader passes the
mpint private scalar straight to CNG, so ~50% of ECDSA keys - the ones
whose scalar has the high bit set and therefore carry PuTTY's leading
zero - fail to import on .NET Framework with a CryptographicException.
Our export matches what puttygen writes, so skip the case until SSH.NET
pads the scalar.
@darinkes
darinkes merged commit ab6b9a9 into main Aug 14, 2026
2 checks passed
@darinkes
darinkes deleted the fix/sshnet-2026-advisory branch August 14, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant