Vulnerabilities in pkg:pypi/rencode

PACKAGE
Advisory Identifier: GHSA-gh8j-2pgf-x458
Advisory Summary

CVE-2021-40839 is a HIGH (CVSS 7.5) infinite loop vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Rencode libraries in the PyPI ecosystem. The issue involves infinite loop in rencode. Remediation is available in the latest vendor maintenance releases.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/rencode

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/rencode. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-gh8j-2pgf-x458 CVE-2021-40839 HIGH Infinite Loop in rencode

CVE-2021-40839 at a Glance

CVE Identifier CVE-2021-40839
GHSA Identifier GHSA-gh8j-2pgf-x458
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product Rencode
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2021-40839

To remediate this vulnerability, upgrade all affected Rencode dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

rencode fixed: Latest secure release
pip install rencode>=Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show rencode

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2021-40839, inspect your installed packages using pip:

pip show rencode

Analyze the terminal output to locate any version of Rencode in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The pip show rencode command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In Rencode, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2021-40839 Affected Rencode Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
rencode
PyPI
≤ 1.0.6

References

Frequently Asked Questions

What is CVE-2021-40839?
CVE-2021-40839 is a security vulnerability in Rencode involving Infinite Loop in rencode under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Rencode versions are affected?
Affected versions include releases prior to current release patches across affected packages: rencode.
What version fixes CVE-2021-40839?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is rencode affected?
Yes, rencode is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2021-40839?
CVE-2021-40839 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-40839?
CVE-2021-40839 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check PyPI dependencies for CVE-2021-40839?
Run the dependency tree command: 'pip show rencode'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gh8j-2pgf-x458",
  "modified" : "2024-10-26T18:35:18Z",
  "published" : "2021-09-13T20:05:51Z",
  "aliases" : [ "CVE-2021-40839" ],
  "summary" : "Infinite Loop in rencode",
  "details" : "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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "rencode"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.0.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-40839"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aresch/rencode/pull/29"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aresch/rencode/commit/572ff74586d9b1daab904c6f7f7009ce0143bb75"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-gh8j-2pgf-x458"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aresch/rencode"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/rencode/PYSEC-2021-345.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BMVQRPDVSVZNGGX57CFKCYT3DEYO4QB6"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MCLETLGVM5DBX6QNHQFW6TWGO5T3DENY"
  }, {
    "type" : "WEB",
    "url" : "https://pypi.org/project/rencode/#history"
  }, {
    "type" : "WEB",
    "url" : "https://seclists.org/fulldisclosure/2021/Sep/16"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20211008-0001"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-09-13T19:11:37Z",
    "nvd_published_at" : "2021-09-10T02:15:00Z"
  }
}