CVE-2022-29245
C# vulnerability analysis and mitigation

Overview

SSH.NET, a Secure Shell (SSH) library for .NET, contained a security vulnerability in versions 2020.0.0 and 2020.0.1 where during the X25519 key exchange, the private key was generated using a weak random number generator. The vulnerability was discovered in May 2022 and tracked as CVE-2022-29245. The issue was patched in version 2020.0.2 (GitHub Release).

Technical details

The vulnerability stemmed from the use of System.Random() instead of a cryptographically secure random number generator for generating private keys during X25519 key exchange. The vulnerable code in KeyExchangeECCurve25519.cs used System.Random().NextBytes() to generate the private key, which is not suitable for cryptographic purposes as its seed can be bruteforced (GitHub Advisory).

Impact

An attacker capable of eavesdropping on SSH communications could potentially decrypt the traffic by exploiting the weak random number generation. This was possible because the private key generation used a predictable random number generator whose seed could be bruteforced (GitHub Advisory).

Mitigation and workarounds

The issue was fixed in version 2020.0.2 by replacing the weak random number generator with a cryptographically secure one using CryptoAbstraction.GenerateRandom(). For users unable to upgrade, a workaround exists by disabling the curve25519-sha256 and curve25519-sha256@libssh.org key exchange algorithms before establishing connections (GitHub Advisory).

Community reactions

The vulnerability was initially reported by Siemens AG, Digital Industries, followed by security researcher yaumn-synacktiv. The vendor addressed the issue promptly by releasing a security patch (GitHub Advisory).

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

CVE-2025-64095CRITICAL9.8
  • C#C#
  • DNN.PLATFORM
NoYesOct 28, 2025
CVE-2025-61413MEDIUM6.1
  • C#C#
  • Piranha
NoNoOct 23, 2025
CVE-2025-62594MEDIUM5.5
  • C#C#
  • Magick.NET-Q16-HDRI-x64
NoYesOct 27, 2025
CVE-2025-64094MEDIUM5.4
  • C#C#
  • DotNetNuke.Core
NoYesOct 28, 2025
CVE-2025-62802MEDIUM4.3
  • C#C#
  • Dnn.Platform
NoYesOct 28, 2025

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