Critical Vulnerability in Python Packages: CVE-2022-48566 - Constant-Time Defeating Optimizations

python3.5 Updated 02 Oct 2025

Summary

22/08/2023
N/A
Yes i
Medium
5.9

UBUNTU-CVE-2022-48566: An issue was discovered in compare_digest in Lib/hmac.py in Python through 3.9.1. Affects python3.5 versions < 3.5.2-2ubuntu0~16.04.4~14.04.1+esm1. Fixed in 3.5.2-2ubuntu0~16.04.4~14.04.1+esm1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Python is a widely-used high-level programming language known for its readability and versatility. It supports multiple programming paradigms and is extensively utilized in web development, data analysis, artificial intelligence, and more. The affected packages, including python2.7, python3.4, python3.5, python3.6, python3.7, and python3.8, are essential components of various applications, providing core functionalities for executing Python scripts. The vulnerability in question affects the compare_digest function in the hmac module, which is crucial for secure hash comparisons.

Vulnerability Detail

The vulnerability arises from the compare_digest function in the hmac module of Python, where constant-time-defeating optimizations were possible in the accumulator variable. This flaw can lead to timing attacks, allowing an attacker to potentially infer sensitive information based on the time taken for hash comparisons. The vulnerability affects multiple versions of Python, making it critical for developers to address it promptly to maintain the integrity and security of their applications.

How To Fix

Minimum fixed version

3.5.2-2ubuntu0~16.04.4~14.04.1+esm1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python3.5

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate patching is not feasible, consider implementing additional security measures such as rate limiting on sensitive endpoints and using alternative secure comparison methods until the packages can be updated.

Conclusion

CVE-2022-48566 represents a significant vulnerability in several Python packages, allowing for potential timing attacks through the compare_digest function. It is crucial for developers to update their packages to the patched versions to mitigate this risk. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.

See every vulnerability recorded for python3.5 →

Share this vulnerability

FAQ

CVE-2022-48566 is a vulnerability in the compare_digest function of the hmac module in Python, which allows for potential timing attacks.

The vulnerability affects multiple Python versions, including python2.7, python3.4, python3.5, python3.6, python3.7, and python3.8.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

The CVSS score of CVE-2022-48566 is 5.9, indicating a medium severity level.

If immediate updates are not possible, implement security measures like rate limiting and alternative secure comparison methods until the packages can be patched.

Related vulnerabilities

Recent vulnerabilities recorded for python3.5.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

3.5.2-2ubuntu0~16.04.4~14.04.1+esm1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python3.5

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback