Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2023-52323

CVE-2023-52323: Pycryptodome Information Disclosure Flaw

CVE-2023-52323 is an information disclosure vulnerability in Pycryptodome that allows side-channel leakage during OAEP decryption, exploitable for Manger attacks. This article covers technical details, affected versions, and mitigations.

Published:

CVE-2023-52323 Overview

CVE-2023-52323 is a side-channel vulnerability affecting PyCryptodome and pycryptodomex, two popular Python cryptographic libraries. Versions prior to 3.19.1 are susceptible to side-channel leakage during OAEP (Optimal Asymmetric Encryption Padding) decryption operations. This vulnerability can be exploited to perform a Manger attack, a sophisticated cryptographic attack that allows an adversary to decrypt ciphertext by analyzing the timing or behavior of the decryption process.

Critical Impact

Attackers can exploit timing differences in OAEP decryption to recover plaintext data through a Manger attack, potentially compromising encrypted communications and sensitive data protected by RSA-OAEP encryption.

Affected Products

  • PyCryptodome versions prior to 3.19.1
  • pycryptodomex versions prior to 3.19.1
  • Python applications using vulnerable versions of these cryptographic libraries

Discovery Timeline

  • 2024-01-05 - CVE-2023-52323 published to NVD
  • 2025-06-03 - Last updated in NVD database

Technical Details for CVE-2023-52323

Vulnerability Analysis

This vulnerability falls under the category of Side Channel Attack (CWE-203: Observable Discrepancy). The flaw exists in the implementation of RSA-OAEP decryption within PyCryptodome and pycryptodomex libraries. During the decryption process, the code exhibits timing variations that correlate with the internal state of the cryptographic operation, creating an observable side channel.

The Manger attack specifically targets OAEP implementations that leak information about whether the decryption process succeeds or fails at various stages. By carefully crafting malformed ciphertexts and observing the timing or error responses, an attacker can systematically extract information about the private key operations, eventually recovering the plaintext of intercepted encrypted messages.

This attack requires network access to a service performing OAEP decryption operations and the ability to send multiple carefully crafted ciphertext queries while measuring response times or observing error conditions.

Root Cause

The root cause of CVE-2023-52323 lies in the non-constant-time implementation of OAEP decryption routines in PyCryptodome. Cryptographic operations that handle sensitive data must execute in constant time regardless of input values to prevent timing-based side-channel attacks. The vulnerable versions of PyCryptodome contained code paths that exhibited observable timing differences based on the validity and structure of the decrypted OAEP padding.

Specifically, the decryption process would return or respond differently depending on where in the OAEP padding validation the operation failed, creating distinguishable timing profiles that an attacker could exploit through repeated queries.

Attack Vector

The attack vector for CVE-2023-52323 is network-based, requiring no authentication or user interaction. An attacker can exploit this vulnerability by:

  1. Intercepting an encrypted message protected with RSA-OAEP from a target application
  2. Sending modified versions of this ciphertext to a server that performs OAEP decryption
  3. Measuring the timing of responses or observing error messages
  4. Using the Manger attack algorithm to iteratively narrow down the plaintext value
  5. After sufficient queries (typically thousands), recovering the complete plaintext

The attack is particularly dangerous for applications that provide decryption as a service or automatically process encrypted messages, as attackers can automate the query process. The vulnerability requires multiple adaptive queries, making it more complex to exploit but still practically feasible against exposed services.

Detection Methods for CVE-2023-52323

Indicators of Compromise

  • Unusual patterns of failed decryption attempts from a single source
  • High volume of slightly modified encrypted messages targeting OAEP decryption endpoints
  • Timing analysis requests or unusually precise timing measurements in network traffic
  • Anomalous error rates in cryptographic operations without corresponding application issues

Detection Strategies

  • Monitor for suspicious patterns of repeated decryption requests with similar but modified ciphertexts
  • Implement rate limiting and anomaly detection on cryptographic API endpoints
  • Review application dependencies to identify vulnerable versions of PyCryptodome (< 3.19.1) or pycryptodomex (< 3.19.1)
  • Deploy network monitoring to detect timing-based attack patterns against encryption services

Monitoring Recommendations

  • Audit Python package dependencies using tools like pip-audit or safety to identify vulnerable cryptographic libraries
  • Enable detailed logging for cryptographic operations to establish baselines and detect anomalies
  • Implement application performance monitoring (APM) to identify timing inconsistencies in decryption routines
  • Configure alerting for elevated error rates in RSA-OAEP decryption operations

How to Mitigate CVE-2023-52323

Immediate Actions Required

  • Upgrade PyCryptodome to version 3.19.1 or later immediately
  • Upgrade pycryptodomex to version 3.19.1 or later immediately
  • Audit all Python applications and dependencies for vulnerable library versions
  • Regenerate and rotate any RSA keys that may have been exposed through vulnerable decryption services

Patch Information

The vulnerability has been addressed in PyCryptodome and pycryptodomex version 3.19.1. Users should upgrade to this version or later to receive the security fix. The patch implements constant-time OAEP decryption operations that prevent timing-based side-channel attacks.

For detailed information about the fix, refer to the GitHub Changelog for PyCryptodome and the PyPI Project History for PyCryptodome.

Workarounds

  • Implement network-level rate limiting on endpoints performing RSA-OAEP decryption to slow potential attacks
  • Add artificial timing noise to decryption responses as a temporary measure (note: this is not a substitute for patching)
  • Consider disabling affected cryptographic endpoints until the library can be upgraded
  • Implement additional authentication requirements to limit access to decryption services
bash
# Upgrade PyCryptodome to patched version
pip install --upgrade pycryptodome>=3.19.1

# Upgrade pycryptodomex to patched version
pip install --upgrade pycryptodomex>=3.19.1

# Verify installed version
pip show pycryptodome | grep Version
pip show pycryptodomex | grep Version

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.