Infinite Loop Vulnerability in Python Rencode Package

python-rencode Updated 02 Oct 2025

Summary

10/09/2021
N/A
Yes i
Unrated
Not published

DEBIAN-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.6-2. Fixed in 1.0.6-2. 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 designed for efficient encoding and decoding of data structures. It is widely used in applications that require serialization of complex data types. However, versions of rencode up to 1.0.6 are vulnerable to a specific issue that allows for an infinite loop during typecode decoding, which can lead to significant resource consumption.

Vulnerability Detail

The vulnerability arises from the way the rencode package handles typecode decoding. Specifically, it allows for an infinite loop when processing certain inputs, such as ';\x2f\x7f'. This can be exploited by remote attackers to consume excessive CPU and memory resources, potentially leading to denial of service conditions. The issue is present in all versions of rencode up to 1.0.6, making it critical for users to address this vulnerability promptly.

How To Fix

Minimum fixed version

1.0.6-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-rencode

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

Workaround

As a temporary workaround, users can limit the input data to the rencode package to avoid triggering the infinite loop. This can be done by validating and sanitizing inputs before passing them to the rencode functions.

Conclusion

The rencode package has a critical vulnerability that allows for an infinite loop during typecode decoding, which can be exploited by attackers. Users are strongly advised to update to the patched version to protect their applications from potential denial of service attacks. Implementing input validation can serve as a temporary measure until the update is applied.

See every vulnerability recorded for python-rencode →

Share this vulnerability

FAQ

The rencode package is used for encoding and decoding Python data structures, making it useful for serialization tasks.

Exploitation of this vulnerability can lead to excessive CPU and memory usage, potentially causing your application to become unresponsive.

Yes, the vulnerability has been patched in version 1.0.6-2 of the rencode package.

You can implement input validation and sanitization as a temporary workaround to mitigate the risk.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. You can check your application using the Vulert playground without any signup.

Related vulnerabilities

Recent vulnerabilities recorded for python-rencode.

How To Fix

Minimum fixed version

1.0.6-2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python-rencode

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