CVE-2024-39705: Nltk Ntlk Unsafe Deserialization Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-cgvx-9447-vcch
CVSS 7.5
CWE-502 CWE-300
Published
Advisory Summary

CVE-2024-39705 is a HIGH (CVSS 7.5) ntlk unsafe deserialization vulnerability vulnerability (CWE-502: Deserialization of Untrusted Data) affecting Nltk libraries in the PyPI ecosystem. The issue involves ntlk unsafe deserialization vulnerability. Remediation is available by upgrading affected packages to version 3.9.

CVE-2024-39705 at a Glance

CVE Identifier CVE-2024-39705
GHSA Identifier GHSA-cgvx-9447-vcch
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-502: Deserialization of Untrusted Data
Affected Product Nltk
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:H/PR:N/UI:R/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2024-39705

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

nltk fixed: 3.9
pip install nltk>=3.9
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 nltk

How to Check if You Are Affected

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

pip show nltk

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-502: Deserialization of Untrusted Data, where the product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid. In Nltk, 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

NLTK through 3.8.1 allows remote code execution if untrusted packages have pickled Python code, and the integrated data package download functionality is used. This affects, for example, averaged_perceptron_tagger and punkt.

CVE-2024-39705 Affected Nltk Versions

1 component(s)
Fixed Versions:
3.9
Product / Package Ecosystem Affected Versions Fixed Version
nltk
PyPI
< 3.9
3.9

References

Frequently Asked Questions

What is CVE-2024-39705?
CVE-2024-39705 is a security vulnerability in Nltk involving ntlk unsafe deserialization vulnerability under CWE-502: Deserialization of Untrusted Data.
Which Nltk versions are affected?
Affected versions include releases prior to 3.9 across affected packages: nltk.
What version fixes CVE-2024-39705?
Upgrading to 3.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nltk affected?
Yes, nltk is affected in releases prior to 3.9. Upgrade your dependency to 3.9 or later.
What is the CVSS score of CVE-2024-39705?
CVE-2024-39705 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-39705?
CVE-2024-39705 is classified under CWE-502: Deserialization of Untrusted Data (The product deserializes untrusted data without sufficiently ensuring that the resulting data will be valid.).
How can I check PyPI dependencies for CVE-2024-39705?
Run the dependency tree command: 'pip show nltk'. 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-cgvx-9447-vcch",
  "modified" : "2025-01-21T18:28:57Z",
  "published" : "2024-06-28T00:33:31Z",
  "aliases" : [ "CVE-2024-39705" ],
  "summary" : "ntlk unsafe deserialization vulnerability",
  "details" : "NLTK through 3.8.1 allows remote code execution if untrusted packages have pickled Python code, and the integrated data package download functionality is used. This affects, for example, averaged_perceptron_tagger and punkt.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "nltk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.9"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39705"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nltk/nltk/issues/2522"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nltk/nltk/issues/3266"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nltk/nltk/commit/441aecb7d33014bd08672232c6c8bb69c2ceaba2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nltk/nltk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2024-167.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://www.vicarius.io/vsociety/posts/rce-in-python-nltk-cve-2024-39705-39706"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-300", "CWE-502" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-28T21:11:25Z",
    "nvd_published_at" : "2024-06-27T22:15:10Z"
  }
}