Severity:

HIGH RISK

(7.4)

Weak Diffie-Hellman (CWE-326) in UltraVNC MS-Logon II

CVE-2026-7830

Modified

Vulnerability type

Category:

Inadequate Cryptography

CWE:

CWE-326, CWE-338

Impact:

Credential Disclosure via Broken Session Key

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

UltraVNC MS-Logon II uses a 64-bit Diffie-Hellman key and a predictable RNG to derive session keys, making its cryptography trivially breakable.

An attacker who can observe the MS-Logon II handshake on the network can reconstruct the shared key and decrypt the encapsulated username and password, leading to full credential disclosure.

Affected context

This vulnerability occurs in UltraVNC deployments that still rely on the legacy MS-Logon II authentication scheme using rfbUltraVNC_MsLogonIIAuth.

It is relevant where:

  • Remote desktop sessions are negotiated using MS-Logon II instead of more modern schemes
  • Clients and servers are configured to allow or prefer this legacy mode
  • Network traffic between client and server can be observed or captured (e.g., same LAN, compromised router, or on-path adversary)

MS-Logon III, which uses X25519 and AES-256-GCM, operates with different cryptographic parameters and is not impacted by this specific weakness.

Exploit preconditions

  • Attack surface: Network-level traffic between UltraVNC client and server during MS-Logon II handshake.
  • Required access: Ability to passively observe, capture, or intercept TCP traffic (e.g., sniffing on the same network segment, on-path MITM, or recording remote desktop sessions).
  • Trigger point: The Diffie-Hellman key exchange and subsequent encrypted credential transfer that occur when an MS-Logon II session is established.
  • Why exploitation is possible:
  • The Diffie-Hellman prime is constrained to 64-bit size, making discrete log computation feasible with off-the-shelf hardware (e.g., via Pollard's rho).
  • The private exponent is generated using a weak pseudo-random sequence derived from rand() seeded by time(NULL), leaving only ~31 bits of internal state to recover.
  • Once the shared key is reconstructed, the attacker can decrypt the credentials carried within the handshake without further interaction.

Why this happens

The root cause lies in cryptographic design decisions that underestimate modern adversary capabilities.

The Diffie-Hellman implementation restricts prime size via DH_MAX_BITS to values that fit within an unsigned 64-bit integer, dramatically weakening the hardness of the underlying discrete logarithm problem (CWE-326: Inadequate Encryption Strength).

Compounding this, the private exponent is derived from a custom RNG that combines three calls to libc rand() seeded with time(NULL), providing low entropy and a small internal state. This aligns with CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator because the random values are predictable and reproducible.

Together, these choices produce session keys that can be reconstructed by a passive network observer, violating the confidentiality guarantee expected from authenticated key exchanges.

Potential impact

  • An attacker may reconstruct the shared Diffie-Hellman key for MS-Logon II sessions.
  • A network observer could decrypt the encapsulated username and password used for authentication.
  • Attackers can potentially replay or abuse recovered credentials to establish unauthorized remote desktop sessions.
  • Compromise of those credentials could enable further lateral movement within the target environment.
  • Long-term capture of traffic could allow retroactive decryption of previously recorded MS-Logon II handshakes.

General mitigation guidance

Effective mitigation generally focuses on eliminating weak cryptographic constructions and reducing reliance on legacy authentication modes.

Patterns that help include:

  • Disabling legacy authentication schemes that use small key sizes or non-cryptographic RNGs in favor of modern, proven algorithms.
  • Adopting key exchange mechanisms that enforce minimum key sizes aligned with current security recommendations and do not permit downgrades.
  • Ensuring that any random values used for key material or private exponents come from a cryptographically secure pseudo-random number generator with adequate entropy.
  • Applying defense-in-depth by limiting the exposure of credentials and using distinct, least-privilege accounts for remote access.
  • Segregating remote desktop traffic onto paths protected by strong transport-layer security to reduce opportunities for passive observation.

How teams detect issues like this

Organizations can detect and manage this class of weakness by focusing on cryptographic configuration and implementation analysis:

  • Use static analysis rules and secure coding guidelines that flag non-cryptographic PRNGs (such as rand()) when used for key or nonce generation.
  • Review cryptographic code for hard-coded limits on key sizes (e.g., small primes or bit-length caps) and legacy protocol modes that permit weak parameters.
  • Implement configuration audits to identify systems that still allow or negotiate legacy authentication schemes like MS-Logon II.
  • Monitor network traffic for known protocol signatures and handshake variants to detect the use of deprecated modes in production environments.
  • Integrate automated security testing and code review tools capable of identifying CWE-326 and CWE-338 patterns into CI/CD workflows.

Sources

SourceLink
github.comgithub.com/ultravnc/UltraVNC
uvnc.comuvnc.com/
securin.iosecurin.io/zero-days/cve-2026-7830-31-bit-dh-weak-rng-ms-logon-credential-interception-ultravnc

Frequently asked

questions

Yes. A passive network observer who can capture the MS-Logon II handshake traffic has enough information to reconstruct the shared key and decrypt the credentials, without needing to modify or inject packets.

No. The attacker only needs network-level visibility into the handshake traffic between client and server; no authenticated access to either endpoint is required to recover the session key and credentials.

The safest pattern is to deprecate and disable legacy authentication modes that rely on weak cryptographic parameters, and standardize on modern protocols that enforce strong key sizes and use cryptographically secure randomness for key material.

Future designs should rely on well-reviewed, standardized cryptographic primitives and libraries; enforce minimum key and parameter sizes aligned with current guidance; forbid non-cryptographic RNGs for security-sensitive operations; and incorporate regular cryptography-focused reviews into development and deployment practices.

Find out what's already
exploitable in your codebase.