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

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 6.5
- **CVSS:** 6.5 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: Required; Scope: Unchanged; Confidentiality impact: High; Integrity impact: None; Availability impact: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** Yes (see exploit references)
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 1.37% (percentile 72, 2026-11-26)
- **CWE:** CWE-338
- **Aliases:** GHSA-72p8-v4hg-v45p
- **Published:** 2022-05-31T16:35:11.000Z
- **Modified:** 2026-06-17T04:39:54.520Z

## Who should check

- Projects that depend on NuGet package SSH.NET (\< 2020.0.2)
- Anyone running sshnet SSH.NET \>= 2020.0.0, \< 2020.0.2

## 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 \`curve25519-sha256@libssh.org\` key exchange algorithms.

## Affected and fixed versions

- NuGet `SSH.NET`: affected \< 2020.0.2; fixed 2020.0.2 (osv)
- sshnet SSH.NET: \>= 2020.0.0, \< 2020.0.2 (cvelist)

## Mitigation

- Upgrade SSH.NET to 2020.0.2 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-29245. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-29245.md
Affected: SSH.NET < 2020.0.2
Fixed in: 2020.0.2

Steps:
1. Search this machine and project for SSH.NET (NuGet), sshnet SSH.NET: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2022-29245 being exploited?

There is no confirmed exploitation: CVE-2022-29245 is not in the CISA Known Exploited Vulnerabilities catalog. Public exploit code or a proof of concept is available. EPSS estimates a 1.37% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2022-29245?

Medium: CVSS 6.5 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work.

### Which versions are affected by CVE-2022-29245?

SSH.NET \< 2020.0.2.

### Is there a fix for CVE-2022-29245?

Yes. Fixed in 2020.0.2. Upgrade SSH.NET to 2020.0.2 or later.

### How do I check if I'm affected by CVE-2022-29245?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/sshnet/SSH.NET/security/advisories/GHSA-72p8-v4hg-v45p>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2022-29245>
- patch: <https://github.com/sshnet/SSH.NET/commit/03c6d60736b8f7b42e44d6989a53f9b644a091fb>
- patch: <https://github.com/sshnet/SSH.NET/commit/f1f273cf349532b9d41c1de51d3b83a9accedc88>
- exploit: <https://github.com/sshnet/SSH.NET/blob/bc99ada7da3f05f50d9379f2644941d91d5bf05a/src/Renci.SshNet/Security/KeyExchangeECCurve25519.cs#L51>
- other: <https://github.com/sshnet/SSH.NET/releases/tag/2020.0.2>
- other: <https://github.com/sshnet/SSH.NET>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-29245>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-72p8-v4hg-v45p> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2022-29245> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-29245>
