CVE-2021-40528
NixOS vulnerability analysis and mitigation

Overview

The ElGamal implementation in Libgcrypt before version 1.9.4 contains a vulnerability (CVE-2021-40528) that allows plaintext recovery. The vulnerability occurs during the interaction between two cryptographic libraries, where a specific combination of the prime defined by the receiver's public key, the generator defined by the receiver's public key, and the sender's ephemeral exponents can lead to a cross-configuration attack against OpenPGP (MITRE CVE, IBM Research).

Technical details

The vulnerability stems from dangerous combinations of ElGamal parameter choices in OpenPGP implementations. The attack becomes possible when the receiver's public key defines a prime where p-1 contains small factors, the receiver's public key defines a generator that generates the full group of invertible elements, and the sender's library uses short ephemeral exponents. This combination allows for plaintext recovery through a combination of the Pohlig-Hellman algorithm and Baby-step giant-step algorithm (IBM Research).

Impact

The vulnerability allows attackers to recover plaintexts from encrypted messages when specific combinations of sender and receiver software are used. The attack particularly affects messages sent by GPG (via Libgcrypt) or Crypto++ to approximately 2,132 registered public PGP keys. The attack complexity varies depending on the sender's software and receiver's public key, ranging from a few hours on commodity hardware to several CPU-years (IBM Research).

Mitigation and workarounds

The vulnerability was addressed in Libgcrypt version 1.9.4 by modifying the sampling of ephemeral exponents to use large values with as many bits as p. Users are advised to upgrade to this version or later. For affected keys, it is recommended to revoke them and generate new keys using either GPG, Crypto++, or switch to different algorithms such as RSA or ECC (Gentoo Security, IBM Research).

Additional resources


SourceThis report was generated using AI

Related NixOS vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-61619HIGH7.5
  • NixOSNixOS
  • android
NoNoDec 01, 2025
CVE-2025-61618HIGH7.5
  • NixOSNixOS
  • android
NoNoDec 01, 2025
CVE-2025-61617HIGH7.5
  • NixOSNixOS
  • android
NoNoDec 01, 2025
CVE-2025-61610HIGH7.5
  • NixOSNixOS
  • android
NoNoDec 01, 2025
CVE-2025-61609HIGH7.5
  • NixOSNixOS
  • android
NoNoDec 01, 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