Infinite Loop Vulnerability in Python Rencode Package: CVE-2021-40839

python-rencode Updated 02 Oct 2025

Summary

10/09/2021
N/A
No i
High
7.5

UBUNTU-CVE-2021-40839: The rencode package through 1.0.6 for Python allows an infinite loop in typecode decoding (such as via ;\x2f\x7f), enabling a remote attack that consumes CPU and memory. Affects python-rencode versions 1.0.3-1build1 – 1.0.3-1build2. No fix is published. 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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The rencode package is a Python library used for encoding and decoding data structures. It is designed to provide efficient serialization for Python objects. However, versions up to 1.0.6 have been found to contain a vulnerability that allows for an infinite loop during typecode decoding, which can lead to excessive CPU and memory consumption.

Vulnerability Detail

The vulnerability identified as CVE-2021-40839 exists in the rencode package through version 1.0.6. It allows attackers to exploit the decoding process, particularly through crafted input such as ';\x2f\x7f'. This can lead to an infinite loop, consuming system resources and potentially causing denial of service. The vulnerability is classified with a CVSS score of 7.5, indicating a high severity level.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, users can avoid using the rencode package until the package is updated to a secure version. Additionally, input validation can be implemented to filter out potentially malicious inputs that could trigger the infinite loop.

Conclusion

The rencode package has a critical vulnerability that can lead to resource exhaustion through an infinite loop during decoding. It is essential for users to update to the latest patched versions to mitigate this risk. Temporary workarounds can be employed until updates are applied.

See every vulnerability recorded for python-rencode →

Share this vulnerability

FAQ

CVE-2021-40839 is a vulnerability in the rencode package that allows for an infinite loop during typecode decoding, leading to resource exhaustion.

Versions of the rencode package up to 1.0.6 are affected by this vulnerability.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

If you cannot update the package, consider implementing input validation to mitigate the risk of exploitation.

The CVSS score of CVE-2021-40839 is 7.5, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for python-rencode.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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