CVE-2013-2132: Pymongo Use Of NullPointerException Catch To Vulnerability

MODERATE
Advisory Identifier: GHSA-x33v-f3gp-gw2c
CWE-395
Published
Advisory Summary

CVE-2013-2132 is a MODERATE use of nullpointerexception catch to vulnerability (CWE-395: Use of NullPointerException Catch to Detect NULL Pointer Dereference) affecting Pymongo libraries in the PyPI ecosystem. The issue involves use of nullpointerexception catch to detect null pointer dereference in pymongo. Remediation is available by upgrading affected packages to version 2.5.2.

CVE-2013-2132 at a Glance

CVE Identifier CVE-2013-2132
GHSA Identifier GHSA-x33v-f3gp-gw2c
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-395: Use of NullPointerException Catch to Detect NULL Pointer Dereference
Affected Product Pymongo
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2013-2132

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

pymongo fixed: 2.5.2
pip install pymongo>=2.5.2
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 pymongo

How to Check if You Are Affected

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

pip show pymongo

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-395: Use of NullPointerException Catch to Detect NULL Pointer Dereference, where catching nullpointerexception should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer. In Pymongo, 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

bson/_cbsonmodule.c in the mongo-python-driver (aka. pymongo) before 2.5.2, as used in MongoDB, allows context-dependent attackers to cause a denial of service (NULL pointer dereference and crash) via vectors related to decoding of an "invalid DBRef."

CVE-2013-2132 Affected Pymongo Versions

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

References

Frequently Asked Questions

What is CVE-2013-2132?
CVE-2013-2132 is a security vulnerability in Pymongo involving Use of NullPointerException Catch to Detect NULL Pointer Dereference in Pymongo under CWE-395: Use of NullPointerException Catch to Detect NULL Pointer Dereference.
Which Pymongo versions are affected?
Affected versions include releases prior to 2.5.2 across affected packages: pymongo.
What version fixes CVE-2013-2132?
Upgrading to 2.5.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pymongo affected?
Yes, pymongo is affected in releases prior to 2.5.2. Upgrade your dependency to 2.5.2 or later.
What CWE is associated with CVE-2013-2132?
CVE-2013-2132 is classified under CWE-395: Use of NullPointerException Catch to Detect NULL Pointer Dereference (Catching NullPointerException should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer.).
How can I check PyPI dependencies for CVE-2013-2132?
Run the dependency tree command: 'pip show pymongo'. 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-x33v-f3gp-gw2c",
  "modified" : "2024-10-15T16:20:38Z",
  "published" : "2022-05-14T02:10:10Z",
  "aliases" : [ "CVE-2013-2132" ],
  "summary" : "Use of NullPointerException Catch to Detect NULL Pointer Dereference in Pymongo",
  "details" : "bson/_cbsonmodule.c in the mongo-python-driver (aka. pymongo) before 2.5.2, as used in MongoDB, allows context-dependent attackers to cause a denial of service (NULL pointer dereference and crash) via vectors related to decoding of an \"invalid DBRef.\"",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pymongo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.5.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2013-2132"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/mongo-python-driver/commit/a060c15ef87e0f0e72974c7c0e57fe811bbd06a2"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=710597"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mongodb/mongo-python-driver"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pymongo/PYSEC-2013-30.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://jira.mongodb.org/browse/PYTHON-532"
  }, {
    "type" : "WEB",
    "url" : "https://lists.opensuse.org/opensuse-updates/2013-06/msg00180.html"
  }, {
    "type" : "WEB",
    "url" : "https://seclists.org/oss-sec/2013/q2/447"
  }, {
    "type" : "WEB",
    "url" : "https://ubuntu.com/usn/usn-1897-1"
  }, {
    "type" : "WEB",
    "url" : "https://www.debian.org/security/2013/dsa-2705"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-395" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-07-08T19:07:51Z",
    "nvd_published_at" : "2013-08-15T17:55:00Z"
  }
}