CVE-2013-2132
Pymongo < 2.5.2 Denial of Service via invalid DBRef, NULL pointer dereference
- CVSS 4.3
- CWE-476: NULL Pointer Dereference
- Input Validation and Sanitization
- Remote
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."
- CVSS base score
- 4.3
- Published
- 2013-08-15
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Fixed by upgrading
- Yes
Solution
Update pymongo to version 2.5.2 or higher.
Vulnerable code sample
import bson
def decode_dbref(dbref):
return bson.decode_all(bson.BSON.encode(dbref))
invalid_dbref = {'$ref': None, '$id': None}
result = decode_dbref(invalid_dbref)
print(result)Patched code sample
import bson
def decode_dbref(dbref):
try:
if not isinstance(dbref, dict):
raise ValueError("Invalid DBRef: Must be a dictionary")
if '$ref' not in dbref or '$id' not in dbref:
raise ValueError("Invalid DBRef: Missing '$ref' or '$id'")
return bson.decode_all(bson.BSON.encode(dbref))
except Exception as e:
print(f"Error decoding DBRef: {e}")
return None
dbref = {'$ref': 'collection_name', '$id': 'some_id'}
result = decode_dbref(dbref)
print(result)Cite this entry
@misc{vaitp:cve20132132,
title = {{Pymongo < 2.5.2 Denial of Service via invalid DBRef, NULL pointer dereference}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2013},
note = {VAITP Python Vulnerability Dataset, entry CVE-2013-2132},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2013-2132/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
