CVE-2022-29245 Weak private key generation in SSH.NET

Medium 6.5 Published Updated

Weak random number generation in SSH.NET allows attackers to decrypt SSH communications by brute-forcing private key seeds.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2022-29245?

CVE-2022-29245 is a medium-severity vulnerability in sshnet SSH.NET, published on 31 May 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

SSH.NET is a Secure Shell (SSH) library for .NET. In versions 2020.0.0 and 2020.0.1, during an `X25519` key exchange, the client’s private key is generated with `System.Random`. `System.Random` is not a cryptographically secure random number generator, it must therefore not be used for cryptographic purposes. When establishing an SSH connection to a remote host, during the X25519 key exchange, the private key is generated with a weak random number generator whose seed can be brute forced. This allows an attacker who is able to eavesdrop on the communications to decrypt them. Version 2020.0.2 contains a patch for this issue. As a workaround, one may disable support for `curve25519-sha256` and `[email protected]` key exchange algorithms.

Weakness: CWE-338

Which versions are affected by CVE-2022-29245?

2 open source packages ship an affected version, including SSH.NET. It affects 1 product.

PackageAffectedFixed in
SSH.NET NuGetAll versions2020.0.2
SSH.NET NuGetAll versions2020.0.2

Products include Ssh.net Project Ssh.net.

How do I fix CVE-2022-29245?

Upgrade SSH.NET to 2020.0.2 or later.

Is CVE-2022-29245 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-29245 exists.

Sources

Also known as GHSA-72p8-v4hg-v45p.

Is CVE-2022-29245 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free