Require SSH.NET 2026.0.0 for CVE-2026-48798 - #64
Merged
Conversation
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.
This was referenced Aug 14, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports darinkes/SshNet.Agent#57 to SshNet.Keygen.
Summary
SSH.NET <= 2025.1.0lets a malicious/MITM SCP server write files outside the target directory during a recursiveScpClient.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 vulnerable2024.2.0transitively and got anNU1903warning for it.SSH.NETrange 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.Paddingsno longer exists; theusingwas unused, removed.SshNet.Keygen.SamplepinnedSSH.NET 2024.2.0and now hitNU1605. Pin dropped — the sample gets SSH.NET transitively through the project reference, so there is nothing left to keep in sync.2025.1.0, now below the floor. Bumped to2026.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.0to 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).